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
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)
oox_serialize_ln(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
}
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
{
_CP_OPT(int) iShapeIndex;
odf_reader::GetProperty(prop,L"draw-type-index",iShapeIndex);
_CP_OPT(int) iShapeIndex;
odf_reader::GetProperty(prop,L"draw-type-index", iShapeIndex);
if (!iShapeIndex)return;
......@@ -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)
{
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop,L"wordArt", bWordArt);
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:bodyPr")
......@@ -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;
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)
{
_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
{
......@@ -224,7 +244,7 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val)
shapeType = _ooxShapeType[val.sub_type];
}
if (shapeType.length()<1)shapeType = L"rect";
if (shapeType.length()<1 || bWordArt) shapeType = L"rect";
CP_XML_WRITER(strm)
{
......@@ -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_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
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.prstDash = L"solid";
......@@ -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
//thinThick (Thin Thick Double Lines) Double lines: one thin, one thick
//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;
if (odfBorderStyle)
if (borderStyle)
{
borderEdge.present = true;
odf_types::border_style borderStyle(*odfBorderStyle);
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.color = borderStyle->get_color().get_hex_value();
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)
......@@ -333,16 +330,14 @@ void oox_serialize_tcPr(std::wostream & strm, const odf_reader::style_instance*
//vert //
//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);
pptx_border_edge left,top,bottom,right;
pptx_border_edge left, top, bottom, right;
process_border(left,style_paragraph.fo_border_left_);
process_border(top,style_paragraph.fo_border_top_);
process_border(right,style_paragraph.fo_border_right_);
process_border(bottom,style_paragraph.fo_border_bottom_);
process_border(left, style_paragraph.fo_border_left_);
process_border(top, style_paragraph.fo_border_top_);
process_border(right, style_paragraph.fo_border_right_);
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:lnR",right);
......
......@@ -21,11 +21,11 @@ namespace oox {
namespace {
// 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";
if (borderStyle.initialized())
std::wstring retVal = L"none";
if (borderStyle.initialized())
{
if (borderStyle.get_style() == L"none" || borderStyle.get_style().empty())
retVal = L"none";
......@@ -42,18 +42,16 @@ std::wstring convert_border_style(const std::wstring& odfBorderStyle)
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;
color.rgb = borderStyle.get_color().get_hex_value();
color.rgb = borderStyle->get_color().get_hex_value();
borderEdge.color = color;
borderEdge.style = convert_border_style(*odfBorderStyle);
borderEdge.width = boost::lexical_cast<int>(borderStyle.get_length().get_value_unit(odf_types::length::emu));
borderEdge.style = convert_border_style(*borderStyle);
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)
if (odfBorderStyle)
{
odf_types::border_style borderStyle(*odfBorderStyle);
if (convert_border_style(*odfBorderStyle) != L"none")
if (convert_border_style(borderStyle) != L"none")
return true;
}
return false;
......@@ -90,7 +89,7 @@ public:
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;
return borderId(cellProp, is_default);
......@@ -99,28 +98,31 @@ public:
size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default_val)
{
xlsx_border border;
border.left = xlsx_border_edge();
border.right = xlsx_border_edge();
border.top = xlsx_border_edge();
border.bottom = xlsx_border_edge();
border.left = xlsx_border_edge();
border.right = xlsx_border_edge();
border.top = xlsx_border_edge();
border.bottom = xlsx_border_edge();
if (cellProp)
{
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.top, odfBordersAttr.fo_border_);
process_border(*border.bottom, odfBordersAttr.fo_border_);
process_border(*border.left, odfBordersAttr.fo_border_left_);
process_border(*border.right, odfBordersAttr.fo_border_right_);
process_border(*border.top, odfBordersAttr.fo_border_top_);
process_border(*border.bottom, odfBordersAttr.fo_border_bottom_);
process_border(*border.left, odfBordersAttr.fo_border_left_);
process_border(*border.right, odfBordersAttr.fo_border_right_);
process_border(*border.top, odfBordersAttr.fo_border_top_);
process_border(*border.bottom, odfBordersAttr.fo_border_bottom_);
if (check_border(cellProp->style_diagonal_bl_tr_))
{
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;
}
......@@ -128,7 +130,8 @@ public:
{
if (!border.diagonal)
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;
}
}
......@@ -199,7 +202,7 @@ size_t xlsx_borders::size() const
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);
}
......
......@@ -21,7 +21,7 @@ namespace oox {
~xlsx_borders();
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);
void xlsx_serialize(std::wostream & _Wostream);
......
......@@ -122,8 +122,8 @@ size_t xlsx_style_manager::Impl::size() const
return cellXfs_.size();
}
size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
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::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible )
......
......@@ -4,9 +4,69 @@
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)
{
std::wstring tmp = boost::algorithm::trim_copy(Value);
std::wstring tmp = boost::algorithm::trim_copy(Value);
boost::algorithm::to_lower(tmp);
if (L"none" == tmp || tmp.length() < 1)
......@@ -37,5 +97,10 @@ border_style::border_style(const std::wstring & Value) : initialized_(false), no
initialized_ = true;
}
border_style border_style::parse( const std::wstring & Value)
{
return border_style(Value);
}
}
}
......@@ -9,7 +9,9 @@ namespace cpdoccore { namespace odf_types {
class border_style
{
public:
border_style(const std::wstring & Value);
border_style(){}
border_style(const std::wstring & Value);
static border_style parse(const std::wstring & Str);
public:
bool initialized() const { return initialized_; }
......@@ -26,4 +28,10 @@ private:
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)
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-top", fo_border_top_);
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-right", fo_border_right_);
CP_APPLY_ATTR(L"fo:border", fo_border_);
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-left", fo_border_left_);
CP_APPLY_ATTR(L"fo:border-right", fo_border_right_);
}
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_ = 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_bottom_, Other.fo_border_bottom_);
_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_, Other.fo_border_);
_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_left_, Other.fo_border_left_);
_CP_APPLY_PROP(fo_border_right_, Other.fo_border_right_);
}
void common_border_attlist::serialize(CP_ATTR_NODE)
{
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-bottom", fo_border_bottom_);
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", fo_border_);
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-left", fo_border_left_);
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 )
{
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", 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-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_);
}
......@@ -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)
{
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-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-right", style_border_line_width_right_);
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-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-right", style_border_line_width_right_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -29,6 +29,7 @@
#include "stylerepeat.h"
#include "officevaluetype.h"
#include "fillimagerefpoint.h"
#include "borderstyle.h"
#define _CP_APPLY_PROP(A, B) \
if (B) \
......@@ -165,7 +166,7 @@ public:
void serialize(CP_ATTR_NODE);
public:
_CP_OPT(std::wstring) style_shadow_;
_CP_OPT(shadow_type) style_shadow_;
};
......@@ -238,20 +239,11 @@ public:
void serialize(CP_ATTR_NODE);
public:
// fo:border
_CP_OPT(std::wstring) fo_border_;
// fo:border-top
_CP_OPT(std::wstring) fo_border_top_;
// 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_;
_CP_OPT(border_style) fo_border_;
_CP_OPT(border_style) fo_border_top_;
_CP_OPT(border_style) fo_border_bottom_;
_CP_OPT(border_style) fo_border_left_;
_CP_OPT(border_style) fo_border_right_;
};
......
......@@ -144,9 +144,9 @@ _CP_OPT(border_widths) GetBorderLineWidths(const graphic_format_properties & gra
}
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);
if (borderWidths)
......@@ -154,8 +154,6 @@ _CP_OPT(length) GetConsistentBorderValue(const graphic_format_properties & graph
}
else
{
border_style borderStyle(border);
if (borderStyle.initialized())
{
if (borderStyle.is_none())
......@@ -188,8 +186,8 @@ int GetMargin(const graphic_format_properties & graphicProperties, BorderSide bo
}
int Compute_BorderWidth(const graphic_format_properties & graphicProperties, BorderSide borderSide)
{
_CP_OPT(std::wstring) borderValue;
_CP_OPT(length) lengthValue;
_CP_OPT(border_style) borderValue;
_CP_OPT(length) lengthValue;
switch(borderSide)
{
......
......@@ -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_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 (borderStyle.initialized())
if (graphicProperties.common_border_attlist_.fo_border_->initialized())
{
drawing.additional.push_back(_property(L"stroke-color", borderStyle.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-color", graphicProperties.common_border_attlist_.fo_border_->get_color().get_hex_value() ));
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::
}
void draw_enhanced_geometry::find_draw_type_oox()
{
wordArt_ = false;
if (draw_enhanced_geometry_attlist_.draw_type_)
{
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)
{
......@@ -388,6 +392,23 @@ void draw_enhanced_geometry::find_draw_type_oox()
{
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;
......
......@@ -382,9 +382,10 @@ public:
draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_;
_CP_OPT(int) sub_type_;
_CP_OPT(int) draw_type_oox_index_;
_CP_OPT(std::wstring) svg_viewbox_;
_CP_OPT(int) sub_type_;
_CP_OPT(int) draw_type_oox_index_;
_CP_OPT(std::wstring) svg_viewbox_;
bool wordArt_;
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
}
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_)
{
......
......@@ -34,7 +34,9 @@ enum ElementType
typeTextPageNumber,
typeTextPageCount,
typeTextDate,
typeTextModificationDate,
typeTextTime,
typeTextModificationTime,
typeTextFileName,
typeTextSequence,
typeTextSheetName,
......
......@@ -966,13 +966,36 @@ void text_date::add_text(const std::wstring & Text)
void text_date::docx_convert(oox::docx_conversion_context & Context)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
bool asText = 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>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)
{
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)
}
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
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_time::ns = L"text";
......@@ -1014,12 +1074,33 @@ void text_time::add_text(const std::wstring & Text)
void text_time::docx_convert(oox::docx_conversion_context & Context)
{
Context.add_new_run();
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->docx_convert(Context);
}
Context.finish_run();
bool asText = 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>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)
{
......@@ -1031,7 +1112,43 @@ void text_time::pptx_convert(oox::pptx_conversion_context & Context)
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::name = L"file-name";
......
......@@ -659,29 +659,44 @@ public:
static const ElementType type = typeTextDate;
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);
virtual void add_text(const std::wstring & Text);
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
std::wostream & text_to_stream(::std::wostream & _Wostream) const;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_date_value_;//with format
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);
// 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
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_time : public paragraph_content_element<text_time>
......@@ -693,27 +708,42 @@ public:
static const ElementType type = typeTextTime;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
virtual void docx_convert(oox::docx_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);
std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private:
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_time_value_;//with format
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);
// 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
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_file_name : public paragraph_content_element<text_file_name>
......
......@@ -274,20 +274,11 @@ public:
// 15.5.24 <style:background-image>
office_element_ptr style_background_image_;
// 15.5.25 fo:border
_CP_OPT(std::wstring) fo_border_; // +
// fo:border-top
_CP_OPT(std::wstring) fo_border_top_; // +
// 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_; // +
_CP_OPT(odf_types::border_style) fo_border_; // +
_CP_OPT(odf_types::border_style) fo_border_top_; // +
_CP_OPT(odf_types::border_style) fo_border_bottom_; // +
_CP_OPT(odf_types::border_style) fo_border_left_; // +
_CP_OPT(odf_types::border_style) fo_border_right_; // +
// 15.5.26
_CP_OPT( odf_types::border_widths ) style_border_line_width_; // +
......
......@@ -17,7 +17,7 @@ namespace odf_reader {
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(length) & borderPadding, const std::wstring & Shadow = L"")
{
......
......@@ -360,7 +360,7 @@ void insert_cell_margin(oox::docx_conversion_context & Context,
}
void insert_cell_border(oox::docx_conversion_context & Context,
const std::wstring & Side,
const std::wstring & BorderStyle,
const _CP_OPT(border_style) & BorderStyle,
const _CP_OPT(border_widths) & BorderWidths
)
{
......@@ -372,49 +372,46 @@ void insert_cell_border(oox::docx_conversion_context & Context,
bool none = false;
try
{
do
if (BorderStyle)
{
border_style borderStyle(BorderStyle);
if (borderStyle.is_none())
if (BorderStyle->is_none())
{
strm << L"<w:" << Side << " ";
strm << L"w:val=\"none\" ";
strm << L"/>";
none = true;
break;
}
w_color = borderStyle.get_color().get_hex_value();
if (borderStyle.get_style() == L"double")
{
w_val = L"double";
if (BorderWidths)
{
if (BorderWidths->get_len1().get_value_unit(length::pt) > BorderWidths->get_len3().get_value_unit(length::pt))
w_val = L"thickThinMediumGap";
else if (BorderWidths->get_len1().get_value_unit(length::pt) < BorderWidths->get_len3().get_value_unit(length::pt))
w_val = L"thinThickMediumGap";
}
}
else
w_val = L"single";
double w_sz_ = borderStyle.get_length().get_value_unit(length::pt);
//if (borderStyle.get_style() == L"double")
// w_sz_ /= 2;
w_sz_ = (int)(0.5 + 8.0 * w_sz_);
if (w_sz_ < 2.0)
w_sz_ = 2.0;
else if (w_sz_ > 96.0)
w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ );
}else
{
w_color = BorderStyle->get_color().get_hex_value();
if (BorderStyle->get_style() == L"double")
{
w_val = L"double";
if (BorderWidths)
{
if (BorderWidths->get_len1().get_value_unit(length::pt) > BorderWidths->get_len3().get_value_unit(length::pt))
w_val = L"thickThinMediumGap";
else if (BorderWidths->get_len1().get_value_unit(length::pt) < BorderWidths->get_len3().get_value_unit(length::pt))
w_val = L"thinThickMediumGap";
}
}
else
w_val = L"single";
double w_sz_ = BorderStyle->get_length().get_value_unit(length::pt);
//if (BorderStyle.get_style() == L"double")
// w_sz_ /= 2;
w_sz_ = (int)(0.5 + 8.0 * w_sz_);
if (w_sz_ < 2.0)
w_sz_ = 2.0;
else if (w_sz_ > 96.0)
w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ );
}
}
while (0);
}
catch(...)
{
......@@ -539,10 +536,10 @@ void style_table_cell_properties_attlist::docx_convert(oox::docx_conversion_cont
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"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"right", *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"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_);
}
else
{
......
This diff is collapsed.
......@@ -17,10 +17,9 @@
#include "datatypes/stylefamily.h"
#include "datatypes/style_ref.h"
#include "datatypes/textalign.h"
#include "datatypes/length.h"
#include "datatypes/lengthorpercent.h"
#include "datatypes/styleverticalrel.h"
#include "datatypes/styleverticalpos.h"
#include "datatypes/percent.h"
#include "datatypes/verticalalign.h"
#include "datatypes/pageusage.h"
#include "datatypes/tablecentering.h"
......@@ -688,11 +687,11 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
_CP_OPT(unsigned int) fo_column_count_;
_CP_OPT(odf_types::length) fo_column_gap_;
_CP_OPT(unsigned int) fo_column_count_;
_CP_OPT(odf_types::length) fo_column_gap_;
office_element_ptr style_column_sep_;
office_element_ptr_array style_column_;
office_element_ptr style_column_sep_;
office_element_ptr_array style_column_;
};
......@@ -741,8 +740,8 @@ 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);
private:
std::wstring style_style_; // default solid
public:
std::wstring style_style_; // default solid
_CP_OPT(odf_types::length) style_width_;
odf_types::percent style_height_; // default 100
odf_types::vertical_align style_vertical_align_; //default top
......@@ -768,25 +767,16 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
bool style_protect_; // default false
// 15.7.1
odf_types::common_background_color_attlist common_background_color_attlist_;
office_element_ptr style_background_image_;
// 15.7.2
odf_types::common_background_color_attlist common_background_color_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_columns_;
// 15.7.6
bool style_protect_; // default false
office_element_ptr style_background_image_;
// 15.7.7
_CP_OPT(bool) text_dont_balance_text_columns_;
// 15.7.8
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
office_element_ptr style_columns_;
_CP_OPT(bool) text_dont_balance_text_columns_;
// 15.7.9
// TODO text-notes-configuration
......@@ -876,10 +866,10 @@ public:
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
style_page_layout_attlist style_page_layout_attlist_;
office_element_ptr style_page_layout_properties_;
office_element_ptr style_header_style_;
office_element_ptr style_footer_style_;
style_page_layout_attlist style_page_layout_attlist_;
office_element_ptr style_page_layout_properties_;
office_element_ptr style_header_style_;
office_element_ptr style_footer_style_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -896,7 +886,8 @@ class style_page_layout_properties_attlist
public:
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);
public:
......@@ -907,18 +898,14 @@ public:
_CP_OPT(std::wstring) style_paper_tray_name_;
_CP_OPT(std::wstring) style_print_orientation_; // +
//15.2.5
odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_;
odf_types::common_vertical_margin_attlist common_vertical_margin_attlist_;
odf_types::common_margin_attlist common_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_margin_attlist common_margin_attlist_;
// 15.2.6
odf_types::common_border_attlist common_border_attlist_;
// 15.2.7
odf_types::common_border_attlist common_border_attlist_;
odf_types::common_border_line_width_attlist common_border_line_width_attlist_;
// 15.2.8
odf_types::common_padding_attlist common_padding_attlist_;
// 15.2.9
odf_types::common_shadow_attlist common_shadow_attlist_;
odf_types::common_padding_attlist common_padding_attlist_;
odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.10
odf_types::common_background_color_attlist common_background_color_attlist_;
......@@ -1018,8 +1005,8 @@ public:
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
public:
office_element_ptr style_background_image_;
office_element_ptr style_columns_;
office_element_ptr style_background_image_;
office_element_ptr style_columns_;
// 15.2.20
office_element_ptr style_footnote_sep_;
......@@ -1056,8 +1043,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_;
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
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
bool wasPar = false;
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
{
if (elm->get_type() == typeTextP ||
elm->get_type() == typeTextH)
ElementType type = elm->get_type();
if (type == typeTextP || type== typeTextH)
wasPar = true;
elm->docx_convert(Context);
}
return wasPar;
......
......@@ -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
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_table_of_content::ns = L"text";
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
// 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:
CP_REGISTER_OFFICE_ELEMENT2(text_section_source);
// text:table-of-content
// text-table-of-content
//////////////////////////////////////////////////////////////////////////////////////////////////
class text_table_of_content : public text_content_impl<text_table_of_content>
{
......@@ -308,16 +307,76 @@ private:
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_of_content_source_;
office_element_ptr text_index_body_;
text_section_attr text_section_attr_;
office_element_ptr text_table_of_content_source_;
office_element_ptr text_index_body_;
};
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
//////////////////////////////////////////////////////////////////////////////////////////////////
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