Commit 3959b216 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

......

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63358 954022d7-b5bf-4e40-9824-e11837661b57
parent 1a5b91ff
......@@ -179,7 +179,7 @@ void docx_serialize_text(std::wostream & strm, const std::vector<odf_reader::_pr
_CP_OPT(int) iAlign;
odf_reader::GetProperty(properties, L"textalign-vertical", iAlign);
odf_reader::GetProperty(properties, L"textarea-vertical_align", iAlign);
if (iAlign)
{
switch (iAlign.get())
......
......@@ -207,7 +207,7 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_p
{
_CP_OPT(int) iAlign;
odf_reader::GetProperty(prop,L"textalign-vertical",iAlign);
odf_reader::GetProperty(prop,L"textarea-vertical_align",iAlign);
if (iAlign)
{
switch (iAlign.get())
......@@ -225,6 +225,22 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_p
CP_XML_ATTR(L"anchor", L"just");break;
}
}
_CP_OPT(bool) bAutoGrowHeight;
_CP_OPT(bool) bFitToSize;
odf_reader::GetProperty(prop,L"fit-to-size", bFitToSize);
odf_reader::GetProperty(prop,L"auto-grow-height", bAutoGrowHeight);
if ((bAutoGrowHeight) && (*bAutoGrowHeight))
{
CP_XML_NODE(L"a:spAutoFit");
}
else if ((bFitToSize) && (*bFitToSize))
{
CP_XML_NODE(L"a:spAutoFit")
{
CP_XML_ATTR(L"lnSpcReduction", 10000);
}
}
//else CP_XML_ATTR(L"anchor", L"dist");break;
if (bWordArt)
{
......
......@@ -30,7 +30,7 @@ void pptx_serialize_text(std::wostream & strm, const std::vector<odf_reader::_pr
{
CP_XML_NODE(L"p:txBody")
{
oox_serialize_bodyPr(CP_XML_STREAM(),properties);
oox_serialize_bodyPr(CP_XML_STREAM(), properties);
if (strTextContent)
{
CP_XML_STREAM() << strTextContent.get();
......
......@@ -169,7 +169,9 @@ void pptx_text_context::Impl::end_paragraph()
void pptx_text_context::Impl::start_span(const std::wstring & styleName)// () - 1
{
if ((span_style_name_ !=styleName && span_style_name_.length()>0) || in_span)
int text_size = text_.str().length();
if ((span_style_name_ !=styleName && text_size > 0) || in_span)
{
dump_run();
}
......@@ -181,8 +183,8 @@ void pptx_text_context::Impl::start_span(const std::wstring & styleName)//
void pptx_text_context::Impl::end_span()
{
//dump_run();
//span_style_name_ = L"";
dump_run();
span_style_name_ = L"";
in_span = false;
}
......@@ -386,7 +388,7 @@ std::wstring pptx_text_context::Impl::dump_paragraph(/*bool last*/)
{
if (in_comment) return L"";
dump_run();//last
end_span();
std::wstring str_run = run_.str();
......
......@@ -136,9 +136,9 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_fill(fill);
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
if (properties.fo_clip_)
{
......
......@@ -17,36 +17,41 @@ void graphic_format_properties::add_attributes( const xml::attributes_wc_ptr & A
{
common_draw_fill_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"draw:wrap-influence-on-position", draw_wrap_influence_on_position_);
CP_APPLY_ATTR(L"draw:textarea-horizontal-align", draw_textarea_horizontal_align_);
CP_APPLY_ATTR(L"draw:textarea-vertical-align", draw_textarea_vertical_align_);
CP_APPLY_ATTR(L"draw:stroke", draw_stroke_);
CP_APPLY_ATTR(L"draw:stroke-dash", draw_stroke_dash_);
CP_APPLY_ATTR(L"draw:marker-start", draw_marker_start_);
CP_APPLY_ATTR(L"draw:marker-end", draw_marker_end_);
CP_APPLY_ATTR(L"svg:stroke-color", svg_stroke_color_);
CP_APPLY_ATTR(L"svg:stroke-width", svg_stroke_width_);
CP_APPLY_ATTR(L"svg:stroke-opacity",svg_stroke_opacity_);
CP_APPLY_ATTR(L"fo:min-width", fo_min_width_);
CP_APPLY_ATTR(L"fo:min-height", fo_min_height_);
CP_APPLY_ATTR(L"fo:max-width", fo_max_width_);
CP_APPLY_ATTR(L"fo:max-height", fo_max_height_);
CP_APPLY_ATTR(L"fo:clip", fo_clip_);
CP_APPLY_ATTR(L"draw:wrap-influence-on-position", draw_wrap_influence_on_position_);
CP_APPLY_ATTR(L"draw:textarea-horizontal-align", draw_textarea_horizontal_align_);
CP_APPLY_ATTR(L"draw:textarea-vertical-align", draw_textarea_vertical_align_);
CP_APPLY_ATTR(L"draw:auto-grow-height", draw_auto_grow_height_);
CP_APPLY_ATTR(L"draw:auto-grow-width", draw_auto_grow_width_);
CP_APPLY_ATTR(L"draw:fit-to-size", draw_fit_to_size_);
CP_APPLY_ATTR(L"draw:fit-to-contour", draw_fit_to_contour_);
CP_APPLY_ATTR(L"draw:stroke", draw_stroke_);
CP_APPLY_ATTR(L"draw:stroke-dash", draw_stroke_dash_);
CP_APPLY_ATTR(L"draw:marker-start", draw_marker_start_);
CP_APPLY_ATTR(L"draw:marker-end", draw_marker_end_);
CP_APPLY_ATTR(L"svg:stroke-color", svg_stroke_color_);
CP_APPLY_ATTR(L"svg:stroke-width", svg_stroke_width_);
CP_APPLY_ATTR(L"svg:stroke-opacity", svg_stroke_opacity_);
CP_APPLY_ATTR(L"fo:min-width", fo_min_width_);
CP_APPLY_ATTR(L"fo:min-height", fo_min_height_);
CP_APPLY_ATTR(L"fo:max-width", fo_max_width_);
CP_APPLY_ATTR(L"fo:max-height", fo_max_height_);
CP_APPLY_ATTR(L"fo:clip", fo_clip_);
CP_APPLY_ATTR(L"style:print-content", style_print_content_);
CP_APPLY_ATTR(L"style:protect", style_protect_);
CP_APPLY_ATTR(L"style:editable", style_editable_);
CP_APPLY_ATTR(L"style:wrap", style_wrap_);
CP_APPLY_ATTR(L"style:wrap-dynamic-treshold", style_wrap_dynamic_treshold_);
CP_APPLY_ATTR(L"style:number-wrapped-paragraphs", style_number_wrapped_paragraphs_);
CP_APPLY_ATTR(L"style:wrap-contour", style_wrap_contour_);
CP_APPLY_ATTR(L"style:wrap-contour-mode", style_wrap_contour_mode_);
CP_APPLY_ATTR(L"style:run-through", style_run_through_);
CP_APPLY_ATTR(L"style:flow-with-text", style_flow_with_text_);
CP_APPLY_ATTR(L"style:overflow-behavior", style_overflow_behavior_);
CP_APPLY_ATTR(L"style:mirror", style_mirror_);
CP_APPLY_ATTR(L"style:print-content", style_print_content_);
CP_APPLY_ATTR(L"style:protect", style_protect_);
CP_APPLY_ATTR(L"style:editable", style_editable_);
CP_APPLY_ATTR(L"style:wrap", style_wrap_);
CP_APPLY_ATTR(L"style:wrap-dynamic-treshold", style_wrap_dynamic_treshold_);
CP_APPLY_ATTR(L"style:number-wrapped-paragraphs", style_number_wrapped_paragraphs_);
CP_APPLY_ATTR(L"style:wrap-contour", style_wrap_contour_);
CP_APPLY_ATTR(L"style:wrap-contour-mode", style_wrap_contour_mode_);
CP_APPLY_ATTR(L"style:run-through", style_run_through_);
CP_APPLY_ATTR(L"style:flow-with-text", style_flow_with_text_);
CP_APPLY_ATTR(L"style:overflow-behavior", style_overflow_behavior_);
CP_APPLY_ATTR(L"style:mirror", style_mirror_);
common_draw_rel_size_attlist_.add_attributes(Attributes);
common_horizontal_margin_attlist_.add_attributes(Attributes);
......@@ -77,9 +82,13 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
if (draw_marker_start_) properties.push_back(_property(L"marker-start", draw_marker_start_->get() ));
if (draw_marker_end_) properties.push_back(_property(L"marker-end", draw_marker_end_->get() ));
if (draw_textarea_horizontal_align_)properties.push_back(_property(L"textalign-horizontal", draw_textarea_horizontal_align_->get_type() ));
if (draw_textarea_vertical_align_)properties.push_back(_property(L"textalign-vertical", draw_textarea_vertical_align_->get_type() ));
if (draw_textarea_horizontal_align_)properties.push_back(_property(L"textarea-horizontal_align",draw_textarea_horizontal_align_->get_type() ));
if (draw_textarea_vertical_align_) properties.push_back(_property(L"textarea-vertical_align", draw_textarea_vertical_align_->get_type() ));
if (draw_auto_grow_height_) properties.push_back(_property(L"auto-grow-height", *draw_auto_grow_height_));
if (draw_auto_grow_width_) properties.push_back(_property(L"auto-grow-width", *draw_auto_grow_width_));
if (draw_fit_to_size_) properties.push_back(_property(L"fit-to-size", *draw_fit_to_size_));
if (draw_fit_to_contour_) properties.push_back(_property(L"fit-to-contour", *draw_fit_to_contour_));
}
void graphic_format_properties::apply_from(const graphic_format_properties & Other)
{
......@@ -89,6 +98,10 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
_CP_APPLY_PROP2(draw_marker_end_);
_CP_APPLY_PROP2(draw_textarea_horizontal_align_);
_CP_APPLY_PROP2(draw_textarea_vertical_align_);
_CP_APPLY_PROP2(draw_auto_grow_height_);
_CP_APPLY_PROP2(draw_auto_grow_width_);
_CP_APPLY_PROP2(draw_fit_to_size_);
_CP_APPLY_PROP2(draw_fit_to_contour_);
_CP_APPLY_PROP2(svg_stroke_color_);
_CP_APPLY_PROP2(svg_stroke_width_);
......
......@@ -60,7 +60,14 @@ public:
_CP_OPT(odf_types::text_align) draw_textarea_horizontal_align_;
_CP_OPT(odf_types::vertical_align) draw_textarea_vertical_align_;
odf_types::common_draw_rel_size_attlist common_draw_rel_size_attlist_;
_CP_OPT(bool) draw_auto_grow_height_;
_CP_OPT(bool) draw_auto_grow_width_;
_CP_OPT(bool) draw_fit_to_size_;
_CP_OPT(bool) draw_fit_to_contour_;
_CP_OPT(std::wstring) draw_wrap_influence_on_position_;
odf_types::common_draw_rel_size_attlist common_draw_rel_size_attlist_;
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_;
odf_types::common_vertical_margin_attlist common_vertical_margin_attlist_;
......@@ -93,7 +100,6 @@ public:
_CP_OPT(std::wstring) fo_clip_;
_CP_OPT(std::wstring) draw_wrap_influence_on_position_;
office_element_ptr style_background_image_;
......
......@@ -273,25 +273,49 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
}
}
}
if (fo_margin_top_ || fo_margin_)
if (fo_margin_top_/* || fo_margin_*/)
{
std::wstring w_before = process_margin(fo_margin_top_, length::pt, 1000.0);
CP_XML_NODE(L"a:spcBef")
{
CP_XML_NODE(L"a:spcPct")
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
{
CP_XML_ATTR(L"val",w_before);
std::wstring w_before = process_margin(fo_margin_top_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
{
CP_XML_ATTR(L"val",w_before);
}
}
else
{
std::wstringstream s;
s << fo_margin_top_;
CP_XML_NODE(L"a:spcPct")
{
CP_XML_ATTR(L"val", s.str());
}
}
}
}
if (fo_margin_bottom_ || fo_margin_)
if (fo_margin_bottom_/* || fo_margin_*/)
{
std::wstring w_after = process_margin(fo_margin_bottom_, length::pt, 1000.0);
CP_XML_NODE(L"a:spcAft")
{
CP_XML_NODE(L"a:spcPct")
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
{
std::wstring w_after = process_margin(fo_margin_bottom_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
{
CP_XML_ATTR(L"val",w_after);
}
}
else
{
CP_XML_ATTR(L"val",w_after);
std::wstringstream s;
s << fo_margin_bottom_;
CP_XML_NODE(L"a:spcPct")
{
CP_XML_ATTR(L"val", s.str());
}
}
}
}
......
......@@ -267,7 +267,7 @@ void docx_serialize_level_justification(std::wostream & strm, style_list_level_p
}
void text_list_level_style_number::docx_convert(oox::docx_conversion_context & Context)
{
if (text_list_level_style_attr_.get_text_level() - 1 >= 9)
if (text_list_level_style_attr_.get_text_level() - 1 > 10)
return;
std::wostream & strm = Context.output_stream();
......@@ -389,7 +389,7 @@ void text_list_level_style_number::docx_convert(oox::docx_conversion_context & C
void text_list_level_style_number::pptx_convert(oox::pptx_conversion_context & Context)
{
if (text_list_level_style_attr_.get_text_level() - 1 >= 9)
if (text_list_level_style_attr_.get_text_level() - 1 > 10)
return;
std::wostream & strm = Context.get_text_context().get_styles_context().list_style();
......@@ -483,7 +483,7 @@ wchar_t convert_bullet_char(wchar_t c)
void text_list_level_style_bullet::docx_convert(oox::docx_conversion_context & Context)
{
if (text_list_level_style_attr_.get_text_level() - 1 >= 9)
if (text_list_level_style_attr_.get_text_level() - 1 > 10)
return;
std::wostream & strm = Context.output_stream();
......@@ -580,7 +580,7 @@ void text_list_level_style_bullet::docx_convert(oox::docx_conversion_context & C
void text_list_level_style_bullet::pptx_convert(oox::pptx_conversion_context & Context)
{
if (text_list_level_style_attr_.get_text_level() - 1 >= 9)
if (text_list_level_style_attr_.get_text_level() - 1 > 10)
return;
std::wostream & strm = Context.get_text_context().get_styles_context().list_style();
......
......@@ -2,6 +2,6 @@
//1
//0
//1
//211
#define INTVER 1,0,1,211
#define STRVER "1,0,1,211\0"
//212
#define INTVER 1,0,1,212
#define STRVER "1,0,1,212\0"
......@@ -110,7 +110,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)include&quot;;&quot;$(SolutionDir)include&quot;"
AdditionalIncludeDirectories="../include;../src/odf/datatypes"
PreprocessorDefinitions="_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
......@@ -243,7 +243,7 @@
<Tool
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories=""
AdditionalIncludeDirectories="../include;../src/odf/datatypes"
PreprocessorDefinitions="NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
......
......@@ -42,12 +42,12 @@ public:
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
_CP_OPT(odf_types::wrap_option) fo_wrap_option_;
_CP_OPT(odf_types::wrap_option) fo_wrap_option_;
_CP_OPT(odf_types::color) svg_stroke_color_;
_CP_OPT(odf_types::length_or_percent) svg_stroke_opacity_;
_CP_OPT(odf_types::line_style) draw_stroke_;
_CP_OPT(std::wstring) draw_stroke_dash_;
_CP_OPT(std::wstring) draw_stroke_dash_;
_CP_OPT(odf_types::length_or_percent) svg_stroke_width_;
_CP_OPT(odf_types::marker_style) draw_marker_end_;
......@@ -62,6 +62,10 @@ public:
_CP_OPT(odf_types::Bool) draw_auto_grow_height_;
_CP_OPT(odf_types::Bool) draw_auto_grow_width_;
_CP_OPT(odf_types::Bool) draw_fit_to_size_;
_CP_OPT(odf_types::Bool) draw_fit_to_contour_;
_CP_OPT(std::wstring) draw_wrap_influence_on_position_;
//odf_types::common_shadow_attlist common_shadow_attlist_;
_CP_OPT(odf_types::shadow_type1) draw_shadow_;
_CP_OPT(odf_types::percent) draw_shadow_opacity_;
......@@ -96,23 +100,20 @@ public:
_CP_OPT(odf_types::style_wrap) style_wrap_;
_CP_OPT(odf_types::Bool) style_print_content_;
_CP_OPT(std::wstring) style_protect_;
_CP_OPT(std::wstring) style_protect_;
_CP_OPT(odf_types::Bool) style_editable_;
_CP_OPT(unsigned int) style_wrap_dynamic_treshold_;
_CP_OPT(odf_types::integer_or_nolimit) style_number_wrapped_paragraphs_;
_CP_OPT(unsigned int) style_wrap_dynamic_treshold_;
_CP_OPT(odf_types::integer_or_nolimit) style_number_wrapped_paragraphs_;
_CP_OPT(odf_types::Bool) style_wrap_contour_;
_CP_OPT(odf_types::wrap_contour_mode) style_wrap_contour_mode_;
_CP_OPT(odf_types::run_through) style_run_through_;
_CP_OPT(odf_types::run_through) style_run_through_;
_CP_OPT(odf_types::Bool) style_flow_with_text_;
_CP_OPT(std::wstring) style_overflow_behavior_;
_CP_OPT(std::wstring) style_mirror_;
_CP_OPT(odf_types::Bool) draw_fit_to_size_;
_CP_OPT(std::wstring) draw_wrap_influence_on_position_;
_CP_OPT(std::wstring) style_overflow_behavior_;
_CP_OPT(std::wstring) style_mirror_;
_CP_OPT(std::wstring) fo_clip_;
_CP_OPT(std::wstring) fo_clip_;
////////////////////////////////////////////////////////////////////////
office_element_ptr style_background_image_;
office_element_ptr style_background_image_;
};
/// \class style_graphic_properties
......
......@@ -11,6 +11,7 @@
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
......@@ -153,11 +154,69 @@ HRESULT COfficeOdfFileW::SaveToFileImpl(const std::wstring & srcPath,
return S_OK;
}
//FileChecker !!
std::wstring COfficeOdfFileW::DetectTypeDocument(const std::wstring & Path)
std::wstring COfficeOdfFileW::DetectTypeDocument(const std::wstring & pathOOX)
{
//return L"text";
return L"spreadsheet";
std::wstring sRes;
CFile file;
CString fileContentType = std_string2string(pathOOX + FILE_SEPARATOR_STR + L"[Content_Types].xml");
if (file.OpenFile(fileContentType) != S_OK) return sRes;
int nBufferSize = min (file.GetFileSize(), 4096);
BYTE *pBuffer = new BYTE[nBufferSize];
file.ReadFile(pBuffer, nBufferSize);
file.CloseFile();
if (pBuffer != NULL)
{
const char *docxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
const char *dotxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
const char *docmFormatLine = "application/vnd.ms-word.document.macroEnabled.main+xml";
const char *dotmFormatLine = "application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
const char *xlsxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
const char *xltxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml";
const char *xlsmFormatLine = "application/vnd.ms-excel.sheet.macroEnabled.main+xml";
const char *xltmFormatLine = "application/vnd.ms-excel.template.macroEnabled.main+xml";
const char *pptxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
const char *ppsxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml";
const char *potxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml";
const char *pptmFormatLine = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml";
const char *ppsmFormatLine = "application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml";
const char *potmFormatLine = "application/vnd.ms-powerpoint.template.macroEnabled.main+xml";
std::string strContentTypes((char*)pBuffer, nBufferSize);
int res = 0;
if ( (res = strContentTypes.find(docxFormatLine))>0 || (res = strContentTypes.find(dotxFormatLine))>0 ||
(res = strContentTypes.find(docmFormatLine))>0 || (res = strContentTypes.find(dotmFormatLine))>0)
{
sRes = L"text";
}
else if ((res = strContentTypes.find(xlsxFormatLine))>0 || (res = strContentTypes.find(xltxFormatLine))>0 ||
(res = strContentTypes.find(xlsmFormatLine))>0 || (res = strContentTypes.find(xltmFormatLine))>0)
{
sRes = L"spreadsheet";
}
else if ((res = strContentTypes.find(pptxFormatLine) > 0) || /*(res = strContentTypes.find(ppsxFormatLine))>0 ||*/
(res = strContentTypes.find(potxFormatLine))>0 || (res = strContentTypes.find(pptmFormatLine))>0 ||
(res = strContentTypes.find(ppsmFormatLine))>0 || (res = strContentTypes.find(potmFormatLine))>0 ||
(res = strContentTypes.find(ppsxFormatLine)) >0 )
{
}
delete []pBuffer;
pBuffer = NULL;
}
return sRes;
}
void COfficeOdfFileW::OnProgressFunc (LPVOID lpParam, long nID, long nPercent)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment