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")
{
}
} }
} }
} }
......
...@@ -120,7 +120,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -120,7 +120,7 @@ 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,10 +21,10 @@ namespace oox { ...@@ -21,10 +21,10 @@ 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())
...@@ -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,6 +98,7 @@ public: ...@@ -99,6 +98,7 @@ 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.left = xlsx_border_edge();
border.right = xlsx_border_edge(); border.right = xlsx_border_edge();
border.top = xlsx_border_edge(); border.top = xlsx_border_edge();
...@@ -107,6 +107,7 @@ public: ...@@ -107,6 +107,7 @@ public:
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_);
...@@ -120,7 +121,8 @@ public: ...@@ -120,7 +121,8 @@ public:
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);
......
...@@ -4,6 +4,66 @@ ...@@ -4,6 +4,66 @@
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);
...@@ -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(){}
border_style(const std::wstring & Value); 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);
}
...@@ -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;
...@@ -62,8 +60,8 @@ static const _shape_converter _OO_OOX_custom_shapes[]= ...@@ -62,8 +60,8 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{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 },
...@@ -94,26 +92,16 @@ static const _shape_converter _OO_OOX_custom_shapes[]= ...@@ -94,26 +92,16 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{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"fontwork-arch-down-pour" ,L"rect" ,0 ,0 ,0 },//L"textArchDownPour"
{L"fontwork-circle-pour" ,L"rect" ,0 ,0 ,0 },//L"textCirclePour"
{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"left-brace" ,L"leftBrace" ,0 ,0 ,0 },
{L"right-brace" ,L"rightBrace" ,0 ,0 ,0 }, {L"right-brace" ,L"rightBrace" ,0 ,0 ,0 },
{L"left-bracket" ,L"leftBracket" ,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 },
...@@ -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 },
...@@ -214,9 +202,37 @@ static const _shape_converter _OO_OOX_custom_shapes[]= ...@@ -214,9 +202,37 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{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,7 +186,7 @@ int GetMargin(const graphic_format_properties & graphicProperties, BorderSide bo ...@@ -188,7 +186,7 @@ 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;
......
...@@ -385,6 +385,7 @@ public: ...@@ -385,6 +385,7 @@ public:
_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)
{ {
bool asText = text_fixed_.get_value_or(false);
if (asText)
{
Context.add_new_run(); Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_) BOOST_FOREACH(const office_element_ptr & elm, text_)
{ {
elm->docx_convert(Context); elm->docx_convert(Context);
} }
Context.finish_run(); 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)
{ {
bool asText = text_fixed_.get_value_or(false);
if (asText)
{
Context.add_new_run(); Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_) BOOST_FOREACH(const office_element_ptr & elm, text_)
{ {
elm->docx_convert(Context); elm->docx_convert(Context);
} }
Context.finish_run(); 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,18 +659,11 @@ public: ...@@ -659,18 +659,11 @@ 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: 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_;
...@@ -678,42 +671,79 @@ private: ...@@ -678,42 +671,79 @@ private:
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:time // text:modification-date
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
class text_time : public paragraph_content_element<text_time> class text_modification_date : public text_date
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement; static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextTime; static const ElementType type = typeTextModificationDate;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context); void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); void pptx_convert(oox::pptx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(text_modification_date);
// text:time
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_time : public paragraph_content_element<text_time>
{
public: public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const; static const wchar_t * ns;
private: static const wchar_t * name;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); static const xml::NodeType xml_type = xml::typeElement;
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); static const ElementType type = typeTextTime;
virtual void add_text(const std::wstring & Text); CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
std::wostream & text_to_stream(::std::wostream & _Wostream) const;
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,21 +372,19 @@ void insert_cell_border(oox::docx_conversion_context & Context, ...@@ -372,21 +372,19 @@ 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)
...@@ -400,9 +398,9 @@ void insert_cell_border(oox::docx_conversion_context & Context, ...@@ -400,9 +398,9 @@ void insert_cell_border(oox::docx_conversion_context & Context,
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_);
...@@ -412,9 +410,8 @@ void insert_cell_border(oox::docx_conversion_context & Context, ...@@ -412,9 +410,8 @@ void insert_cell_border(oox::docx_conversion_context & Context,
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(...)
{ {
......
This diff is collapsed.
...@@ -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"
...@@ -741,7 +740,7 @@ private: ...@@ -741,7 +740,7 @@ 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
...@@ -768,26 +767,17 @@ private: ...@@ -768,26 +767,17 @@ 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
...@@ -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:
...@@ -911,13 +902,9 @@ public: ...@@ -911,13 +902,9 @@ public:
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_;
// 15.2.9
odf_types::common_shadow_attlist common_shadow_attlist_; odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.10 // 15.2.10
......
...@@ -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>
{ {
...@@ -316,8 +315,68 @@ public: ...@@ -316,8 +315,68 @@ public:
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