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

(1.2.0.118): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57645 954022d7-b5bf-4e40-9824-e11837661b57
parent d2d91667
......@@ -1179,14 +1179,6 @@
RelativePath=".\OdfFormat\styles_list.h"
>
</File>
<File
RelativePath=".\OdfFormat\styles_lite_container.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\styles_lite_container.h"
>
</File>
<Filter
Name="contexts"
>
......
......@@ -197,6 +197,9 @@ public:
current_paragraph_properties = NULL;
width = height = x = y = 0;
is_footer_header_ = false; // Liber && OpenOffice.net
// MS Office - .
}
odf_drawing_state current_drawing_state_;
......@@ -207,6 +210,8 @@ public:
odf_style_context *styles_context_;
odf_conversion_context *odf_context_;
bool is_footer_header_;
void create_draw_base(int type);
office_element_ptr create_draw_element(int type);
......@@ -249,6 +254,11 @@ void odf_drawing_context::set_styles_context(odf_style_context* styles_context)
impl_->styles_context_ = styles_context;
}
void odf_drawing_context::set_footer_header_state(bool Val)
{
impl_->is_footer_header_ = Val;
}
void odf_drawing_context::start_group(std::wstring name, int id)
{
office_element_ptr & group_elm = impl_->create_draw_element(5000);
......@@ -732,27 +742,27 @@ void odf_drawing_context::end_element()
impl_->current_level_.pop_back();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void odf_drawing_context::start_area_properies()
void odf_drawing_context::start_area_properties()
{
impl_->current_drawing_part_ = Area;
}
void odf_drawing_context::end_area_properies()
void odf_drawing_context::end_area_properties()
{
impl_->current_drawing_part_ = Unknown;
}
void odf_drawing_context::start_line_properies()
void odf_drawing_context::start_line_properties()
{
impl_->current_drawing_part_ = Line;
}
void odf_drawing_context::end_line_properies()
void odf_drawing_context::end_line_properties()
{
impl_->current_drawing_part_ = Unknown;
}
//void odf_drawing_context::start_shadow_properies()
//void odf_drawing_context::start_shadow_properties()
//{
// impl_->current_drawing_part_ = Shadow;
//}
//void odf_drawing_context::end_shadow_properies()
//void odf_drawing_context::end_shadow_properties()
//{
// impl_->current_drawing_part_ = Unknown;
//}
......@@ -925,7 +935,10 @@ void odf_drawing_context::set_margin_bottom (double valPt)
}
void odf_drawing_context::set_anchor(int type)
{
if (impl_->is_footer_header_ && type == anchor_type::Page)
type = anchor_type::Paragraph;
impl_->anchor_settings_.anchor_type_ = anchor_type((anchor_type::type)type);
}
//////////////////////////////////////////////////////////////////////////////////////
void odf_drawing_context::set_vertical_rel(int from)
......@@ -939,11 +952,11 @@ void odf_drawing_context::set_vertical_rel(int from)
case 2: type = vertical_rel::Line; break;// relfromvLine
case 3: type = vertical_rel::PageContent; break;// relfromvMargin
case 4: type = vertical_rel::Baseline; break;// relfromvOutsideMargin ???
case 5: type = vertical_rel::Page;
impl_->anchor_settings_.anchor_type_ = anchor_type(anchor_type::Page);
case 5: type = vertical_rel::Page;
set_anchor(anchor_type::Page); //??? /???
break;// relfromvPage
case 6: type = vertical_rel::Paragraph;
impl_->anchor_settings_.anchor_type_ = anchor_type(anchor_type::Paragraph);
set_anchor(anchor_type::Paragraph);
break;// relfromvParagraph
case 7: type = vertical_rel::Baseline; break;// relfromvTopMargin ???
}
......@@ -1434,13 +1447,20 @@ void odf_drawing_context::start_text_box()
if (impl_->current_graphic_properties)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Foreground);
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = odf::background_color(odf::background_color::Transparent);
}
office_element_ptr text_box_elm;
create_element(L"draw", L"text-box", text_box_elm, impl_->odf_context_);
start_element(text_box_elm);
start_area_properties();
set_no_fill();
end_area_properties();
}
void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt)
{
......
......@@ -29,6 +29,8 @@ public:
void clear();
void set_styles_context(odf_style_context* styles_context);// embedded
void set_footer_header_state(bool Val);
void set_margin_left (double valPt);
void set_margin_right (double valPt);
void set_margin_top (double valPt);
......@@ -113,10 +115,10 @@ public:
void set_solid_fill(std::wstring hexColor);
void set_opacity(double percent);
//////////////////////////////////////////////////////////////
void start_area_properies();
void end_area_properies();
void start_area_properties();
void end_area_properties();
void start_line_properies();
void start_line_properties();
void set_line_width(double pt);
void set_line_dash_preset(int style);
......@@ -124,10 +126,10 @@ public:
void set_line_tail(int type, int len, int width);
std::wstring add_marker_style(int type);
void end_line_properies();
void end_line_properties();
//void start_shadow_properies();
//void end_shadow_properies();
//void start_shadow_properties();
//void end_shadow_properties();
// ..
void set_shadow(int type, std::wstring hexColor, _CP_OPT(double) opacity, double dist_pt, double dist_pt_y = -1);
......
......@@ -42,7 +42,9 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
current_field_.started = false;
current_field_.in_span = false;
is_hyperlink_ = false;
is_hyperlink_ = false;
is_footer_header_ = false;
drop_cap_state_.clear();
}
......@@ -181,6 +183,7 @@ void odt_conversion_context::start_drawings()
if (!new_drawing_context_)return;
new_drawing_context_->set_styles_context(styles_context());
new_drawing_context_->set_footer_header_state(is_footer_header_);
drawing_context_.push_back(new_drawing_context_);
}
......@@ -753,12 +756,16 @@ void odt_conversion_context::start_header(int type)
text_context()->set_styles_context(page_layout_context()->get_local_styles_context());
text_context()->start_element(page_layout_context()->last_master().get_last_element());
is_footer_header_ = true;
}
void odt_conversion_context::end_header_footer()
{
text_context()->end_element();
end_text_context();
is_footer_header_ = false;
}
void odt_conversion_context::set_background(_CP_OPT(color) & color, int type)
......@@ -775,6 +782,8 @@ void odt_conversion_context::start_footer(int type)
text_context()->set_styles_context(page_layout_context()->get_local_styles_context());
text_context()->start_element(page_layout_context()->last_master().get_last_element());
is_footer_header_ = true;
}
......
......@@ -112,7 +112,9 @@ private:
odf_text_context* main_text_context_;
odf_table_context table_context_;
odf_comment_context comment_context_;
odf_comment_context comment_context_;
bool is_footer_header_;
std::vector<odf_drawing_context_ptr> drawing_context_;
std::vector<odf_text_context_ptr> text_context_;//for embedded
......
......@@ -86,16 +86,19 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style)
width_pt = vml_style->m_arrProperties[i].get_Value().oValue.dValue;
break;
case SimpleTypes::Vml::cssptMarginBottom:
odf_context()->drawing_context()->set_margin_bottom(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
//odf_context()->drawing_context()->set_margin_bottom(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
x = vml_style->m_arrProperties[i].get_Value().oValue.dValue;
break;
case SimpleTypes::Vml::cssptMarginLeft:
odf_context()->drawing_context()->set_margin_left (vml_style->m_arrProperties[i].get_Value().oValue.dValue);
//odf_context()->drawing_context()->set_margin_left (vml_style->m_arrProperties[i].get_Value().oValue.dValue);
x = vml_style->m_arrProperties[i].get_Value().oValue.dValue;
break;
case SimpleTypes::Vml::cssptMarginRight:
odf_context()->drawing_context()->set_margin_right(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
//odf_context()->drawing_context()->set_margin_right(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
break;
case SimpleTypes::Vml::cssptMarginTop:
odf_context()->drawing_context()->set_margin_top(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
//odf_context()->drawing_context()->set_margin_top(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
y = vml_style->m_arrProperties[i].get_Value().oValue.dValue;
break;
////////////////////////////////////////////////////////////////
case SimpleTypes::Vml::cssptMsoPositionHorizontal:
......@@ -177,7 +180,7 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
if (pathImage.GetLength() < 1)return;
_gdi_graphics_::GetResolution(pathImage, Width, Height);
odf_context()->drawing_context()->start_area_properies();
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->start_bitmap_style();
odf_context()->drawing_context()->set_bitmap_link(string2std_string(pathImage));
......@@ -188,7 +191,7 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
odf_context()->drawing_context()->set_opacity(gain/1000.);
odf_context()->drawing_context()->end_bitmap_style();
odf_context()->drawing_context()->end_area_properies();
odf_context()->drawing_context()->end_area_properties();
}
void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
......@@ -206,9 +209,9 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
{
if (vml_fill == NULL) return;
odf_context()->drawing_context()->start_area_properies();
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->end_area_properies();
odf_context()->drawing_context()->end_area_properties();
}
void OoxConverter::convert(OOX::Vml::CLine *vml_line)
{
......@@ -300,7 +303,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oForceDash;
//SimpleTypes::CStrokeJoinStyle<SimpleTypes::strokejoinstyleRound> m_oJoinStyle;
odf_context()->drawing_context()->start_line_properies();
odf_context()->drawing_context()->start_line_properties();
//switch(vml_stroke->m_oFillType){}
......@@ -343,7 +346,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
default:
break;
}
odf_context()->drawing_context()->end_line_properies();
odf_context()->drawing_context()->end_line_properties();
}
void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
{
......
......@@ -291,7 +291,7 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
default:
break;
}
odf_context()->drawing_context()->start_area_properies();
odf_context()->drawing_context()->start_area_properties();
{
switch (oox_spPr->m_eFillType)
{
......@@ -310,9 +310,9 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
convert(&oox_sp_style->m_oFillRef);
}
}
odf_context()->drawing_context()->end_area_properies();
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->start_line_properies();
odf_context()->drawing_context()->start_line_properties();
{
if (oox_spPr->m_oLn.IsInit())
convert(oox_spPr->m_oLn.GetPointer()); //CLineProperties
......@@ -321,7 +321,7 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
convert(&oox_sp_style->m_oLnRef);
}
}
odf_context()->drawing_context()->end_line_properies();
odf_context()->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------------------------------
if (oox_spPr->m_oEffectList.IsInit())
convert(oox_spPr->m_oEffectList.GetPointer());
......
......@@ -41,6 +41,8 @@ DocxConverter::DocxConverter(const std::wstring & path, const ProgressCallback*
//set flags to default
m_bKeepNextParagraph = false;
last_setion_properties = NULL;
if (UpdateProgress(290000))return;
}
......@@ -316,6 +318,10 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
convert(oox_paragraph->m_oParagraphProperty, paragraph_properties);
}else m_bKeepNextParagraph = false; // m_bKeepNextParagraph !!! todooo
// - - !!!
// - ...
//
if (bStartNewParagraph) odt_context->start_paragraph(styled);
......@@ -505,6 +511,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
{
odt_context->text_context()->set_outline_level(*parent_paragraph_properties.content().outline_level_);
}
// ???
}
if (oox_paragraph_pr->m_oSpacing.IsInit())
......@@ -640,6 +647,58 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
convert(oox_paragraph_pr->m_oSectPr.GetPointer());
}
void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic::CSectionProperty *other)
{
if (props == NULL || other== NULL)return;
props->m_bSectPrChange = other->m_bSectPrChange;
// Attributes
if (other->m_oRsidDel.IsInit()) props->m_oRsidDel = other->m_oRsidDel;
if (other->m_oRsidR.IsInit()) props->m_oRsidR = other->m_oRsidR;
if (other->m_oRsidRPr.IsInit()) props->m_oRsidRPr = other->m_oRsidRPr;
if (other->m_oRsidSect.IsInit())props->m_oRsidSect = other->m_oRsidSect;
// Child Elements
if (other->m_oBidi.IsInit()) props->m_oBidi = other->m_oBidi;
if (other->m_oCols.IsInit()) props->m_oCols = other->m_oCols;
if (other->m_oDocGrid.IsInit()) props->m_oDocGrid = other->m_oDocGrid;
if (other->m_oEndnotePr.IsInit()) props->m_oEndnotePr = other->m_oEndnotePr;
if (other->m_oRsidSect.IsInit()) props->m_oRsidSect = other->m_oRsidSect;
if (other->m_oFootnotePr.IsInit()) props->m_oFootnotePr= other->m_oFootnotePr;
if (other->m_oFormProt.IsInit()) props->m_oFormProt = other->m_oFormProt;
if (other->m_oLnNumType.IsInit()) props->m_oLnNumType = other->m_oLnNumType;
if (other->m_oNoEndnote.IsInit()) props->m_oNoEndnote = other->m_oNoEndnote;
if (other->m_oPaperSrc.IsInit()) props->m_oPaperSrc = other->m_oPaperSrc;
if (other->m_oPgBorders.IsInit()) props->m_oPgBorders = other->m_oPgBorders;
if (other->m_oPgMar.IsInit()) props->m_oPgMar = other->m_oPgMar;
if (other->m_oPgNumType.IsInit()) props->m_oPgNumType = other->m_oPgNumType;
if (other->m_oPgSz.IsInit()) props->m_oPgSz = other->m_oPgSz;
if (other->m_oPrinterSettings.IsInit()) props->m_oPrinterSettings = other->m_oPrinterSettings;
if (other->m_oRtlGutter.IsInit()) props->m_oRtlGutter = other->m_oRtlGutter;
if (other->m_oSectPrChange.IsInit()) props->m_oSectPrChange = other->m_oSectPrChange;
if (other->m_oTextDirection.IsInit()) props->m_oTextDirection = other->m_oTextDirection;
if (other->m_oTitlePg.IsInit()) props->m_oTitlePg = other->m_oTitlePg;
if (other->m_oType.IsInit()) props->m_oType = other->m_oType;
if (other->m_oVAlign.IsInit()) props->m_oVAlign = other->m_oVAlign;
if (other->m_oTitlePg.IsInit()) props->m_oTitlePg = other->m_oTitlePg;
if (other->m_arrFooterReference.GetSize() > 0)
{
props->m_arrFooterReference.RemoveAll();
props->m_arrFooterReference = other->m_arrFooterReference;
}
if (other->m_arrHeaderReference.GetSize() > 0)
{
props->m_arrHeaderReference.RemoveAll();
props->m_arrHeaderReference = other->m_arrHeaderReference;
}
}
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root)
{
if (oox_section_pr == NULL) return;
......@@ -651,7 +710,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
switch(oox_section_pr->m_oType->m_oVal->GetValue())
{
case SimpleTypes::sectionmarkContinious :
continuous = true; //
continuous = true;
break;
case SimpleTypes::sectionmarkNextColumn :
case SimpleTypes::sectionmarkEvenPage :
......@@ -661,6 +720,20 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
break;
}
}
if (continuous && last_setion_properties)
{ // .
// +
// !! .. continues
apply_from(last_setion_properties,oox_section_pr);
}
else
{
last_setion_properties = oox_section_pr;
}
oox_section_pr = last_setion_properties;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
odt_context->page_layout_context()->create_master_page(root ? L"Standart" : L"");
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master().get_name());
......@@ -1764,9 +1837,9 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
{
OoxConverter::convert(oox_shape->m_oCNvConnSpPr.GetPointer());
// .. :)
odf_context()->drawing_context()->start_area_properies();
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->set_no_fill();
odf_context()->drawing_context()->end_area_properies();
odf_context()->drawing_context()->end_area_properties();
}
if (oox_shape->m_oTxBody.IsInit() && oox_shape->m_oTxBody->m_oTxtbxContent.IsInit())
......@@ -1969,7 +2042,9 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style)
/////////////////////////////////////////////////////////////////////////////////////////////////
// ?! OpenOffice / - oO !!!
odt_context->styles_context()->create_style(L"Frame", odf::style_family::Graphic,false,true);
odt_context->styles_context()->create_style(L"Frame", odf::style_family::Graphic,false,true);
odf::style_graphic_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties();
if (graphic_properties)graphic_properties->content().common_background_color_attlist_.fo_background_color_ = odf::background_color(odf::background_color::Transparent);
}
......@@ -2181,7 +2256,6 @@ void DocxConverter::convert_hdr_ftr (CString sId)
{
convert(oox_hdr_ftr->m_arrItems[nIndex]);
}
oox_current_child_document = NULL;
}
void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
......
......@@ -102,8 +102,10 @@ namespace Oox2Odf
cpdoccore::odf::package::odf_document *output_document;
odf::odt_conversion_context *odt_context;
OOX::Logic::CDrawing *docx_current_drawing; // .. ,
OOX::Logic::CSectionProperty *last_setion_properties; // ""
void apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic::CSectionProperty *other);
void convert_document();
void convert_styles();
void convert_settings();
......
......@@ -1691,9 +1691,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape)
OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
// .. :)
odf_context()->drawing_context()->start_area_properies();
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->set_no_fill();
odf_context()->drawing_context()->end_area_properies();
odf_context()->drawing_context()->end_area_properties();
if (oox_shape->m_oNvConnSpPr.IsInit())
{
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//117
#define INTVER 1,2,0,117
#define STRVER "1,2,0,117\0"
//118
#define INTVER 1,2,0,118
#define STRVER "1,2,0,118\0"
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