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

OdfFileReader - новые элементы формата, их конвертация

wordArt

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63073 954022d7-b5bf-4e40-9824-e11837661b57
parent 8a7c8660
...@@ -172,6 +172,49 @@ void docx_serialize_text(std::wostream & strm, const std::vector<odf_reader::_pr ...@@ -172,6 +172,49 @@ void docx_serialize_text(std::wostream & strm, const std::vector<odf_reader::_pr
CP_XML_STREAM() << test_string; CP_XML_STREAM() << test_string;
} }
} }
CP_XML_NODE(L"wps:bodyPr")
{
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(properties, L"wordArt", bWordArt);
_CP_OPT(int) iAlign;
odf_reader::GetProperty(properties, L"textalign-vertical", iAlign);
if (iAlign)
{
switch (iAlign.get())
{
case 0://Baseline,
CP_XML_ATTR(L"anchor", L"dist");break;
case 1://Top,
case 4://Auto,
CP_XML_ATTR(L"anchor", L"t");break;
case 2://Middle,
CP_XML_ATTR(L"anchor", L"ctr");break;
case 3://Bottom,
CP_XML_ATTR(L"anchor", L"b");break;
case 5://Justify
CP_XML_ATTR(L"anchor", L"just");break;
}
}
//else CP_XML_ATTR(L"anchor", L"dist");break;
if (bWordArt)
{
_CP_OPT(int) iVal;
odf_reader::GetProperty(properties, L"draw-type-index", iVal);
if (iVal)
{
std::wstring shapeType = _OO_OOX_wordart[*iVal].oox;
CP_XML_ATTR(L"fromWordArt", "1");
CP_XML_NODE(L"a:prstTxWarp")
{
CP_XML_ATTR(L"prst", shapeType);
}
}
}
}
} }
} }
} }
...@@ -336,10 +379,6 @@ void docx_serialize_shape(std::wostream & strm, _docx_drawing const & val) ...@@ -336,10 +379,6 @@ void docx_serialize_shape(std::wostream & strm, _docx_drawing const & val)
oox_serialize_ln(CP_XML_STREAM(),val.additional); oox_serialize_ln(CP_XML_STREAM(),val.additional);
} }
docx_serialize_text(CP_XML_STREAM(),val.additional); docx_serialize_text(CP_XML_STREAM(),val.additional);
CP_XML_NODE(L"wps:bodyPr")
{
}
} }
} }
} }
......
...@@ -119,8 +119,8 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -119,8 +119,8 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
} }
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop) void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
{ {
_CP_OPT(int) iShapeIndex; _CP_OPT(int) iShapeIndex;
odf_reader::GetProperty(prop,L"draw-type-index",iShapeIndex); odf_reader::GetProperty(prop,L"draw-type-index", iShapeIndex);
if (!iShapeIndex)return; if (!iShapeIndex)return;
...@@ -177,6 +177,9 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro ...@@ -177,6 +177,9 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
} }
void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_property> & prop) void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
{ {
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop,L"wordArt", bWordArt);
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"a:bodyPr") CP_XML_NODE(L"a:bodyPr")
...@@ -202,16 +205,33 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_p ...@@ -202,16 +205,33 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_p
} }
} }
//else CP_XML_ATTR(L"anchor", L"dist");break; //else CP_XML_ATTR(L"anchor", L"dist");break;
if (bWordArt)
{
_CP_OPT(int) iVal;
odf_reader::GetProperty(prop, L"draw-type-index",iVal);
if (iVal)
{
std::wstring shapeType = _OO_OOX_wordart[*iVal].oox;
CP_XML_NODE(L"a:prstTxWarp")
{
CP_XML_ATTR(L"prst", shapeType);
oox_serialize_aLst(CP_XML_STREAM(), prop);
}
}
}
} }
} }
} }
void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val) void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val)
{ {
_CP_OPT(std::wstring) strVal; _CP_OPT(std::wstring) strVal;
_CP_OPT(double) dVal; _CP_OPT(double) dVal;
std::wstring shapeType; std::wstring shapeType;
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(val.additional,L"wordArt", bWordArt);
if (val.sub_type == 7)//custom if (val.sub_type == 7)//custom
{ {
...@@ -224,7 +244,7 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val) ...@@ -224,7 +244,7 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val)
shapeType = _ooxShapeType[val.sub_type]; shapeType = _ooxShapeType[val.sub_type];
} }
if (shapeType.length()<1)shapeType = L"rect"; if (shapeType.length()<1 || bWordArt) shapeType = L"rect";
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
...@@ -265,7 +285,13 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val) ...@@ -265,7 +285,13 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val)
oox_serialize_aLst(CP_XML_STREAM(),val.additional); oox_serialize_aLst(CP_XML_STREAM(),val.additional);
} }
} }
oox_serialize_fill(strm,val.fill); if (bWordArt)
{
_oox_fill no_fill;
oox_serialize_fill(strm, no_fill);
}
else
oox_serialize_fill(strm, val.fill);
} }
} }
......
...@@ -195,10 +195,8 @@ struct pptx_border_edge ...@@ -195,10 +195,8 @@ struct pptx_border_edge
std::wstring prstDash; std::wstring prstDash;
}; };
void convert_border_style(const std::wstring& odfBorderStyle,pptx_border_edge & border) void convert_border_style(const odf_types::border_style& borderStyle, pptx_border_edge & border)
{ {
odf_types::border_style borderStyle(odfBorderStyle);
border.cmpd = L"sng"; border.cmpd = L"sng";
border.prstDash = L"solid"; border.prstDash = L"solid";
...@@ -239,19 +237,18 @@ void convert_border_style(const std::wstring& odfBorderStyle,pptx_border_edge & ...@@ -239,19 +237,18 @@ void convert_border_style(const std::wstring& odfBorderStyle,pptx_border_edge &
//thickThin (Thick Thin Double Lines) Double lines: one thick, one thin //thickThin (Thick Thin Double Lines) Double lines: one thick, one thin
//thinThick (Thin Thick Double Lines) Double lines: one thin, one thick //thinThick (Thin Thick Double Lines) Double lines: one thin, one thick
//tri (Thin Thick Thin Triple Lines) Three lines: thin, thick, thin //tri (Thin Thick Thin Triple Lines) Three lines: thin, thick, thin
void process_border(pptx_border_edge & borderEdge, const _CP_OPT(std::wstring) & odfBorderStyle) void process_border(pptx_border_edge & borderEdge, _CP_OPT(odf_types::border_style) & borderStyle)
{ {
borderEdge.present = false; borderEdge.present = false;
if (odfBorderStyle) if (borderStyle)
{ {
borderEdge.present = true; borderEdge.present = true;
odf_types::border_style borderStyle(*odfBorderStyle);
borderEdge.color = borderStyle.get_color().get_hex_value(); borderEdge.color = borderStyle->get_color().get_hex_value();
borderEdge.width = boost::lexical_cast<int>(borderStyle.get_length().get_value_unit(odf_types::length::emu)); borderEdge.width = boost::lexical_cast<int>(borderStyle->get_length().get_value_unit(odf_types::length::emu));
convert_border_style(*odfBorderStyle,borderEdge); convert_border_style(*borderStyle, borderEdge);
} }
} }
void oox_serialize_border(std::wostream & strm, std::wstring Node, pptx_border_edge & content) void oox_serialize_border(std::wostream & strm, std::wstring Node, pptx_border_edge & content)
...@@ -333,16 +330,14 @@ void oox_serialize_tcPr(std::wostream & strm, const odf_reader::style_instance* ...@@ -333,16 +330,14 @@ void oox_serialize_tcPr(std::wostream & strm, const odf_reader::style_instance*
//vert // //vert //
//style_cell_attlist.pptx_serialize(Context, CP_XML_STREAM()); //nodes //style_cell_attlist.pptx_serialize(Context, CP_XML_STREAM()); //nodes
odf_reader::paragraph_format_properties style_paragraph = odf_reader::calc_paragraph_properties_content(style_inst);//instances); odf_reader::paragraph_format_properties style_paragraph = odf_reader::calc_paragraph_properties_content(style_inst);//instances);
pptx_border_edge left,top,bottom,right; pptx_border_edge left, top, bottom, right;
process_border(left,style_paragraph.fo_border_left_); process_border(left, style_paragraph.fo_border_left_);
process_border(top,style_paragraph.fo_border_top_); process_border(top, style_paragraph.fo_border_top_);
process_border(right,style_paragraph.fo_border_right_); process_border(right, style_paragraph.fo_border_right_);
process_border(bottom,style_paragraph.fo_border_bottom_); process_border(bottom, style_paragraph.fo_border_bottom_);
oox_serialize_border(CP_XML_STREAM(), L"a:lnL",left); oox_serialize_border(CP_XML_STREAM(), L"a:lnL",left);
oox_serialize_border(CP_XML_STREAM(), L"a:lnR",right); oox_serialize_border(CP_XML_STREAM(), L"a:lnR",right);
......
...@@ -21,11 +21,11 @@ namespace oox { ...@@ -21,11 +21,11 @@ namespace oox {
namespace { namespace {
// TODO // TODO
std::wstring convert_border_style(const std::wstring& odfBorderStyle) std::wstring convert_border_style(const odf_types::border_style& borderStyle)
{ {
odf_types::border_style borderStyle(odfBorderStyle); std::wstring retVal = L"none";
std::wstring retVal = L"none";
if (borderStyle.initialized()) if (borderStyle.initialized())
{ {
if (borderStyle.get_style() == L"none" || borderStyle.get_style().empty()) if (borderStyle.get_style() == L"none" || borderStyle.get_style().empty())
retVal = L"none"; retVal = L"none";
...@@ -42,18 +42,16 @@ std::wstring convert_border_style(const std::wstring& odfBorderStyle) ...@@ -42,18 +42,16 @@ std::wstring convert_border_style(const std::wstring& odfBorderStyle)
return retVal; return retVal;
} }
void process_border(xlsx_border_edge & borderEdge, const _CP_OPT(std::wstring) & odfBorderStyle) void process_border(xlsx_border_edge & borderEdge, const _CP_OPT(border_style) & borderStyle)
{ {
if (odfBorderStyle) if (borderStyle)
{ {
odf_types::border_style borderStyle(*odfBorderStyle);
xlsx_color color; xlsx_color color;
color.rgb = borderStyle.get_color().get_hex_value(); color.rgb = borderStyle->get_color().get_hex_value();
borderEdge.color = color; borderEdge.color = color;
borderEdge.style = convert_border_style(*odfBorderStyle); borderEdge.style = convert_border_style(*borderStyle);
borderEdge.width = boost::lexical_cast<int>(borderStyle.get_length().get_value_unit(odf_types::length::emu)); borderEdge.width = boost::lexical_cast<int>(borderStyle->get_length().get_value_unit(odf_types::length::emu));
} }
} }
...@@ -62,7 +60,8 @@ bool check_border(const _CP_OPT(std::wstring) & odfBorderStyle) ...@@ -62,7 +60,8 @@ bool check_border(const _CP_OPT(std::wstring) & odfBorderStyle)
if (odfBorderStyle) if (odfBorderStyle)
{ {
odf_types::border_style borderStyle(*odfBorderStyle); odf_types::border_style borderStyle(*odfBorderStyle);
if (convert_border_style(*odfBorderStyle) != L"none")
if (convert_border_style(borderStyle) != L"none")
return true; return true;
} }
return false; return false;
...@@ -90,7 +89,7 @@ public: ...@@ -90,7 +89,7 @@ public:
return borders_.size(); return borders_.size();
} }
size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp) size_t borderId(odf_reader::style_table_cell_properties_attlist * cellProp)
{ {
bool is_default; bool is_default;
return borderId(cellProp, is_default); return borderId(cellProp, is_default);
...@@ -99,28 +98,31 @@ public: ...@@ -99,28 +98,31 @@ public:
size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default_val) size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default_val)
{ {
xlsx_border border; xlsx_border border;
border.left = xlsx_border_edge();
border.right = xlsx_border_edge(); border.left = xlsx_border_edge();
border.top = xlsx_border_edge(); border.right = xlsx_border_edge();
border.bottom = xlsx_border_edge(); border.top = xlsx_border_edge();
border.bottom = xlsx_border_edge();
if (cellProp) if (cellProp)
{ {
const common_border_attlist & odfBordersAttr = cellProp->common_border_attlist_; const common_border_attlist & odfBordersAttr = cellProp->common_border_attlist_;
process_border(*border.left, odfBordersAttr.fo_border_);
process_border(*border.left, odfBordersAttr.fo_border_);
process_border(*border.right, odfBordersAttr.fo_border_); process_border(*border.right, odfBordersAttr.fo_border_);
process_border(*border.top, odfBordersAttr.fo_border_); process_border(*border.top, odfBordersAttr.fo_border_);
process_border(*border.bottom, odfBordersAttr.fo_border_); process_border(*border.bottom, odfBordersAttr.fo_border_);
process_border(*border.left, odfBordersAttr.fo_border_left_); process_border(*border.left, odfBordersAttr.fo_border_left_);
process_border(*border.right, odfBordersAttr.fo_border_right_); process_border(*border.right, odfBordersAttr.fo_border_right_);
process_border(*border.top, odfBordersAttr.fo_border_top_); process_border(*border.top, odfBordersAttr.fo_border_top_);
process_border(*border.bottom, odfBordersAttr.fo_border_bottom_); process_border(*border.bottom, odfBordersAttr.fo_border_bottom_);
if (check_border(cellProp->style_diagonal_bl_tr_)) if (check_border(cellProp->style_diagonal_bl_tr_))
{ {
border.diagonal = xlsx_border_edge(); border.diagonal = xlsx_border_edge();
process_border(*border.diagonal, cellProp->style_diagonal_bl_tr_); _CP_OPT(border_style) borderStyle = *cellProp->style_diagonal_bl_tr_;
process_border(*border.diagonal, borderStyle);
border.diagonalUp = true; border.diagonalUp = true;
} }
...@@ -128,7 +130,8 @@ public: ...@@ -128,7 +130,8 @@ public:
{ {
if (!border.diagonal) if (!border.diagonal)
border.diagonal = xlsx_border_edge(); border.diagonal = xlsx_border_edge();
process_border(*border.diagonal, cellProp->style_diagonal_tl_br_); _CP_OPT(border_style) borderStyle = *cellProp->style_diagonal_tl_br_;
process_border(*border.diagonal, borderStyle);
border.diagonalDown = true; border.diagonalDown = true;
} }
} }
...@@ -199,7 +202,7 @@ size_t xlsx_borders::size() const ...@@ -199,7 +202,7 @@ size_t xlsx_borders::size() const
return impl_->size(); return impl_->size();
} }
size_t xlsx_borders::borderId(const odf_reader::style_table_cell_properties_attlist * cellProp) size_t xlsx_borders::borderId(odf_reader::style_table_cell_properties_attlist * cellProp)
{ {
return impl_->borderId(cellProp); return impl_->borderId(cellProp);
} }
......
...@@ -21,7 +21,7 @@ namespace oox { ...@@ -21,7 +21,7 @@ namespace oox {
~xlsx_borders(); ~xlsx_borders();
size_t size() const; size_t size() const;
size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp); size_t borderId(odf_reader::style_table_cell_properties_attlist * cellProp);
size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default); size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default);
void xlsx_serialize(std::wostream & _Wostream); void xlsx_serialize(std::wostream & _Wostream);
......
...@@ -122,8 +122,8 @@ size_t xlsx_style_manager::Impl::size() const ...@@ -122,8 +122,8 @@ size_t xlsx_style_manager::Impl::size() const
return cellXfs_.size(); return cellXfs_.size();
} }
size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content * textProp, size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp, const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp, const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat, const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible ) const std::wstring &num_format, bool default_set, bool & is_visible )
......
...@@ -4,9 +4,69 @@ ...@@ -4,9 +4,69 @@
namespace cpdoccore { namespace odf_types { namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const border_style & borderStyle)
{
std::wstring w_sz;
std::wstring w_color;
std::wstring w_val = L"single";
std::wstring w_space;
if (!borderStyle.initialized() || borderStyle.is_none())
{
w_val = L"none";
}
else if (borderStyle.initialized())
{
double width = borderStyle.get_length().get_value_unit(length::pt);
//borderLineWidths ? borderLineWidths->get_summ_unit(length::pt) : borderStyle.get_length().get_value_unit(length::pt);
int szInt = (int)(0.5 + 8.0 * width);
if (szInt <= 0)
szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt );
w_color = boost::lexical_cast<std::wstring>( borderStyle.get_color().get_hex_value() );
const std::wstring borderStyleStr = borderStyle.get_style();
if (szInt == 0)
w_val = L"none";
else if (borderStyleStr == L"solid"
|| borderStyleStr == L"single")
w_val = L"single";
else if (borderStyleStr == L"double")
w_val = L"double";
else if (borderStyleStr == L"dotted")
w_val = borderStyleStr;
else if (borderStyleStr == L"dashed")
w_val = borderStyleStr;
else if (borderStyleStr == L"groove")
w_val = L"thinThickMediumGap";
else if (borderStyleStr == L"ridge")
w_val = L"thickThinMediumGap";
else if (borderStyleStr == L"inset")
w_val = L"inset";
else if (borderStyleStr == L"outset")
w_val = L"outset";
else if (borderStyleStr == L"hidden")
w_val = L"nil";
}
std::wstring res;
if (!w_val.empty())
res += L" w:val=\"" + w_val + L"\" ";
if (!w_sz.empty())
res += L"w:sz=\"" + w_sz + L"\" ";
if (!w_color.empty())
res += L"w:color=\"" + w_color + L"\" ";
if (!w_space.empty())
res += L"w:space=\"" + w_space + L"\" ";
_Wostream << res;
return _Wostream;
}
border_style::border_style(const std::wstring & Value) : initialized_(false), none_(false) border_style::border_style(const std::wstring & Value) : initialized_(false), none_(false)
{ {
std::wstring tmp = boost::algorithm::trim_copy(Value); std::wstring tmp = boost::algorithm::trim_copy(Value);
boost::algorithm::to_lower(tmp); boost::algorithm::to_lower(tmp);
if (L"none" == tmp || tmp.length() < 1) if (L"none" == tmp || tmp.length() < 1)
...@@ -37,5 +97,10 @@ border_style::border_style(const std::wstring & Value) : initialized_(false), no ...@@ -37,5 +97,10 @@ border_style::border_style(const std::wstring & Value) : initialized_(false), no
initialized_ = true; initialized_ = true;
} }
border_style border_style::parse( const std::wstring & Value)
{
return border_style(Value);
}
} }
} }
...@@ -9,7 +9,9 @@ namespace cpdoccore { namespace odf_types { ...@@ -9,7 +9,9 @@ namespace cpdoccore { namespace odf_types {
class border_style class border_style
{ {
public: public:
border_style(const std::wstring & Value); border_style(){}
border_style(const std::wstring & Value);
static border_style parse(const std::wstring & Str);
public: public:
bool initialized() const { return initialized_; } bool initialized() const { return initialized_; }
...@@ -26,4 +28,10 @@ private: ...@@ -26,4 +28,10 @@ private:
color color_; color color_;
}; };
} } std::wostream & operator << (std::wostream & _Wostream, const border_style & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::border_style);
}
...@@ -321,11 +321,11 @@ void common_value_and_type_attlist::serialize(CP_ATTR_NODE) ...@@ -321,11 +321,11 @@ void common_value_and_type_attlist::serialize(CP_ATTR_NODE)
void common_border_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void common_border_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"fo:border", fo_border_); CP_APPLY_ATTR(L"fo:border", fo_border_);
CP_APPLY_ATTR(L"fo:border-top", fo_border_top_); CP_APPLY_ATTR(L"fo:border-top", fo_border_top_);
CP_APPLY_ATTR(L"fo:border-bottom", fo_border_bottom_); CP_APPLY_ATTR(L"fo:border-bottom", fo_border_bottom_);
CP_APPLY_ATTR(L"fo:border-left", fo_border_left_); CP_APPLY_ATTR(L"fo:border-left", fo_border_left_);
CP_APPLY_ATTR(L"fo:border-right", fo_border_right_); CP_APPLY_ATTR(L"fo:border-right", fo_border_right_);
} }
void common_border_attlist::apply_from(const common_border_attlist & Other) void common_border_attlist::apply_from(const common_border_attlist & Other)
{ {
...@@ -334,29 +334,29 @@ void common_border_attlist::apply_from(const common_border_attlist & Other) ...@@ -334,29 +334,29 @@ void common_border_attlist::apply_from(const common_border_attlist & Other)
fo_border_top_ = fo_border_bottom_ = fo_border_left_ = fo_border_right_ = fo_border_; fo_border_top_ = fo_border_bottom_ = fo_border_left_ = fo_border_right_ = fo_border_;
fo_border_ = Other.fo_border_; fo_border_ = Other.fo_border_;
} }
_CP_APPLY_PROP(fo_border_, Other.fo_border_); _CP_APPLY_PROP(fo_border_, Other.fo_border_);
_CP_APPLY_PROP(fo_border_top_, Other.fo_border_top_); _CP_APPLY_PROP(fo_border_top_, Other.fo_border_top_);
_CP_APPLY_PROP(fo_border_bottom_, Other.fo_border_bottom_); _CP_APPLY_PROP(fo_border_bottom_, Other.fo_border_bottom_);
_CP_APPLY_PROP(fo_border_left_, Other.fo_border_left_); _CP_APPLY_PROP(fo_border_left_, Other.fo_border_left_);
_CP_APPLY_PROP(fo_border_right_, Other.fo_border_right_); _CP_APPLY_PROP(fo_border_right_, Other.fo_border_right_);
} }
void common_border_attlist::serialize(CP_ATTR_NODE) void common_border_attlist::serialize(CP_ATTR_NODE)
{ {
CP_XML_ATTR_OPT(L"fo:border", fo_border_); CP_XML_ATTR_OPT(L"fo:border", fo_border_);
CP_XML_ATTR_OPT(L"fo:border-top", fo_border_top_); CP_XML_ATTR_OPT(L"fo:border-top", fo_border_top_);
CP_XML_ATTR_OPT(L"fo:border-bottom", fo_border_bottom_); CP_XML_ATTR_OPT(L"fo:border-bottom", fo_border_bottom_);
CP_XML_ATTR_OPT(L"fo:border-left", fo_border_left_); CP_XML_ATTR_OPT(L"fo:border-left", fo_border_left_);
CP_XML_ATTR_OPT(L"fo:border-right", fo_border_right_); CP_XML_ATTR_OPT(L"fo:border-right", fo_border_right_);
} }
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
void common_border_line_width_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void common_border_line_width_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"style:border-line-width", style_border_line_width_); CP_APPLY_ATTR(L"style:border-line-width", style_border_line_width_);
CP_APPLY_ATTR(L"style:border-line-width-top", style_border_line_width_top_); CP_APPLY_ATTR(L"style:border-line-width-top", style_border_line_width_top_);
CP_APPLY_ATTR(L"style:border-line-width-bottom", style_border_line_width_bottom_); CP_APPLY_ATTR(L"style:border-line-width-bottom", style_border_line_width_bottom_);
CP_APPLY_ATTR(L"style:border-line-width-left", style_border_line_width_left_); CP_APPLY_ATTR(L"style:border-line-width-left", style_border_line_width_left_);
CP_APPLY_ATTR(L"style:border-line-width-right", style_border_line_width_right_); CP_APPLY_ATTR(L"style:border-line-width-right", style_border_line_width_right_);
} }
...@@ -370,11 +370,11 @@ void common_border_line_width_attlist::apply_from(const common_border_line_width ...@@ -370,11 +370,11 @@ void common_border_line_width_attlist::apply_from(const common_border_line_width
} }
void common_border_line_width_attlist::serialize(CP_ATTR_NODE) void common_border_line_width_attlist::serialize(CP_ATTR_NODE)
{ {
CP_XML_ATTR_OPT(L"style:border-line-width", style_border_line_width_); CP_XML_ATTR_OPT(L"style:border-line-width", style_border_line_width_);
CP_XML_ATTR_OPT(L"style:border-line-width-top", style_border_line_width_top_); CP_XML_ATTR_OPT(L"style:border-line-width-top", style_border_line_width_top_);
CP_XML_ATTR_OPT(L"style:border-line-width-bottom", style_border_line_width_bottom_); CP_XML_ATTR_OPT(L"style:border-line-width-bottom", style_border_line_width_bottom_);
CP_XML_ATTR_OPT(L"style:border-line-width-left", style_border_line_width_left_); CP_XML_ATTR_OPT(L"style:border-line-width-left", style_border_line_width_left_);
CP_XML_ATTR_OPT(L"style:border-line-width-right", style_border_line_width_right_); CP_XML_ATTR_OPT(L"style:border-line-width-right", style_border_line_width_right_);
} }
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "stylerepeat.h" #include "stylerepeat.h"
#include "officevaluetype.h" #include "officevaluetype.h"
#include "fillimagerefpoint.h" #include "fillimagerefpoint.h"
#include "borderstyle.h"
#define _CP_APPLY_PROP(A, B) \ #define _CP_APPLY_PROP(A, B) \
if (B) \ if (B) \
...@@ -165,7 +166,7 @@ public: ...@@ -165,7 +166,7 @@ public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
public: public:
_CP_OPT(std::wstring) style_shadow_; _CP_OPT(shadow_type) style_shadow_;
}; };
...@@ -238,20 +239,11 @@ public: ...@@ -238,20 +239,11 @@ public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
public: public:
// fo:border _CP_OPT(border_style) fo_border_;
_CP_OPT(std::wstring) fo_border_; _CP_OPT(border_style) fo_border_top_;
_CP_OPT(border_style) fo_border_bottom_;
// fo:border-top _CP_OPT(border_style) fo_border_left_;
_CP_OPT(std::wstring) fo_border_top_; _CP_OPT(border_style) fo_border_right_;
// fo:border-bottom
_CP_OPT(std::wstring) fo_border_bottom_;
// fo:border-left
_CP_OPT(std::wstring) fo_border_left_;
// fo:border-right
_CP_OPT(std::wstring) fo_border_right_;
}; };
......
#pragma once #pragma once
static const int _OO_OOX_custom_shapes_count = 205;
struct _shape_converter struct _shape_converter
{ {
std::wstring odf_reader; std::wstring odf_reader;
...@@ -13,111 +11,101 @@ struct _shape_converter ...@@ -13,111 +11,101 @@ struct _shape_converter
static const _shape_converter _OO_OOX_custom_shapes[]= static const _shape_converter _OO_OOX_custom_shapes[]=
{ {
{L"rectangle" ,L"rect" ,0 ,0 ,0 }, {L"rectangle" ,L"rect" ,0 ,0 ,0 },
{L"diamond" ,L"diamond" ,0 ,0 ,0 }, {L"diamond" ,L"diamond" ,0 ,0 ,0 },
{L"parallelogram" ,L"parallelogram" ,0 ,0 ,0 }, {L"parallelogram" ,L"parallelogram" ,0 ,0 ,0 },
{L"isosceles-triangle" ,L"triangle" ,0 ,0 ,0 }, {L"isosceles-triangle" ,L"triangle" ,0 ,0 ,0 },
{L"trapezoid" ,L"trapezoid" ,0 ,0 ,0 }, {L"trapezoid" ,L"trapezoid" ,0 ,0 ,0 },
{L"pentagon" ,L"pentagon" ,0 ,0 ,0 }, {L"pentagon" ,L"pentagon" ,0 ,0 ,0 },
{L"hexagon" ,L"hexagon" ,0 ,0 ,0 }, {L"hexagon" ,L"hexagon" ,0 ,0 ,0 },
{L"octagon" ,L"octagon" ,0 ,0 ,0 }, {L"octagon" ,L"octagon" ,0 ,0 ,0 },
{L"star4" ,L"star4" ,1 ,0 ,50000 }, {L"star4" ,L"star4" ,1 ,0 ,50000 },
{L"star5" ,L"star5" ,1 ,0 ,50000 }, {L"star5" ,L"star5" ,1 ,0 ,50000 },
{L"star8" ,L"star8" ,1 ,0 ,50000 }, {L"star8" ,L"star8" ,1 ,0 ,50000 },
{L"star24" ,L"star24" ,1 ,0 ,50000 }, {L"star24" ,L"star24" ,1 ,0 ,50000 },
{L"star6" ,L"star6" ,1 ,0 ,50000 }, {L"star6" ,L"star6" ,1 ,0 ,50000 },
{L"star12" ,L"star12" ,1 ,0 ,50000 }, {L"star12" ,L"star12" ,1 ,0 ,50000 },
{L"round-rectangle" ,L"roundRect" ,0 ,0 ,0 }, {L"round-rectangle" ,L"roundRect" ,0 ,0 ,0 },
{L"ellipse" ,L"ellipse" ,0 ,0 ,0 }, {L"ellipse" ,L"ellipse" ,0 ,0 ,0 },
{L"chevron" ,L"chevron" ,0 ,0 ,0 }, {L"chevron" ,L"chevron" ,0 ,0 ,0 },
{L"block-arc" ,L"blockArc" ,0 ,0 ,0 }, {L"block-arc" ,L"blockArc" ,0 ,0 ,0 },
{L"ring" ,L"donut" ,0 ,0 ,0 }, {L"ring" ,L"donut" ,0 ,0 ,0 },
{L"right-arrow" ,L"rightArrow" ,0 ,0 ,0 }, {L"right-arrow" ,L"rightArrow" ,0 ,0 ,0 },
{L"left-arrow" ,L"leftArrow" ,0 ,0 ,0 }, {L"left-arrow" ,L"leftArrow" ,0 ,0 ,0 },
{L"up-arrow" ,L"upArrow" ,0 ,0 ,0 }, {L"up-arrow" ,L"upArrow" ,0 ,0 ,0 },
{L"down-arrow" ,L"downArrow" ,0 ,0 ,0 }, {L"down-arrow" ,L"downArrow" ,0 ,0 ,0 },
{L"striped-right-arrow" ,L"stripedRightArrow" ,0 ,0 ,0 }, {L"striped-right-arrow" ,L"stripedRightArrow" ,0 ,0 ,0 },
{L"notched-right-arrow" ,L"notchedRightArrow" ,0 ,0 ,0 }, {L"notched-right-arrow" ,L"notchedRightArrow" ,0 ,0 ,0 },
{L"left-right-arrow" ,L"leftRightArrow" ,0 ,0 ,0 }, {L"left-right-arrow" ,L"leftRightArrow" ,0 ,0 ,0 },
{L"up-down-arrow" ,L"upDownArrow" ,0 ,0 ,0 }, {L"up-down-arrow" ,L"upDownArrow" ,0 ,0 ,0 },
{L"quad-arrow" ,L"quadArrow" ,0 ,0 ,0 }, {L"quad-arrow" ,L"quadArrow" ,0 ,0 ,0 },
{L"left-arrow-callout" ,L"leftArrowCallout" ,0 ,0 ,0 }, {L"left-arrow-callout" ,L"leftArrowCallout" ,0 ,0 ,0 },
{L"right-arrow-callout" ,L"rightArrowCallout" ,0 ,0 ,0 }, {L"right-arrow-callout" ,L"rightArrowCallout" ,0 ,0 ,0 },
{L"up-arrow-callout" ,L"upArrowCallout" ,0 ,0 ,0 }, {L"up-arrow-callout" ,L"upArrowCallout" ,0 ,0 ,0 },
{L"down-arrow-callout" ,L"downArrowCallout" ,0 ,0 ,0 }, {L"down-arrow-callout" ,L"downArrowCallout" ,0 ,0 ,0 },
{L"left-right-arrow-callout" ,L"leftRightArrowCallout" ,0 ,0 ,0 }, {L"left-right-arrow-callout" ,L"leftRightArrowCallout" ,0 ,0 ,0 },
{L"up-down-arrow-callout" ,L"upDownArrowCallout" ,0 ,0 ,0 }, {L"up-down-arrow-callout" ,L"upDownArrowCallout" ,0 ,0 ,0 },
{L"quad-arrow-callout" ,L"quadArrowCallout" ,0 ,0 ,0 }, {L"quad-arrow-callout" ,L"quadArrowCallout" ,0 ,0 ,0 },
{L"circular-arrow" ,L"circularArrow" ,0 ,0 ,0 }, {L"circular-arrow" ,L"circularArrow" ,0 ,0 ,0 },
{L"can" ,L"lightningBolt" ,0 ,0 ,0 }, {L"can" ,L"lightningBolt" ,0 ,0 ,0 },
{L"lightning" ,L"can" ,0 ,0 ,0 }, {L"lightning" ,L"can" ,0 ,0 ,0 },
{L"heart" ,L"heart" ,0 ,0 ,0 }, {L"heart" ,L"heart" ,0 ,0 ,0 },
{L"sun" ,L"sun" ,1 ,46875 ,12500 }, {L"sun" ,L"sun" ,1 ,46875 ,12500 },
{L"moon" ,L"moon" ,0 ,0 ,0 }, {L"moon" ,L"moon" ,0 ,0 ,0 },
{L"smiley" ,L"smileyFace" ,1 ,-4652 ,4652 }, {L"smiley" ,L"smileyFace" ,1 ,-4652 ,4652 },
{L"bracket-pair" ,L"bracketPair" ,0 ,0 ,0 }, {L"bracket-pair" ,L"bracketPair" ,0 ,0 ,0 },
{L"brace-pair" ,L"bracePair" ,0 ,0 ,0 }, {L"brace-pair" ,L"bracePair" ,0 ,0 ,0 },
{L"line-callout-1" ,L"callout1" ,4 ,0 ,0 }, {L"line-callout-1" ,L"callout1" ,4 ,0 ,0 },
{L"line-callout-2" ,L"callout2" ,6 ,0 ,0 }, {L"line-callout-2" ,L"callout2" ,6 ,0 ,0 },
{L"line-callout-3" ,L"callout3" ,8 ,0 ,0 }, {L"line-callout-3" ,L"callout3" ,8 ,0 ,0 },
{L"rectangular-callout" ,L"wedgeRectCallout" ,2 ,0 ,842870 }, {L"rectangular-callout" ,L"wedgeRectCallout" ,2 ,0 ,842870 },
{L"round-rectangular-callout" ,L"wedgeRoundRectCallout" ,0 ,0 ,842870 }, {L"round-rectangular-callout" ,L"wedgeRoundRectCallout" ,0 ,0 ,842870 },
{L"round-callout" ,L"wedgeEllipseCallout" ,2 ,0 ,842870 }, {L"round-callout" ,L"wedgeEllipseCallout" ,0 ,0 ,842870 },//2
{L"cloud-callout" ,L"cloudCallout" ,2 ,0 ,842870 }, {L"cloud-callout" ,L"cloudCallout" ,0 ,0 ,842870 },//2
{L"vertical-scroll" ,L"verticalScroll" ,1 ,0 ,25000 }, {L"vertical-scroll" ,L"verticalScroll" ,1 ,0 ,25000 },
{L"horizontal-scroll" ,L"horizontalScroll" ,1 ,0 ,25000 }, {L"horizontal-scroll" ,L"horizontalScroll" ,1 ,0 ,25000 },
{L"flowchart-process" ,L"flowChartProcess" ,0 ,0 ,0 }, {L"flowchart-process" ,L"flowChartProcess" ,0 ,0 ,0 },
{L"flowchart-decision" ,L"flowChartDecision" ,0 ,0 ,0 }, {L"flowchart-decision" ,L"flowChartDecision" ,0 ,0 ,0 },
{L"flowchart-data" ,L"flowChartInputOutput" ,0 ,0 ,0 }, {L"flowchart-data" ,L"flowChartInputOutput" ,0 ,0 ,0 },
{L"flowchart-predefined-process" ,L"flowChartPredefinedProcess" ,0 ,0 ,0 }, {L"flowchart-predefined-process" ,L"flowChartPredefinedProcess" ,0 ,0 ,0 },
{L"flowchart-internal-storage" ,L"flowChartInternalStorage" ,0 ,0 ,0 }, {L"flowchart-internal-storage" ,L"flowChartInternalStorage" ,0 ,0 ,0 },
{L"flowchart-document" ,L"flowChartDocument" ,0 ,0 ,0 }, {L"flowchart-document" ,L"flowChartDocument" ,0 ,0 ,0 },
{L"flowchart-multidocument" ,L"flowChartMultidocument" ,0 ,0 ,0 }, {L"flowchart-multidocument" ,L"flowChartMultidocument" ,0 ,0 ,0 },
{L"flowchart-terminator" ,L"flowChartTerminator" ,0 ,0 ,0 }, {L"flowchart-terminator" ,L"flowChartTerminator" ,0 ,0 ,0 },
{L"flowchart-preparation" ,L"flowChartPreparation" ,0 ,0 ,0 }, {L"flowchart-preparation" ,L"flowChartPreparation" ,0 ,0 ,0 },
{L"flowchart-manual-input" ,L"flowChartManualInput" ,0 ,0 ,0 }, {L"flowchart-manual-input" ,L"flowChartManualInput" ,0 ,0 ,0 },
{L"flowchart-manual-operation" ,L"flowChartManualOperation" ,0 ,0 ,0 }, {L"flowchart-manual-operation" ,L"flowChartManualOperation" ,0 ,0 ,0 },
{L"flowchart-connector" ,L"flowChartConnector" ,0 ,0 ,0 }, {L"flowchart-connector" ,L"flowChartConnector" ,0 ,0 ,0 },
{L"flowchart-card" ,L"flowChartPunchedCard" ,0 ,0 ,0 }, {L"flowchart-card" ,L"flowChartPunchedCard" ,0 ,0 ,0 },
{L"flowchart-punched-tape" ,L"flowChartPunchedTape" ,0 ,0 ,0 }, {L"flowchart-punched-tape" ,L"flowChartPunchedTape" ,0 ,0 ,0 },
{L"flowchart-summing-junction" ,L"flowChartSummingJunction" ,0 ,0 ,0 }, {L"flowchart-summing-junction" ,L"flowChartSummingJunction" ,0 ,0 ,0 },
{L"flowchart-or" ,L"flowChartOr" ,0 ,0 ,0 }, {L"flowchart-or" ,L"flowChartOr" ,0 ,0 ,0 },
{L"flowchart-collate" ,L"flowChartCollate" ,0 ,0 ,0 }, {L"flowchart-collate" ,L"flowChartCollate" ,0 ,0 ,0 },
{L"flowchart-sort" ,L"flowChartSort" ,0 ,0 ,0 }, {L"flowchart-sort" ,L"flowChartSort" ,0 ,0 ,0 },
{L"flowchart-extract" ,L"flowChartExtract" ,0 ,0 ,0 }, {L"flowchart-extract" ,L"flowChartExtract" ,0 ,0 ,0 },
{L"flowchart-merge" ,L"flowChartMerge" ,0 ,0 ,0 }, {L"flowchart-merge" ,L"flowChartMerge" ,0 ,0 ,0 },
{L"flowchart-stored-data" ,L"flowChartOnlineStorage" ,0 ,0 ,0 }, {L"flowchart-stored-data" ,L"flowChartOnlineStorage" ,0 ,0 ,0 },
{L"flowchart-sequential-access" ,L"flowChartMagneticTape" ,0 ,0 ,0 }, {L"flowchart-sequential-access" ,L"flowChartMagneticTape" ,0 ,0 ,0 },
{L"flowchart-magnetic-disk" ,L"flowChartMagneticDisk" ,0 ,0 ,0 }, {L"flowchart-magnetic-disk" ,L"flowChartMagneticDisk" ,0 ,0 ,0 },
{L"flowchart-direct-access-storage" ,L"flowChartMagneticDrum" ,0 ,0 ,0 }, {L"flowchart-direct-access-storage" ,L"flowChartMagneticDrum" ,0 ,0 ,0 },
{L"flowchart-display" ,L"flowChartDisplay" ,0 ,0 ,0 }, {L"flowchart-display" ,L"flowChartDisplay" ,0 ,0 ,0 },
{L"flowchart-delay" ,L"flowChartDelay" ,0 ,0 ,0 }, {L"flowchart-delay" ,L"flowChartDelay" ,0 ,0 ,0 },
{L"flowchart-alternate-process" ,L"flowChartAlternateProcess" ,0 ,0 ,0 }, {L"flowchart-alternate-process" ,L"flowChartAlternateProcess" ,0 ,0 ,0 },
{L"flowchart-off-page-connector" ,L"flowChartOffpageConnector" ,0 ,0 ,0 }, {L"flowchart-off-page-connector" ,L"flowChartOffpageConnector" ,0 ,0 ,0 },
{L"fontwork-arch-up-pour" ,L"rect" ,0 ,0 ,0 },//L"textArchUpPour" {L"left-brace" ,L"leftBrace" ,0 ,0 ,0 },
{L"fontwork-arch-down-pour" ,L"rect" ,0 ,0 ,0 },//L"textArchDownPour" {L"right-brace" ,L"rightBrace" ,0 ,0 ,0 },
{L"fontwork-circle-pour" ,L"rect" ,0 ,0 ,0 },//L"textCirclePour" {L"left-bracket" ,L"leftBracket" ,0 ,0 ,0 },
{L"fontwork-curve-up" ,L"rect" ,0 ,0 ,0 },//L"textCurveUp"
{L"fontwork-curve-down" ,L"rect" ,0 ,0 ,0 },//L"textCurveDown"
{L"fontwork-wave" ,L"rect" ,0 ,0 ,0 },//L"textWave1"
{L"fontwork-fade-right" ,L"rect" ,0 ,0 ,0 },//L"textFadeRight"
{L"fontwork-fade-left" ,L"rect" ,0 ,0 ,0 },//L"textFadeLeft"
{L"fontwork-fade-up" ,L"rect" ,0 ,0 ,0 },//L"textFadeUp"
{L"fontwork-fade-down" ,L"rect" ,0 ,0 ,0 },//L"textFadeDown"
{L"left-brace" ,L"leftBrace" ,0 ,0 ,0 },
{L"right-brace" ,L"rightBrace" ,0 ,0 ,0 },
{L"left-bracket" ,L"leftBracket" ,0 ,0 ,0 },
{L"right-bracket" ,L"rightBracket" ,0 ,0 ,0 }, {L"right-bracket" ,L"rightBracket" ,0 ,0 ,0 },
{L"forbidden" ,L"noSmoking" ,0 ,0 ,0 }, {L"forbidden" ,L"noSmoking" ,0 ,0 ,0 },
{L"paper" ,L"foldedCorner" ,0 ,0 ,0 }, {L"paper" ,L"foldedCorner" ,0 ,0 ,0 },
{L"pentagon-right" ,L"homePlate" ,0 ,0 ,0 }, {L"pentagon-right" ,L"homePlate" ,0 ,0 ,0 },
{L"cube" ,L"cube" ,0 ,0 ,0 }, {L"cube" ,L"cube" ,0 ,0 ,0 },
{L"cross" ,L"" ,0 ,0 ,0 }, {L"cross" ,L"plus" ,0 ,0 ,0 },
{L"bang" ,L"" ,0 ,0 ,0 }, {L"bang" ,L"irregularSeal2" ,0 ,0 ,0 },
{L"mso-spt14" ,L"thickArrow" ,0 ,0 ,0 }, {L"mso-spt14" ,L"thickArrow" ,0 ,0 ,0 },
{L"mso-spt17" ,L"Balloon" ,0 ,0 ,0 }, {L"mso-spt17" ,L"Balloon" ,0 ,0 ,0 },
{L"mso-spt18" ,L"irregularSeal1" ,0 ,0 ,0 }, {L"mso-spt18" ,L"irregularSeal1" ,0 ,0 ,0 },
{L"mso-spt24" ,L"textBox" ,0 ,0 ,0 }, {L"mso-spt24" ,L"textBox" ,0 ,0 ,0 },
{L"mso-spt25" ,L"" ,0 ,0 ,0 }, {L"mso-spt25" ,L"" ,0 ,0 ,0 },
{L"mso-spt26" ,L"" ,0 ,0 ,0 }, {L"mso-spt26" ,L"" ,0 ,0 ,0 },
{L"mso-spt27" ,L"" ,0 ,0 ,0 }, {L"mso-spt27" ,L"" ,0 ,0 ,0 },
...@@ -174,9 +162,9 @@ static const _shape_converter _OO_OOX_custom_shapes[]= ...@@ -174,9 +162,9 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{L"mso-spt167" ,L"rect" ,0 ,0 ,0 }, {L"mso-spt167" ,L"rect" ,0 ,0 ,0 },
{L"mso-spt174" ,L"rect" ,0 ,0 ,0 },//L"textCanUp" {L"mso-spt174" ,L"rect" ,0 ,0 ,0 },//L"textCanUp"
{L"mso-spt175" ,L"rect" ,0 ,0 ,0 }, //L"textCanDown" {L"mso-spt175" ,L"rect" ,0 ,0 ,0 }, //L"textCanDown"
{L"mso-spt178" , L"" ,0 ,0 ,0 }, {L"mso-spt178" ,L"" ,0 ,0 ,0 },
{L"mso-spt179" , L"" ,0 ,0 ,0 }, {L"mso-spt179" ,L"" ,0 ,0 ,0 },
{L"mso-spt180" , L"" ,0 ,0 ,0 }, {L"mso-spt180" ,L"" ,0 ,0 ,0 },
{L"mso-spt182" ,L"leftRightUpArrow" ,0 ,0 ,0 }, {L"mso-spt182" ,L"leftRightUpArrow" ,0 ,0 ,0 },
{L"mso-spt188" ,L"rect" ,0 ,0 ,0 }, //L"textDoubleWave1" {L"mso-spt188" ,L"rect" ,0 ,0 ,0 }, //L"textDoubleWave1"
{L"mso-spt189" ,L"actionButtonBlank" ,0 ,0 ,0 }, {L"mso-spt189" ,L"actionButtonBlank" ,0 ,0 ,0 },
...@@ -191,32 +179,60 @@ static const _shape_converter _OO_OOX_custom_shapes[]= ...@@ -191,32 +179,60 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{L"mso-spt198" ,L"actionButtonDocument" ,0 ,0 ,0 }, {L"mso-spt198" ,L"actionButtonDocument" ,0 ,0 ,0 },
{L"mso-spt199" ,L"actionButtonSound" ,0 ,0 ,0 }, {L"mso-spt199" ,L"actionButtonSound" ,0 ,0 ,0 },
{L"mso-spt200" ,L"actionButtonMovie" ,0 ,0 ,0 }, {L"mso-spt200" ,L"actionButtonMovie" ,0 ,0 ,0 },
{L"mso-spt201" ,L"rect" ,0 ,0 ,0 }, {L"mso-spt201" ,L"rect" ,0 ,0 ,0 },
{L"mso-spt202" ,L"textBox" ,0 ,0 ,0 }, {L"mso-spt202" ,L"textBox" ,0 ,0 ,0 },
{L"quadrat" ,L"rect" ,0 ,0 ,0 }, {L"quadrat" ,L"rect" ,0 ,0 ,0 },
{L"round-quadrat" ,L"roundRect" ,0 ,0 ,0 }, {L"round-quadrat" ,L"roundRect" ,0 ,0 ,0 },
{L"circle" ,L"ellipse" ,0 ,0 ,0 }, {L"circle" ,L"ellipse" ,0 ,0 ,0 },
{L"circle-pie" ,L"pie" ,0 ,0 ,0 }, {L"circle-pie" ,L"pie" ,0 ,0 ,0 },
{L"frame" ,L"frame" ,0 ,0 ,0 }, {L"frame" ,L"frame" ,0 ,0 ,0 },
{L"cloud" ,L"cloud" ,0 ,0 ,0 }, {L"cloud" ,L"cloud" ,0 ,0 ,0 },
{L"up-right-arrow" ,L"rightUpArrow" ,0 ,0 ,0 }, {L"up-right-arrow" ,L"rightUpArrow" ,0 ,0 ,0 },
{L"col-502ad400" ,L"bevel" ,0 ,0 ,0 }, {L"col-502ad400" ,L"bevel" ,0 ,0 ,0 },
{L"col-60da8460" ,L"bevel" ,0 ,0 ,0 }, {L"col-60da8460" ,L"bevel" ,0 ,0 ,0 },
{L"quad-bevel" ,L"bevel" ,0 ,0 ,0 }, {L"quad-bevel" ,L"bevel" ,0 ,0 ,0 },
{L"flower" ,L"" ,0 ,0 ,0 }, {L"flower" ,L"" ,0 ,0 ,0 },
{L"puzzle" ,L"" ,0 ,0 ,0 }, {L"puzzle" ,L"" ,0 ,0 ,0 },
{L"up-right-down-arrow" ,L"" ,0 ,0 ,0 }, {L"up-right-down-arrow" ,L"" ,0 ,0 ,0 },
{L"corner-right-arrow" ,L"" ,0 ,0 ,0 }, {L"corner-right-arrow" ,L"" ,0 ,0 ,0 },
{L"split-arrow" ,L"" ,0 ,0 ,0 }, {L"split-arrow" ,L"" ,0 ,0 ,0 },
{L"up-right-arrow-callout" ,L"" ,0 ,0 ,0 }, {L"up-right-arrow-callout" ,L"" ,0 ,0 ,0 },
{L"split-round-arrow" ,L"" ,0 ,0 ,0 }, {L"split-round-arrow" ,L"" ,0 ,0 ,0 },
{L"s-sharped-arrow" ,L"" ,0 ,0 ,0 }, {L"s-sharped-arrow" ,L"" ,0 ,0 ,0 },
{L"concave-star6" ,L"" ,0 ,0 ,0 }, {L"concave-star6" ,L"" ,0 ,0 ,0 },
{L"signet" ,L"" ,0 ,0 ,0 }, {L"signet" ,L"" ,0 ,0 ,0 },
{L"doorplate" ,L"" ,0 ,0 ,0 }, {L"doorplate" ,L"" ,0 ,0 ,0 },
{L"fontwork-arch-left-curve" ,L"" ,0 ,0 ,0 }, };
{L"fontwork-arch-right-curve" ,L"" ,0 ,0 ,0 },
{L"fontwork-arch-left-pour" ,L"" ,0 ,0 ,0 },
{L"fontwork-arch-right-pour" ,L"" ,0 ,0 ,0 },
static const _shape_converter _OO_OOX_wordart[]=
//https://msdn.microsoft.com/ru-ru/library/documentformat.openxml.drawing.textshapevalues.aspx?f=255&MSPPError=-2147217396
{
{L"fontwork-arch-up-pour" ,L"textArchUpPour" ,0 ,0 ,0 },
{L"fontwork-arch-down-pour" ,L"textArchDownPour" ,0 ,0 ,0},
{L"fontwork-circle-pour" ,L"textCirclePour" ,0 ,0 ,0 },
{L"fontwork-curve-up" ,L"textCurveUp" ,0 ,0 ,0 },
{L"fontwork-curve-down" ,L"textCurveDown" ,0 ,0 ,0 },
{L"fontwork-wave" ,L"textWave1" ,0 ,0 ,0 },
{L"fontwork-fade-right" ,L"textFadeRight" ,0 ,0 ,0 },
{L"fontwork-fade-left" ,L"textFadeLeft" ,0 ,0 ,0 },
{L"fontwork-fade-up" ,L"textFadeUp" ,0 ,0 ,0 },
{L"fontwork-fade-down" ,L"textFadeDown" ,0 ,0 ,0 },
{L"fontwork-arch-left-curve" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-arch-right-curve" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-arch-left-pour" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-arch-right-pour" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-chevron-up" ,L"textChevron" ,0 ,0 ,0 },
{L"fontwork-chevron-down" ,L"textChevronInverted" ,0 ,0 ,0 },
{L"fontwork-plain-text" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-triangle-up" ,L"textTriangle" ,0 ,0 ,0 },
{L"fontwork-triangle-down" ,L"textTriangleInverted" ,0 ,0 ,0 },
{L"fontwork-open-circle-curve" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-circle-curve" ,L"textCircle" ,0 ,0 ,0 },
{L"fontwork-open-circle-pour" ,L"textPlain" ,0 ,0 ,0 },
{L"fontwork-fade-up-and-right" ,L"textFadeUp" ,0 ,0 ,0 },
{L"fontwork-fade-up-and-left" ,L"textFadeUp" ,0 ,0 ,0 },
{L"fontwork-inflate" ,L"textInflate" ,0 ,0 ,0 },
{L"fontwork-deflate" ,L"textDeflate" ,0 ,0 ,0 },
{L"fontwork-slant-up" ,L"textSlantUp" ,0 ,0 ,0 },
{L"fontwork-slant-down" ,L"textSlantDown" ,0 ,0 ,0 },
}; };
\ No newline at end of file
...@@ -144,9 +144,9 @@ _CP_OPT(border_widths) GetBorderLineWidths(const graphic_format_properties & gra ...@@ -144,9 +144,9 @@ _CP_OPT(border_widths) GetBorderLineWidths(const graphic_format_properties & gra
} }
return widths; return widths;
} }
_CP_OPT(length) GetConsistentBorderValue(const graphic_format_properties & graphicProperties, const std::wstring & border, BorderSide borderSide) _CP_OPT(length) GetConsistentBorderValue(const graphic_format_properties & graphicProperties, const border_style & borderStyle, BorderSide borderSide)
{ {
if (boost::algorithm::contains(border, L"double")) if (boost::algorithm::contains(borderStyle.get_style(), L"double"))
{ {
_CP_OPT(border_widths) borderWidths = GetBorderLineWidths(graphicProperties, borderSide); _CP_OPT(border_widths) borderWidths = GetBorderLineWidths(graphicProperties, borderSide);
if (borderWidths) if (borderWidths)
...@@ -154,8 +154,6 @@ _CP_OPT(length) GetConsistentBorderValue(const graphic_format_properties & graph ...@@ -154,8 +154,6 @@ _CP_OPT(length) GetConsistentBorderValue(const graphic_format_properties & graph
} }
else else
{ {
border_style borderStyle(border);
if (borderStyle.initialized()) if (borderStyle.initialized())
{ {
if (borderStyle.is_none()) if (borderStyle.is_none())
...@@ -188,8 +186,8 @@ int GetMargin(const graphic_format_properties & graphicProperties, BorderSide bo ...@@ -188,8 +186,8 @@ int GetMargin(const graphic_format_properties & graphicProperties, BorderSide bo
} }
int Compute_BorderWidth(const graphic_format_properties & graphicProperties, BorderSide borderSide) int Compute_BorderWidth(const graphic_format_properties & graphicProperties, BorderSide borderSide)
{ {
_CP_OPT(std::wstring) borderValue; _CP_OPT(border_style) borderValue;
_CP_OPT(length) lengthValue; _CP_OPT(length) lengthValue;
switch(borderSide) switch(borderSide)
{ {
......
...@@ -816,13 +816,12 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -816,13 +816,12 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing.additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight))); drawing.additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
drawing.additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom))); drawing.additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
if (const _CP_OPT(std::wstring) foBorder = graphicProperties.common_border_attlist_.fo_border_) if (graphicProperties.common_border_attlist_.fo_border_)
{ {
border_style borderStyle(*foBorder); if (graphicProperties.common_border_attlist_.fo_border_->initialized())
if (borderStyle.initialized())
{ {
drawing.additional.push_back(_property(L"stroke-color", borderStyle.get_color().get_hex_value() )); drawing.additional.push_back(_property(L"stroke-color", graphicProperties.common_border_attlist_.fo_border_->get_color().get_hex_value() ));
drawing.additional.push_back(_property(L"stroke-width", borderStyle.get_length().get_value_unit(odf_types::length::pt) )); drawing.additional.push_back(_property(L"stroke-width", graphicProperties.common_border_attlist_.fo_border_->get_length().get_value_unit(odf_types::length::pt) ));
} }
} }
......
...@@ -371,11 +371,15 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const ::std:: ...@@ -371,11 +371,15 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const ::std::
} }
void draw_enhanced_geometry::find_draw_type_oox() void draw_enhanced_geometry::find_draw_type_oox()
{ {
wordArt_ = false;
if (draw_enhanced_geometry_attlist_.draw_type_) if (draw_enhanced_geometry_attlist_.draw_type_)
{ {
std::wstring odf_type = draw_enhanced_geometry_attlist_.draw_type_.get(); std::wstring odf_type = draw_enhanced_geometry_attlist_.draw_type_.get();
for (long i=0; i<_OO_OOX_custom_shapes_count;i++) int count = sizeof(_OO_OOX_custom_shapes) / sizeof(_shape_converter);
for (long i=0; i< count; i++)
{ {
if (_OO_OOX_custom_shapes[i].odf_reader == odf_type) if (_OO_OOX_custom_shapes[i].odf_reader == odf_type)
{ {
...@@ -388,6 +392,23 @@ void draw_enhanced_geometry::find_draw_type_oox() ...@@ -388,6 +392,23 @@ void draw_enhanced_geometry::find_draw_type_oox()
{ {
sub_type_ = 1;//textBox sub_type_ = 1;//textBox
} }
if (!draw_type_oox_index_)
{
count = sizeof(_OO_OOX_wordart) / sizeof(_shape_converter);
for (long i=0; i< count; i++)
{
if (_OO_OOX_wordart[i].odf_reader == odf_type)
{
draw_type_oox_index_ = i;
wordArt_ = true;
sub_type_ = 1;
break;
}
}
}
} }
std::wstringstream str; std::wstringstream str;
......
...@@ -382,9 +382,10 @@ public: ...@@ -382,9 +382,10 @@ public:
draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_; draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_;
_CP_OPT(int) sub_type_; _CP_OPT(int) sub_type_;
_CP_OPT(int) draw_type_oox_index_; _CP_OPT(int) draw_type_oox_index_;
_CP_OPT(std::wstring) svg_viewbox_; _CP_OPT(std::wstring) svg_viewbox_;
bool wordArt_;
typedef std::pair<std::wstring,std::wstring> pair_string_value; typedef std::pair<std::wstring,std::wstring> pair_string_value;
......
...@@ -159,7 +159,11 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context ...@@ -159,7 +159,11 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
} }
if (draw_type_oox_index_) if (draw_type_oox_index_)
{ {
shape->additional_.push_back(_property(L"draw-type-index",draw_type_oox_index_.get())); shape->additional_.push_back(_property(L"draw-type-index", draw_type_oox_index_.get()));
if (wordArt_ == true)
shape->additional_.push_back(_property(L"wordArt", true));
} }
if (draw_enhanced_geometry_attlist_.draw_modifiers_) if (draw_enhanced_geometry_attlist_.draw_modifiers_)
{ {
......
...@@ -34,7 +34,9 @@ enum ElementType ...@@ -34,7 +34,9 @@ enum ElementType
typeTextPageNumber, typeTextPageNumber,
typeTextPageCount, typeTextPageCount,
typeTextDate, typeTextDate,
typeTextModificationDate,
typeTextTime, typeTextTime,
typeTextModificationTime,
typeTextFileName, typeTextFileName,
typeTextSequence, typeTextSequence,
typeTextSheetName, typeTextSheetName,
......
...@@ -966,13 +966,36 @@ void text_date::add_text(const std::wstring & Text) ...@@ -966,13 +966,36 @@ void text_date::add_text(const std::wstring & Text)
void text_date::docx_convert(oox::docx_conversion_context & Context) void text_date::docx_convert(oox::docx_conversion_context & Context)
{ {
Context.add_new_run(); bool asText = text_fixed_.get_value_or(false);
BOOST_FOREACH(const office_element_ptr & elm, text_)
{ if (asText)
elm->docx_convert(Context); {
} Context.add_new_run();
Context.finish_run(); BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
}
else
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>DATE</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
std::wostream & _Wostream = Context.output_stream();
_Wostream << L"<w:t xml:space=\"preserve\">";
this->text_to_stream(_Wostream);
_Wostream << L"</w:t>";
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
}
} }
void text_date::pptx_convert(oox::pptx_conversion_context & Context) void text_date::pptx_convert(oox::pptx_conversion_context & Context)
{ {
Context.get_text_context().start_field(oox::date,style_data_style_name_.get_value_or(L"")); Context.get_text_context().start_field(oox::date,style_data_style_name_.get_value_or(L""));
...@@ -982,6 +1005,43 @@ void text_date::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -982,6 +1005,43 @@ void text_date::pptx_convert(oox::pptx_conversion_context & Context)
} }
Context.get_text_context().end_field(); Context.get_text_context().end_field();
} }
const wchar_t * text_modification_date::ns = L"text";
const wchar_t * text_modification_date::name = L"modification-date";
void text_modification_date::docx_convert(oox::docx_conversion_context & Context)
{
bool asText = true;//text_fixed_.get_value_or(false);
if (asText)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
}
else
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText xml:space=\"preserve\">SAVEDATE \\@ \"dd.MM.yy\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
}
}
void text_modification_date::pptx_convert(oox::pptx_conversion_context & Context)
{
text_date::pptx_convert(Context);
}
// text:time // text:time
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_time::ns = L"text"; const wchar_t * text_time::ns = L"text";
...@@ -1014,12 +1074,33 @@ void text_time::add_text(const std::wstring & Text) ...@@ -1014,12 +1074,33 @@ void text_time::add_text(const std::wstring & Text)
void text_time::docx_convert(oox::docx_conversion_context & Context) void text_time::docx_convert(oox::docx_conversion_context & Context)
{ {
Context.add_new_run(); bool asText = text_fixed_.get_value_or(false);
BOOST_FOREACH(const office_element_ptr & elm, text_)
{ if (asText)
elm->docx_convert(Context); {
} Context.add_new_run();
Context.finish_run(); BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
}
else
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>TIME</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
std::wostream & _Wostream = Context.output_stream();
_Wostream << L"<w:t xml:space=\"preserve\">";
this->text_to_stream(_Wostream);
_Wostream << L"</w:t>";
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
}
} }
void text_time::pptx_convert(oox::pptx_conversion_context & Context) void text_time::pptx_convert(oox::pptx_conversion_context & Context)
{ {
...@@ -1031,7 +1112,43 @@ void text_time::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -1031,7 +1112,43 @@ void text_time::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_text_context().end_field(); Context.get_text_context().end_field();
} }
// text:time const wchar_t * text_modification_time::ns = L"text";
const wchar_t * text_modification_time::name = L"modification-time";
void text_modification_time::docx_convert(oox::docx_conversion_context & Context)
{
bool asText = true;//text_fixed_.get_value_or(false);
if (asText)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
}
else
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"begin\" /></w:r>";
strm << L"<w:r><w:instrText>SAVEDATE \\@ \"h:mm:ss am/pm\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" /></w:r>";
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
}
}
void text_modification_time::pptx_convert(oox::pptx_conversion_context & Context)
{
text_time::pptx_convert(Context);
}
// text:file-name
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_file_name::ns = L"text"; const wchar_t * text_file_name::ns = L"text";
const wchar_t * text_file_name::name = L"file-name"; const wchar_t * text_file_name::name = L"file-name";
......
...@@ -659,29 +659,44 @@ public: ...@@ -659,29 +659,44 @@ public:
static const ElementType type = typeTextDate; static const ElementType type = typeTextDate;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context); virtual void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); virtual void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private: std::wostream & text_to_stream(::std::wostream & _Wostream) const;
_CP_OPT(std::wstring) style_data_style_name_; _CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_; _CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_date_value_;//with format _CP_OPT(std::wstring) text_date_value_;//with format
office_element_ptr_array text_; office_element_ptr_array text_;
private:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
void add_text(const std::wstring & Text);
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_date); CP_REGISTER_OFFICE_ELEMENT2(text_date);
// text:modification-date
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_modification_date : public text_date
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextModificationDate;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(text_modification_date);
// text:time // text:time
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
class text_time : public paragraph_content_element<text_time> class text_time : public paragraph_content_element<text_time>
...@@ -693,27 +708,42 @@ public: ...@@ -693,27 +708,42 @@ public:
static const ElementType type = typeTextTime; static const ElementType type = typeTextTime;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context); virtual void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); virtual void pptx_convert(oox::pptx_conversion_context & Context);
public: std::wostream & text_to_stream(::std::wostream & _Wostream) const;
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
_CP_OPT(std::wstring) style_data_style_name_; _CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_; _CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_time_value_;//with format _CP_OPT(std::wstring) text_time_value_;//with format
office_element_ptr_array text_; office_element_ptr_array text_;
private:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
void add_text(const std::wstring & Text);
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_time); CP_REGISTER_OFFICE_ELEMENT2(text_time);
// text:modification-date
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_modification_time : public text_time
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextModificationTime;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(text_modification_time);
// text:file-name // text:file-name
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
class text_file_name : public paragraph_content_element<text_file_name> class text_file_name : public paragraph_content_element<text_file_name>
......
...@@ -274,20 +274,11 @@ public: ...@@ -274,20 +274,11 @@ public:
// 15.5.24 <style:background-image> // 15.5.24 <style:background-image>
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
// 15.5.25 fo:border _CP_OPT(odf_types::border_style) fo_border_; // +
_CP_OPT(std::wstring) fo_border_; // + _CP_OPT(odf_types::border_style) fo_border_top_; // +
_CP_OPT(odf_types::border_style) fo_border_bottom_; // +
// fo:border-top _CP_OPT(odf_types::border_style) fo_border_left_; // +
_CP_OPT(std::wstring) fo_border_top_; // + _CP_OPT(odf_types::border_style) fo_border_right_; // +
// fo:border-bottom
_CP_OPT(std::wstring) fo_border_bottom_; // +
// fo:border-left
_CP_OPT(std::wstring) fo_border_left_; // +
// fo:border-right
_CP_OPT(std::wstring) fo_border_right_; // +
// 15.5.26 // 15.5.26
_CP_OPT( odf_types::border_widths ) style_border_line_width_; // + _CP_OPT( odf_types::border_widths ) style_border_line_width_; // +
......
...@@ -17,7 +17,7 @@ namespace odf_reader { ...@@ -17,7 +17,7 @@ namespace odf_reader {
namespace { namespace {
std::wstring process_border(const border_style & borderStyle, std::wstring process_border(border_style & borderStyle,
const _CP_OPT(border_widths) & borderLineWidths, const _CP_OPT(border_widths) & borderLineWidths,
const _CP_OPT(length) & borderPadding, const std::wstring & Shadow = L"") const _CP_OPT(length) & borderPadding, const std::wstring & Shadow = L"")
{ {
......
...@@ -360,7 +360,7 @@ void insert_cell_margin(oox::docx_conversion_context & Context, ...@@ -360,7 +360,7 @@ void insert_cell_margin(oox::docx_conversion_context & Context,
} }
void insert_cell_border(oox::docx_conversion_context & Context, void insert_cell_border(oox::docx_conversion_context & Context,
const std::wstring & Side, const std::wstring & Side,
const std::wstring & BorderStyle, const _CP_OPT(border_style) & BorderStyle,
const _CP_OPT(border_widths) & BorderWidths const _CP_OPT(border_widths) & BorderWidths
) )
{ {
...@@ -372,49 +372,46 @@ void insert_cell_border(oox::docx_conversion_context & Context, ...@@ -372,49 +372,46 @@ void insert_cell_border(oox::docx_conversion_context & Context,
bool none = false; bool none = false;
try try
{ {
do if (BorderStyle)
{ {
border_style borderStyle(BorderStyle); if (BorderStyle->is_none())
if (borderStyle.is_none())
{ {
strm << L"<w:" << Side << " "; strm << L"<w:" << Side << " ";
strm << L"w:val=\"none\" "; strm << L"w:val=\"none\" ";
strm << L"/>"; strm << L"/>";
none = true; none = true;
break; }else
} {
w_color = BorderStyle->get_color().get_hex_value();
w_color = borderStyle.get_color().get_hex_value();
if (BorderStyle->get_style() == L"double")
if (borderStyle.get_style() == L"double") {
{ w_val = L"double";
w_val = L"double"; if (BorderWidths)
if (BorderWidths) {
{ if (BorderWidths->get_len1().get_value_unit(length::pt) > BorderWidths->get_len3().get_value_unit(length::pt))
if (BorderWidths->get_len1().get_value_unit(length::pt) > BorderWidths->get_len3().get_value_unit(length::pt)) w_val = L"thickThinMediumGap";
w_val = L"thickThinMediumGap"; else if (BorderWidths->get_len1().get_value_unit(length::pt) < BorderWidths->get_len3().get_value_unit(length::pt))
else if (BorderWidths->get_len1().get_value_unit(length::pt) < BorderWidths->get_len3().get_value_unit(length::pt)) w_val = L"thinThickMediumGap";
w_val = L"thinThickMediumGap"; }
} }
} else
else w_val = L"single";
w_val = L"single";
double w_sz_ = BorderStyle->get_length().get_value_unit(length::pt);
double w_sz_ = borderStyle.get_length().get_value_unit(length::pt);
//if (BorderStyle.get_style() == L"double")
//if (borderStyle.get_style() == L"double") // w_sz_ /= 2;
// w_sz_ /= 2;
w_sz_ = (int)(0.5 + 8.0 * w_sz_);
w_sz_ = (int)(0.5 + 8.0 * w_sz_); if (w_sz_ < 2.0)
if (w_sz_ < 2.0) w_sz_ = 2.0;
w_sz_ = 2.0; else if (w_sz_ > 96.0)
else if (w_sz_ > 96.0) w_sz_ = 96.0;
w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ );
w_sz = boost::lexical_cast<std::wstring>( w_sz_ ); }
} }
while (0);
} }
catch(...) catch(...)
{ {
...@@ -539,10 +536,10 @@ void style_table_cell_properties_attlist::docx_convert(oox::docx_conversion_cont ...@@ -539,10 +536,10 @@ void style_table_cell_properties_attlist::docx_convert(oox::docx_conversion_cont
if (common_border_attlist_.fo_border_) if (common_border_attlist_.fo_border_)
{ {
insert_cell_border(Context, L"top", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_); insert_cell_border(Context, L"top", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_);
insert_cell_border(Context, L"left", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_); insert_cell_border(Context, L"left", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_);
insert_cell_border(Context, L"bottom", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_); insert_cell_border(Context, L"bottom", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_);
insert_cell_border(Context, L"right", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_); insert_cell_border(Context, L"right", *common_border_attlist_.fo_border_, common_border_line_width_attlist_.style_border_line_width_);
} }
else else
{ {
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "odfcontext.h" #include "odfcontext.h"
#include "draw_common.h" #include "draw_common.h"
#include "datatypes/borderstyle.h"
namespace cpdoccore { namespace cpdoccore {
...@@ -51,12 +50,17 @@ std::wstring process_border(const border_style & borderStyle, ...@@ -51,12 +50,17 @@ std::wstring process_border(const border_style & borderStyle,
else if (borderStyle.initialized()) else if (borderStyle.initialized())
{ {
double width = borderStyle.get_length().get_value_unit(length::pt); double width = borderStyle.get_length().get_value_unit(length::pt);
//borderLineWidths ? borderLineWidths->get_summ_unit(length::pt) : borderStyle.get_length().get_value_unit(length::pt);
int szInt = (int)(0.5 + 8.0 * width); if (borderLineWidths)
if (szInt <= 0) {
szInt = 1; width = borderLineWidths->get_len1().get_value_unit(length::pt);
w_sz = boost::lexical_cast<std::wstring>( szInt ); }
w_color = boost::lexical_cast<std::wstring>( borderStyle.get_color().get_hex_value() );
int szInt = (int)(0.5 + 8.0 * width); //eighths of a point (ST_EighthPointMeasure)
if (szInt <= 0) szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt );
w_color = boost::lexical_cast<std::wstring>( borderStyle.get_color().get_hex_value() );
if (borderPadding) if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) ); w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
...@@ -930,7 +934,9 @@ Choice [0..6] ...@@ -930,7 +934,9 @@ Choice [0..6]
namespace { namespace {
std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, const _CP_OPT(length_or_percent) & Val2, const _CP_OPT(length) & AddVal = _CP_OPT(length)()) std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val,
const _CP_OPT(length_or_percent) & Val2,
const _CP_OPT(length) & AddVal = _CP_OPT(length)())
{ {
if (!Val || if (!Val ||
Val->get_type() == length_or_percent::Percent) Val->get_type() == length_or_percent::Percent)
...@@ -942,7 +948,7 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, const _ ...@@ -942,7 +948,7 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, const _
double v2 = (!Val2 || Val2->get_type() == length_or_percent::Percent) ? 0 : double v2 = (!Val2 || Val2->get_type() == length_or_percent::Percent) ? 0 :
(20.0 * Val2->get_length().get_value_unit(length::pt)); (20.0 * Val2->get_length().get_value_unit(length::pt));
double dAddVal = AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5; double dAddVal = 20.0 * AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5;
if (dAddVal < 0 ) dAddVal = 0; if (dAddVal < 0 ) dAddVal = 0;
return boost::lexical_cast<std::wstring>( (int)( (!Val ? v2 : v1) + dAddVal)); return boost::lexical_cast<std::wstring>( (int)( (!Val ? v2 : v1) + dAddVal));
...@@ -950,7 +956,8 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, const _ ...@@ -950,7 +956,8 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, const _
} }
void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context) void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context, _CP_OPT(length_or_percent) margin_left,
_CP_OPT(length_or_percent) margin_right)
{ {
if (fo_page_width_ || fo_page_height_ || style_print_orientation_) if (fo_page_width_ || fo_page_height_ || style_print_orientation_)
{ {
...@@ -998,37 +1005,75 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream ...@@ -998,37 +1005,75 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
if (common_border_attlist_.fo_border_) if (common_border_attlist_.fo_border_)
{ {
odf_types::border_style style(*common_border_attlist_.fo_border_); std::wstring w_border, w_shadow;
std::wstring w_shadow, w_border;
_CP_OPT(border_widths) border_line_width;
_CP_OPT(length) border_padding;
w_border = process_border(style, border_line_width , border_padding, w_shadow); if (common_shadow_attlist_.style_shadow_)
w_shadow = common_shadow_attlist_.style_shadow_->get_type() != shadow_type::None ? L"1" : L"0";
w_border = process_border(*common_border_attlist_.fo_border_,
common_border_line_width_attlist_.style_border_line_width_,
common_padding_attlist_.fo_padding_,
w_shadow);
strm << L"<w:pgBorders>"; strm << L"<w:pgBorders>";
strm << L"<w:top " << w_border << L"/>"; strm << L"<w:top " << w_border << L"/>";
strm << L"<w:left " << w_border << L"/>"; strm << L"<w:left " << w_border << L"/>";
strm << L"<w:bottom " << w_border << L"/>"; strm << L"<w:bottom " << w_border << L"/>";
strm << L"<w:right " << w_border << L"/>"; strm << L"<w:right " << w_border << L"/>";
strm << L"</w:pgBorders>"; strm << L"</w:pgBorders>";
} }
else if (common_border_attlist_.fo_border_top_ || common_border_attlist_.fo_border_bottom_ ||
if (common_horizontal_margin_attlist_.fo_margin_left_ || common_border_attlist_.fo_border_left_ || common_border_attlist_.fo_border_right_ )
{
std::wstring w_top, w_left, w_right, w_bottom, w_shadow;
if (common_shadow_attlist_.style_shadow_)
w_shadow = common_shadow_attlist_.style_shadow_->get_type() != shadow_type::None ? L"1" : L"0";
if (common_border_attlist_.fo_border_top_)
w_top = process_border( *common_border_attlist_.fo_border_top_,
common_border_line_width_attlist_.style_border_line_width_top_,
common_padding_attlist_.fo_padding_top_, w_shadow);
if (common_border_attlist_.fo_border_bottom_)
w_bottom = process_border( *common_border_attlist_.fo_border_bottom_,
common_border_line_width_attlist_.style_border_line_width_bottom_,
common_padding_attlist_.fo_padding_bottom_, w_shadow);
if (common_border_attlist_.fo_border_left_)
w_left = process_border( *common_border_attlist_.fo_border_left_,
common_border_line_width_attlist_.style_border_line_width_left_,
common_padding_attlist_.fo_padding_left_, w_shadow);
if (common_border_attlist_.fo_border_right_)
w_right = process_border( *common_border_attlist_.fo_border_right_,
common_border_line_width_attlist_.style_border_line_width_right_,
common_padding_attlist_.fo_padding_right_, w_shadow);
strm << L"<w:pgBorders>";
if (!w_top.empty()) strm << L"<w:top " << w_top << L" />";
if (!w_left.empty()) strm << L"<w:left " << w_left << L" />";
if (!w_right.empty()) strm << L"<w:right " << w_right << L" />";
if (!w_bottom.empty()) strm << L"<w:bottom " << w_bottom << L" />";
strm << L"</w:pgBorders>";
}
if (common_horizontal_margin_attlist_.fo_margin_left_ ||
common_horizontal_margin_attlist_.fo_margin_right_ || common_horizontal_margin_attlist_.fo_margin_right_ ||
common_vertical_margin_attlist_.fo_margin_top_ || common_vertical_margin_attlist_.fo_margin_top_ ||
common_vertical_margin_attlist_.fo_margin_bottom_ || common_vertical_margin_attlist_.fo_margin_bottom_ ||
common_margin_attlist_.fo_margin_ common_margin_attlist_.fo_margin_ || margin_right || margin_left
) )
{ {
strm << L"<w:pgMar w:bottom=\"" _CP_OPT(odf_types::length) margin_left_length, margin_right_length;
if (margin_left) margin_left_length = margin_left->get_length();
if (margin_right) margin_right_length = margin_right->get_length();
strm << L"<w:pgMar w:bottom=\""
<< process_page_margin(common_vertical_margin_attlist_.fo_margin_bottom_, common_margin_attlist_.fo_margin_, Context.get_header_footer_context().footer()) << << process_page_margin(common_vertical_margin_attlist_.fo_margin_bottom_, common_margin_attlist_.fo_margin_, Context.get_header_footer_context().footer()) <<
L"\" w:footer=\"" << process_page_margin(common_vertical_margin_attlist_.fo_margin_bottom_, common_margin_attlist_.fo_margin_) << L"\" w:footer=\"" << process_page_margin(common_vertical_margin_attlist_.fo_margin_bottom_, common_margin_attlist_.fo_margin_) <<
L"\" w:gutter=\"" << 0 << L"\" w:gutter=\"" << 0 <<
L"\" w:header=\"" << process_page_margin(common_vertical_margin_attlist_.fo_margin_top_, common_margin_attlist_.fo_margin_) << L"\" w:header=\"" << process_page_margin(common_vertical_margin_attlist_.fo_margin_top_, common_margin_attlist_.fo_margin_) <<
L"\" w:left=\"" << process_page_margin(common_horizontal_margin_attlist_.fo_margin_left_, common_margin_attlist_.fo_margin_) << L"\" w:left=\"" << process_page_margin(common_horizontal_margin_attlist_.fo_margin_left_, common_margin_attlist_.fo_margin_, margin_left_length) <<
L"\" w:right=\"" << process_page_margin(common_horizontal_margin_attlist_.fo_margin_right_, common_margin_attlist_.fo_margin_) << L"\" w:right=\"" << process_page_margin(common_horizontal_margin_attlist_.fo_margin_right_, common_margin_attlist_.fo_margin_, margin_right_length) <<
L"\" w:top=\"" << process_page_margin(common_vertical_margin_attlist_.fo_margin_top_, common_margin_attlist_.fo_margin_, Context.get_header_footer_context().header()) << L"\" w:top=\"" << process_page_margin(common_vertical_margin_attlist_.fo_margin_top_, common_margin_attlist_.fo_margin_, Context.get_header_footer_context().header()) <<
L"\" />"; L"\" />";
} }
} }
...@@ -1146,6 +1191,24 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1146,6 +1191,24 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
return; return;
} }
_CP_OPT(length_or_percent) sect_margin_left_, sect_margin_right_;
int count_columns = 1;
bool sep_columns = false;
if (style_columns * columns = dynamic_cast<style_columns *>( style_page_layout_properties_elements_.style_columns_.get() ))
{
if ((columns->fo_column_count_) && (*columns->fo_column_count_ > 1))
{
count_columns = *columns->fo_column_count_;
}
if (style_column_sep * columns_sep = dynamic_cast<style_column_sep *>( columns->style_column_sep_.get() ))
{
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"w:sectPr") CP_XML_NODE(L"w:sectPr")
...@@ -1164,19 +1227,21 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1164,19 +1227,21 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
{ {
if (style_section_properties * sectPr = content->get_style_section_properties()) if (style_section_properties * sectPr = content->get_style_section_properties())
{ {
if (const style_columns * columns = dynamic_cast<const style_columns *>( sectPr->style_columns_.get() )) if (style_columns * columns = dynamic_cast<style_columns *>( sectPr->style_columns_.get() ))
{ {
if (columns->fo_column_count_ && *columns->fo_column_count_ > 1) if (columns->fo_column_count_)
{ {
CP_XML_NODE(L"w:cols") count_columns = *columns->fo_column_count_;
{ }
CP_XML_ATTR(L"w:equalWidth", L"true"); if (style_column_sep * columns_sep = dynamic_cast<style_column_sep *>( columns->style_column_sep_.get() ))
CP_XML_ATTR(L"w:num", *columns->fo_column_count_); {
CP_XML_ATTR(L"w:sep",true); if (columns_sep->style_style_ != _T("none"))
CP_XML_ATTR(L"w:space",0); sep_columns = true;
}
} }
} }
sect_margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
sect_margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
} }
} }
} }
...@@ -1191,7 +1256,18 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1191,7 +1256,18 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
CP_XML_ATTR(L"w:val", L"continuous"); CP_XML_ATTR(L"w:val", L"continuous");
} }
} }
if (count_columns > 1)
{
CP_XML_NODE(L"w:cols")
{
CP_XML_ATTR(L"w:equalWidth", L"true");
CP_XML_ATTR(L"w:num", count_columns);
CP_XML_ATTR(L"w:sep", sep_columns);
CP_XML_ATTR(L"w:space",0);
}
}
{ {
std::wstring masterPageName = Context.get_master_page_name();// document.xml!!! std::wstring masterPageName = Context.get_master_page_name();// document.xml!!!
bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm); bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm);
...@@ -1204,7 +1280,8 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1204,7 +1280,8 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm); bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm);
} }
} }
style_page_layout_properties_attlist_.docx_convert_serialize(strm, Context); style_page_layout_properties_attlist_.docx_convert_serialize(strm, Context, sect_margin_left_, sect_margin_right_);
//todooo - !!
} }
} }
} }
......
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
#include "datatypes/stylefamily.h" #include "datatypes/stylefamily.h"
#include "datatypes/style_ref.h" #include "datatypes/style_ref.h"
#include "datatypes/textalign.h" #include "datatypes/textalign.h"
#include "datatypes/length.h" #include "datatypes/lengthorpercent.h"
#include "datatypes/styleverticalrel.h" #include "datatypes/styleverticalrel.h"
#include "datatypes/styleverticalpos.h" #include "datatypes/styleverticalpos.h"
#include "datatypes/percent.h"
#include "datatypes/verticalalign.h" #include "datatypes/verticalalign.h"
#include "datatypes/pageusage.h" #include "datatypes/pageusage.h"
#include "datatypes/tablecentering.h" #include "datatypes/tablecentering.h"
...@@ -688,11 +687,11 @@ private: ...@@ -688,11 +687,11 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: public:
_CP_OPT(unsigned int) fo_column_count_; _CP_OPT(unsigned int) fo_column_count_;
_CP_OPT(odf_types::length) fo_column_gap_; _CP_OPT(odf_types::length) fo_column_gap_;
office_element_ptr style_column_sep_; office_element_ptr style_column_sep_;
office_element_ptr_array style_column_; office_element_ptr_array style_column_;
}; };
...@@ -741,8 +740,8 @@ private: ...@@ -741,8 +740,8 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
private: public:
std::wstring style_style_; // default solid std::wstring style_style_; // default solid
_CP_OPT(odf_types::length) style_width_; _CP_OPT(odf_types::length) style_width_;
odf_types::percent style_height_; // default 100 odf_types::percent style_height_; // default 100
odf_types::vertical_align style_vertical_align_; //default top odf_types::vertical_align style_vertical_align_; //default top
...@@ -768,25 +767,16 @@ private: ...@@ -768,25 +767,16 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: public:
bool style_protect_; // default false
// 15.7.1 odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_background_color_attlist common_background_color_attlist_;
office_element_ptr style_background_image_;
// 15.7.2
odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_; odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_;
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
// 15.7.3 office_element_ptr style_background_image_;
office_element_ptr style_columns_;
// 15.7.6
bool style_protect_; // default false
// 15.7.7 office_element_ptr style_columns_;
_CP_OPT(bool) text_dont_balance_text_columns_; _CP_OPT(bool) text_dont_balance_text_columns_;
// 15.7.8
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
// 15.7.9 // 15.7.9
// TODO text-notes-configuration // TODO text-notes-configuration
...@@ -876,10 +866,10 @@ public: ...@@ -876,10 +866,10 @@ public:
public: public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const; virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
style_page_layout_attlist style_page_layout_attlist_; style_page_layout_attlist style_page_layout_attlist_;
office_element_ptr style_page_layout_properties_; office_element_ptr style_page_layout_properties_;
office_element_ptr style_header_style_; office_element_ptr style_header_style_;
office_element_ptr style_footer_style_; office_element_ptr style_footer_style_;
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
...@@ -896,7 +886,8 @@ class style_page_layout_properties_attlist ...@@ -896,7 +886,8 @@ class style_page_layout_properties_attlist
public: public:
void add_attributes( const xml::attributes_wc_ptr & Attributes ); void add_attributes( const xml::attributes_wc_ptr & Attributes );
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context); void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context, _CP_OPT(odf_types::length_or_percent) margin_left,
_CP_OPT(odf_types::length_or_percent) margin_right);
void pptx_convert(oox::pptx_conversion_context & Context); void pptx_convert(oox::pptx_conversion_context & Context);
public: public:
...@@ -907,18 +898,14 @@ public: ...@@ -907,18 +898,14 @@ public:
_CP_OPT(std::wstring) style_paper_tray_name_; _CP_OPT(std::wstring) style_paper_tray_name_;
_CP_OPT(std::wstring) style_print_orientation_; // + _CP_OPT(std::wstring) style_print_orientation_; // +
//15.2.5 //15.2.5
odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_; odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_;
odf_types::common_vertical_margin_attlist common_vertical_margin_attlist_; odf_types::common_vertical_margin_attlist common_vertical_margin_attlist_;
odf_types::common_margin_attlist common_margin_attlist_; odf_types::common_margin_attlist common_margin_attlist_;
// 15.2.6 odf_types::common_border_attlist common_border_attlist_;
odf_types::common_border_attlist common_border_attlist_;
// 15.2.7
odf_types::common_border_line_width_attlist common_border_line_width_attlist_; odf_types::common_border_line_width_attlist common_border_line_width_attlist_;
// 15.2.8 odf_types::common_padding_attlist common_padding_attlist_;
odf_types::common_padding_attlist common_padding_attlist_; odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.9
odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.10 // 15.2.10
odf_types::common_background_color_attlist common_background_color_attlist_; odf_types::common_background_color_attlist common_background_color_attlist_;
...@@ -1018,8 +1005,8 @@ public: ...@@ -1018,8 +1005,8 @@ public:
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context); void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
public: public:
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
office_element_ptr style_columns_; office_element_ptr style_columns_;
// 15.2.20 // 15.2.20
office_element_ptr style_footnote_sep_; office_element_ptr style_footnote_sep_;
...@@ -1056,8 +1043,8 @@ private: ...@@ -1056,8 +1043,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: public:
style_page_layout_properties_attlist style_page_layout_properties_attlist_; style_page_layout_properties_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_; style_page_layout_properties_elements style_page_layout_properties_elements_;
}; };
......
...@@ -24,9 +24,11 @@ bool table_table_cell_content::docx_convert(oox::docx_conversion_context & Conte ...@@ -24,9 +24,11 @@ bool table_table_cell_content::docx_convert(oox::docx_conversion_context & Conte
bool wasPar = false; bool wasPar = false;
BOOST_FOREACH(const office_element_ptr & elm, text_content_) BOOST_FOREACH(const office_element_ptr & elm, text_content_)
{ {
if (elm->get_type() == typeTextP || ElementType type = elm->get_type();
elm->get_type() == typeTextH)
if (type == typeTextP || type== typeTextH)
wasPar = true; wasPar = true;
elm->docx_convert(Context); elm->docx_convert(Context);
} }
return wasPar; return wasPar;
......
...@@ -736,7 +736,6 @@ void text_index_title::add_child_element( xml::sax * Reader, const ::std::wstrin ...@@ -736,7 +736,6 @@ void text_index_title::add_child_element( xml::sax * Reader, const ::std::wstrin
} }
// text:table-of-content // text:table-of-content
// text-table-of-content
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_table_of_content::ns = L"text"; const wchar_t * text_table_of_content::ns = L"text";
const wchar_t * text_table_of_content::name = L"table-of-content"; const wchar_t * text_table_of_content::name = L"table-of-content";
...@@ -774,6 +773,81 @@ void text_table_of_content::add_child_element( xml::sax * Reader, const ::std::w ...@@ -774,6 +773,81 @@ void text_table_of_content::add_child_element( xml::sax * Reader, const ::std::w
// TODO text-table-of-content-source // TODO text-table-of-content-source
} }
// text:table-index
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_table_index::ns = L"text";
const wchar_t * text_table_index::name = L"table-index";
void text_table_index::docx_convert(oox::docx_conversion_context & Context)
{
if (text_index_body_)
text_index_body_->docx_convert(Context);
}
void text_table_index::pptx_convert(oox::pptx_conversion_context & Context)
{
if (text_index_body_)
text_index_body_->pptx_convert(Context);
}
::std::wostream & text_table_index::text_to_stream(::std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(text_index_body_);
return _Wostream;
}
void text_table_index::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_section_attr_.add_attributes( Attributes );
}
void text_table_index::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"index-body")
{
CP_CREATE_ELEMENT(text_index_body_);
}
// TODO text-table-index-source
}
// text:illustration-index
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_illustration_index::ns = L"text";
const wchar_t * text_illustration_index::name = L"illustration-index";
void text_illustration_index::docx_convert(oox::docx_conversion_context & Context)
{
if (text_index_body_)
text_index_body_->docx_convert(Context);
}
void text_illustration_index::pptx_convert(oox::pptx_conversion_context & Context)
{
if (text_index_body_)
text_index_body_->pptx_convert(Context);
}
::std::wostream & text_illustration_index::text_to_stream(::std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(text_index_body_);
return _Wostream;
}
void text_illustration_index::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_section_attr_.add_attributes( Attributes );
}
void text_illustration_index::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"index-body")
{
CP_CREATE_ELEMENT(text_index_body_);
}
// TODO text-illustration-index-source
}
} }
} }
} }
...@@ -286,7 +286,6 @@ private: ...@@ -286,7 +286,6 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(text_section_source); CP_REGISTER_OFFICE_ELEMENT2(text_section_source);
// text:table-of-content // text:table-of-content
// text-table-of-content
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
class text_table_of_content : public text_content_impl<text_table_of_content> class text_table_of_content : public text_content_impl<text_table_of_content>
{ {
...@@ -308,16 +307,76 @@ private: ...@@ -308,16 +307,76 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: public:
text_section_attr text_section_attr_; text_section_attr text_section_attr_;
office_element_ptr text_table_of_content_source_; office_element_ptr text_table_of_content_source_;
office_element_ptr text_index_body_; office_element_ptr text_index_body_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_table_of_content); CP_REGISTER_OFFICE_ELEMENT2(text_table_of_content);
// text:table-index
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_table_index : public text_content_impl<text_table_index>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextTableIndex;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
text_section_attr text_section_attr_;
office_element_ptr text_table_index_source_;
office_element_ptr text_index_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_table_index);
// text:illustration-index
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_illustration_index : public text_content_impl<text_illustration_index>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextIllustrationIndex;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
text_section_attr text_section_attr_;
office_element_ptr text_illustration_index_source_;
office_element_ptr text_index_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_illustration_index);
// text:index-body // text:index-body
// text-index-body
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
class text_index_body : public text_content_impl<text_index_body> class text_index_body : public text_content_impl<text_index_body>
{ {
......
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