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

(1.2.0.147): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58071 954022d7-b5bf-4e40-9824-e11837661b57
parent 269b50e4
......@@ -10,6 +10,7 @@
#include "odf_conversion_context.h"
#include "odf_rels.h"
#include "style_paragraph_properties.h"
namespace cpdoccore {
namespace odf {
......@@ -197,14 +198,47 @@ void odf_conversion_context::process_styles(_object & object, bool isRoot)
}
office_element_ptr odf_conversion_context::start_tabs()
{
create_element(L"style", L"tab-stops", temporary_.elm, this,true);
return temporary_.elm;
}
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length)
{
if (!temporary_.elm) return;
office_element_ptr elm;
create_element(L"style", L"tab-stop", elm, this,true);
style_tab_stop* tab = dynamic_cast<style_tab_stop*>(elm.get());
if (tab)
{
if (_length)
tab->style_position_ = length(_length->get_value_unit(length::cm),length::cm);
if (type)
{
switch(*type)
{
case 0: tab->style_type_ = style_type::Left; break;//tabjcBar = 0,
case 1: tab->style_type_ = style_type::Center; break;//tabjcCenter = 1,
case 2: tab->style_type_ = style_type::Left; break;//tabjcClear = 2,
case 3: tab->style_type_ = style_type::Left; break;//tabjcDecimal = 3,
case 4: tab->style_type_ = style_type::Right; break;//tabjcEnd = 4,
case 5: tab->style_type_ = style_type::Left; break;//tabjcNum = 5,
case 6: tab->style_type_ = style_type::Left; break;//tabjcStart = 6,
case 7: tab->style_type_ = style_type::Right; break;//tabjcRight = 7,
case 8: tab->style_type_ = style_type::Left; break;//tabjcLeft = 8
}
}
temporary_.elm->add_child_element(elm);
}
}
void odf_conversion_context::end_tabs()
{
//temporary_.elm = NULL;
//temporary_.style_elm = NULL;
//temporary_.style_name = L"";
temporary_.elm = office_element_ptr();
temporary_.style_elm = office_element_ptr();
temporary_.style_name = L"";
}
}
......
......@@ -74,7 +74,7 @@ public:
office_element_ptr & get_current_object_element();
office_element_ptr start_tabs();
void add_tab(_CP_OPT(int) type, _CP_OPT(length) length);
void end_tabs();
private:
......
......@@ -28,15 +28,15 @@ void style_tab_stop::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR (L"style:position", style_position_);
CP_XML_ATTR_OPT(L"style:type", style_type_);
CP_XML_ATTR_OPT(L"style:char", style_char_);
CP_XML_ATTR_OPT(L"style:position", style_position_);
CP_XML_ATTR_OPT(L"style:type", style_type_);
CP_XML_ATTR_OPT(L"style:char", style_char_);
CP_XML_ATTR_OPT(L"style:leader-type", style_leader_style_);
CP_XML_ATTR_OPT(L"style:leader-style", style_leader_style_);
CP_XML_ATTR_OPT(L"style:leader-width", style_leader_width_);
CP_XML_ATTR_OPT(L"style:leader-color", style_leader_color_);
CP_XML_ATTR_OPT(L"style:leader-text", style_leader_text_);
CP_XML_ATTR_OPT(L"style:leader-type", style_leader_style_);
CP_XML_ATTR_OPT(L"style:leader-style", style_leader_style_);
CP_XML_ATTR_OPT(L"style:leader-width", style_leader_width_);
CP_XML_ATTR_OPT(L"style:leader-color", style_leader_color_);
CP_XML_ATTR_OPT(L"style:leader-text", style_leader_text_);
CP_XML_ATTR_OPT(L"style:leader-text-style", style_leader_text_style_);
}
}
......@@ -59,6 +59,10 @@ void style_tab_stops::serialize(std::wostream & strm)
}
}
}
void style_tab_stops::add_child_element( office_element_ptr & child_element)
{
style_tab_stops_.push_back(child_element);
}
// style:drop-cap
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_drop_cap::ns = L"style";
......@@ -123,7 +127,17 @@ void paragraph_format_properties::create_child_element(const ::std::wstring & Ns
// CP_NOT_APPLICABLE_ELM();
}
}
void paragraph_format_properties::add_child_element( office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeStyleTabStops)
style_tab_stops_ = child_element;
else if (type == typeStyleDropCap)
style_drop_cap_ = child_element;
else if (type == typeStyleBackgroundImage)
style_background_image_ = child_element;
}
void paragraph_format_properties::serialize(std::wostream & _Wostream ,const wchar_t * ns, const wchar_t * name )
{
......@@ -208,6 +222,10 @@ void style_paragraph_properties::create_child_element(const ::std::wstring & Ns,
{
style_paragraph_properties_content_.create_child_element(Ns, Name, getContext());
}
void style_paragraph_properties::add_child_element( office_element_ptr & child_element)
{
style_paragraph_properties_content_.add_child_element(child_element);
}
void style_paragraph_properties::serialize(std::wostream & strm)
{
style_paragraph_properties_content_.serialize(strm,ns,name);
......
......@@ -62,17 +62,17 @@ public:
virtual void serialize(std::wostream & strm);
length style_position_;
_CP_OPT(style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
_CP_OPT(length) style_position_;
_CP_OPT(style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
_CP_OPT(line_type) style_leader_type_;
_CP_OPT(line_style) style_leader_style_;
_CP_OPT(line_width) style_leader_width_;
_CP_OPT(line_type) style_leader_type_;
_CP_OPT(line_style) style_leader_style_;
_CP_OPT(line_width) style_leader_width_;
_CP_OPT(style_leader_color) style_leader_color_;
_CP_OPT( ::std::wstring ) style_leader_text_;
_CP_OPT( style_ref ) style_leader_text_style_;
_CP_OPT( ::std::wstring ) style_leader_text_;
_CP_OPT( style_ref ) style_leader_text_style_;
};
......@@ -92,7 +92,7 @@ public:
size_t size() const { return style_tab_stops_.size(); }
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name){}
virtual void add_child_element(office_element_ptr & child){}
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
......@@ -161,7 +161,7 @@ class paragraph_format_properties
{
public:
void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name,odf_conversion_context * Context);
void add_child_element(office_element_ptr & child){}
void add_child_element(office_element_ptr & child);
void serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name );
......@@ -343,7 +343,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child){}
virtual void add_child_element(office_element_ptr & child);
void apply_from(style_paragraph_properties * Other);
......
......@@ -542,7 +542,9 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
odf_context()->drawing_context()->start_line_properties();
{
if (vml_common->m_oStrokeWeight.IsInit() || (vml_common->m_oStroked.IsInit() && vml_common->m_oStroked->GetValue()))
if (vml_common->m_oStroked.IsInit() && vml_common->m_oStroked->GetValue() == SimpleTypes::booleanFalse)
odf_context()->drawing_context()->set_no_fill();
else if (vml_common->m_oStrokeWeight.IsInit() || (vml_common->m_oStroked.IsInit() && vml_common->m_oStroked->GetValue()))
{
if (vml_common->m_oStrokeWeight.IsInit())
odf_context()->drawing_context()->set_line_width(vml_common->m_oStrokeWeight->ToPoints());
......@@ -560,8 +562,7 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
delete oRgbColor;
}
}
}else if (vml_common->m_oStroked->GetValue() == SimpleTypes::booleanFalse)
odf_context()->drawing_context()->set_no_fill();
}
}
odf_context()->drawing_context()->end_line_properties();
odf_context()->drawing_context()->start_area_properties();
......
......@@ -332,7 +332,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
std::wstring list_style_name;
if(oox_paragraph->m_oParagraphProperty && oox_paragraph->m_oParagraphProperty->m_oNumPr.IsInit()
&& odt_context->text_context()->get_list_item_state() == false)
&& odt_context->text_context()->get_list_item_state() == false )
{
bListItemNeed = true;
}
......@@ -644,11 +644,14 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
if (oox_paragraph_pr->m_oInd->m_oFirstLine.IsInit())
{
_CP_OPT(odf::length_or_percent) length;
convert(static_cast<SimpleTypes::CUniversalMeasure *>(oox_paragraph_pr->m_oInd->m_oEnd.GetPointer()), length);
convert(static_cast<SimpleTypes::CUniversalMeasure *>(oox_paragraph_pr->m_oInd->m_oFirstLine.GetPointer()), length);
paragraph_properties->content().fo_text_indent_ = length;
}
if (oox_paragraph_pr->m_oInd->m_oHanging.IsInit())
{
{//first line ignored
_CP_OPT(odf::length) length;
convert(static_cast<SimpleTypes::CUniversalMeasure *>(oox_paragraph_pr->m_oInd->m_oHanging.GetPointer()), length);
if (length) paragraph_properties->content().fo_text_indent_ = odf::length(-length->get_value_unit(odf::length::cm), odf::length::cm);
}
//nullable<SimpleTypes::CDecimalNumber<> > m_oEndChars;
//nullable<SimpleTypes::CDecimalNumber<> > m_oFirstLineChars;
......@@ -734,9 +737,22 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
if (oox_paragraph_pr->m_oTabs.IsInit())
{
//paragraph_properties->add_child_element(odf_context()->start_tabs());
paragraph_properties->add_child_element(odf_context()->start_tabs());
for (unsigned int i = 0; i < oox_paragraph_pr->m_oTabs->m_arrTabs.size(); i++)
{
if (oox_paragraph_pr->m_oTabs->m_arrTabs[i] == NULL) continue;
_CP_OPT(int) type;
_CP_OPT(odf::length) length;
if (oox_paragraph_pr->m_oTabs->m_arrTabs[i]->m_oVal.IsInit())
type = oox_paragraph_pr->m_oTabs->m_arrTabs[i]->m_oVal->GetValue();
if (type == 2) continue; //clear tab
//paragraph_properties->odf_context()->end_tabs();
convert(oox_paragraph_pr->m_oTabs->m_arrTabs[i]->m_oPos.GetPointer(), length);
odf_context()->add_tab(type, length);
}
odf_context()->end_tabs();
}
}
......@@ -779,17 +795,44 @@ void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic::
if (other->m_oVAlign.IsInit()) props->m_oVAlign = other->m_oVAlign;
if (other->m_oTitlePg.IsInit()) props->m_oTitlePg = other->m_oTitlePg;
//todooo !!!!
if (other->m_arrFooterReference.size() > 0)
{
for (unsigned int i =0 ; i < props->m_arrFooterReference.size() ; i++)
{
if (props->m_arrFooterReference[i]) delete props->m_arrFooterReference[i];
props->m_arrFooterReference[i] = NULL;
}
props->m_arrFooterReference.clear();
props->m_arrFooterReference = other->m_arrFooterReference;
for (unsigned int i =0 ; i < other->m_arrFooterReference.size() ; i++)
{
ComplexTypes::Word::CHdrFtrRef* ref = new ComplexTypes::Word::CHdrFtrRef();
ref->m_oId= other->m_arrFooterReference[i]->m_oId;
ref->m_oType= other->m_arrFooterReference[i]->m_oType;
props->m_arrFooterReference.push_back(ref);
}
}
if (other->m_arrHeaderReference.size() > 0)
{
for (unsigned int i =0 ; i < props->m_arrHeaderReference.size() ; i++)
{
if (props->m_arrHeaderReference[i]) delete props->m_arrHeaderReference[i];
props->m_arrHeaderReference[i] = NULL;
}
props->m_arrHeaderReference.clear();
props->m_arrHeaderReference = other->m_arrHeaderReference;
for (unsigned int i =0 ; i < other->m_arrHeaderReference.size() ; i++)
{
ComplexTypes::Word::CHdrFtrRef* ref = new ComplexTypes::Word::CHdrFtrRef();
ref->m_oId= other->m_arrHeaderReference[i]->m_oId;
ref->m_oType= other->m_arrHeaderReference[i]->m_oType;
props->m_arrHeaderReference.push_back(ref);
}
}
}
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root)
......@@ -2578,6 +2621,15 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
if (oox_num_lvl->m_oPPr.IsInit())
{
if (oox_num_lvl->m_oPPr->m_oTabs.IsInit())
{
if ((oox_num_lvl->m_oPPr->m_oTabs->m_arrTabs.size() >0) && (oox_num_lvl->m_oPPr->m_oTabs->m_arrTabs[0]))
{
_CP_OPT(odf::length) length;
convert(oox_num_lvl->m_oPPr->m_oTabs->m_arrTabs[0]->m_oPos.GetPointer(), length);
if (length) aligment_props->text_list_tab_stop_position_ = odf::length(length->get_value_unit(odf::length::cm),odf::length::cm);
}
}
if (oox_num_lvl->m_oPPr->m_oInd.IsInit())
{
_CP_OPT(odf::length) length_indent;
......@@ -2589,29 +2641,21 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
_CP_OPT(odf::length) length_margin;
if (oox_num_lvl->m_oPPr->m_oInd->m_oStart.IsInit())
{
convert(oox_num_lvl->m_oPPr->m_oInd->m_oStart.GetPointer(), length_margin);
if (length_margin && length_indent) length_margin = *length_margin + *length_indent;
if (oox_num_lvl->m_oPPr->m_oInd->m_oStart.IsInit()) convert(oox_num_lvl->m_oPPr->m_oInd->m_oStart.GetPointer(), length_margin);
if (length_margin) aligment_props->fo_margin_left_ = odf::length(length_margin->get_value_unit(odf::length::cm),odf::length::cm);
}
if (oox_num_lvl->m_oPPr->m_oInd->m_oEnd.IsInit())
{
convert(oox_num_lvl->m_oPPr->m_oInd->m_oEnd.GetPointer(), length_margin);
if (length_margin && length_indent) length_margin = *length_margin + *length_indent;
if (length_margin) aligment_props->fo_margin_right_ = odf::length(length_margin->get_value_unit(odf::length::cm),odf::length::cm);
}
//level_props->text_space_before_ = odf::length(length_margin->get_value_unit(odf::length::cm),odf::length::cm);
//nullable<SimpleTypes::CDecimalNumber<> > m_oEndChars;
//nullable<SimpleTypes::CTwipsMeasure > m_oFirstLine;
//nullable<SimpleTypes::CDecimalNumber<> > m_oFirstLineChars;
//nullable<SimpleTypes::CDecimalNumber<> > m_oHangingChars;
//nullable<SimpleTypes::CDecimalNumber<> > m_oStartChars;
}
}else
{
aligment_props->fo_text_indent_ = odf::length(0,odf::length::cm);
aligment_props->fo_margin_left_ = odf::length(0,odf::length::cm);
//level_props->text_min_label_width_
}
}
if (oox_num_lvl->m_oRPr.IsInit())//
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//145
#define INTVER 1,2,0,145
#define STRVER "1,2,0,145\0"
//148
#define INTVER 1,2,0,148
#define STRVER "1,2,0,148\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