mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
.....
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57412 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
1d4055125d
commit
d5a5a05a75
@ -165,7 +165,7 @@ public:
|
||||
void serialize(CP_ATTR_NODE);
|
||||
|
||||
public:
|
||||
_CP_OPT(shadow_type) style_shadow_;
|
||||
_CP_OPT(std::wstring) style_shadow_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
|
||||
std::wstring w_shadow;
|
||||
|
||||
if (style_shadow_)
|
||||
w_shadow = style_shadow_->get_type() != shadow_type::None ? L"1" : L"0";
|
||||
w_shadow = style_shadow_->length()>0 ! ? L"1" : L"0"; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
std::wstring w_top, w_left, w_right, w_bottom, w_between;
|
||||
|
||||
|
||||
@ -30,8 +30,22 @@ namespace cpdoccore
|
||||
namespace odf
|
||||
{
|
||||
|
||||
struct odf_group_state;
|
||||
typedef shared_ptr<odf_group_state>::Type odf_group_state_ptr;
|
||||
|
||||
struct odf_group_state
|
||||
{
|
||||
odf_group_state(office_element_ptr elm_, int level_, odf_group_state_ptr prev)
|
||||
{
|
||||
delta_x = delta_y = rotate = 0;
|
||||
koef_cx = koef_cy = 1.;
|
||||
flipH = flipV = false;
|
||||
|
||||
elm = elm_;
|
||||
level = level_;
|
||||
|
||||
prev_group = prev;
|
||||
}
|
||||
office_element_ptr elm;
|
||||
|
||||
int level;
|
||||
@ -46,6 +60,8 @@ struct odf_group_state
|
||||
|
||||
bool flipH;
|
||||
bool flipV;
|
||||
|
||||
odf_group_state_ptr prev_group;
|
||||
};
|
||||
|
||||
struct anchor_settings
|
||||
@ -131,6 +147,7 @@ struct odf_drawing_state
|
||||
oox_shape_preset = -1;
|
||||
|
||||
in_group = false;
|
||||
|
||||
}
|
||||
std::vector<odf_element_state> elements_;
|
||||
|
||||
@ -185,8 +202,9 @@ public:
|
||||
|
||||
graphic_format_properties preset_graphic_format_properties;
|
||||
|
||||
std::vector<odf_group_state> group_list_; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<odf_drawing_state> drawing_list_; //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>) .. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
odf_group_state_ptr current_group_;
|
||||
std::vector<odf_group_state_ptr> group_list_; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<odf_drawing_state> drawing_list_; //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>) .. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
|
||||
office_element_ptr root_element_;
|
||||
|
||||
@ -218,8 +236,11 @@ void odf_drawing_context::start_group(std::wstring name, int id)
|
||||
|
||||
int level = impl_->current_level_.size();
|
||||
|
||||
odf_group_state group_state = {group_elm, level, 0, 0, 1., 1., false, false};
|
||||
|
||||
odf_group_state_ptr group_state = boost::shared_ptr<odf_group_state>(new odf_group_state(group_elm, level,impl_->current_group_));
|
||||
impl_->group_list_.push_back(group_state);
|
||||
|
||||
impl_->current_group_ = impl_->group_list_.back();
|
||||
|
||||
if (impl_->current_level_.size()>0)
|
||||
impl_->current_level_.back()->add_child_element(group_elm);
|
||||
@ -235,6 +256,9 @@ void odf_drawing_context::start_group(std::wstring name, int id)
|
||||
}
|
||||
void odf_drawing_context::end_group()
|
||||
{
|
||||
if (impl_->group_list_.size() < 1)return;
|
||||
|
||||
impl_->current_group_ = impl_->group_list_.back()->prev_group;
|
||||
impl_->current_level_.pop_back();
|
||||
}
|
||||
|
||||
@ -242,55 +266,72 @@ void odf_drawing_context::set_group_size_koef( double cx, double cy)
|
||||
{
|
||||
if (impl_->group_list_.size()<1)return;
|
||||
|
||||
for (long i = impl_->group_list_.size()-1; i>=0; i--)
|
||||
odf_group_state_ptr gr = impl_->current_group_;
|
||||
// <20><> 2 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> !!! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int step = 2;
|
||||
while (gr && step > 0)
|
||||
{
|
||||
cx *= impl_->group_list_[i].koef_cx;
|
||||
cy *= impl_->group_list_[i].koef_cy;
|
||||
cx *= gr->koef_cx;
|
||||
cy *= gr->koef_cy;
|
||||
|
||||
if (impl_->group_list_[i].level <1) break;
|
||||
gr = gr->prev_group;
|
||||
step--;
|
||||
}
|
||||
impl_->group_list_.back().koef_cx = cx;
|
||||
impl_->group_list_.back().koef_cy = cy;
|
||||
impl_->group_list_.back()->koef_cx = cx;
|
||||
impl_->group_list_.back()->koef_cy = cy;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_group_position_delta(double x_pt, double y_pt)
|
||||
{
|
||||
if (impl_->group_list_.size()<1)return;
|
||||
|
||||
for (long i = impl_->group_list_.size()-1; i>=0; i--)
|
||||
odf_group_state_ptr gr = impl_->current_group_;
|
||||
|
||||
int step = 2;
|
||||
while (gr && step > 0)
|
||||
{
|
||||
x_pt += impl_->group_list_[i].delta_x;
|
||||
y_pt += impl_->group_list_[i].delta_y;
|
||||
x_pt += gr->delta_x;
|
||||
y_pt += gr->delta_y;
|
||||
|
||||
if (impl_->group_list_[i].level <1) break;
|
||||
gr = gr->prev_group;
|
||||
step--;
|
||||
}
|
||||
impl_->group_list_.back().delta_x = x_pt;
|
||||
impl_->group_list_.back().delta_y = y_pt;
|
||||
impl_->group_list_.back()->delta_x = x_pt;
|
||||
impl_->group_list_.back()->delta_y = y_pt;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_group_flip_H(bool bVal)
|
||||
{
|
||||
if (impl_->group_list_.size()<1)return;
|
||||
|
||||
for (long i = impl_->group_list_.size()-1; i>=0; i--)
|
||||
{
|
||||
bVal += impl_->group_list_[i].flipH;
|
||||
odf_group_state_ptr gr = impl_->current_group_;
|
||||
|
||||
if (impl_->group_list_[i].level <1) break;
|
||||
int step = 2;
|
||||
while (gr && step > 0)
|
||||
{
|
||||
bVal += gr->flipH;
|
||||
gr = gr->prev_group;
|
||||
step--;
|
||||
}
|
||||
impl_->group_list_.back().flipH= bVal;
|
||||
|
||||
impl_->group_list_.back()->flipH= bVal;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_group_flip_V(bool bVal)
|
||||
{
|
||||
if (impl_->group_list_.size()<1)return;
|
||||
|
||||
for (long i = impl_->group_list_.size()-1; i>=0; i--)
|
||||
{
|
||||
bVal += impl_->group_list_[i].flipV;
|
||||
odf_group_state_ptr gr = impl_->current_group_;
|
||||
|
||||
if (impl_->group_list_[i].level <1) break;
|
||||
int step = 2;
|
||||
while (gr && step > 0)
|
||||
{
|
||||
bVal += gr->flipV;
|
||||
gr = gr->prev_group;
|
||||
step--;
|
||||
}
|
||||
impl_->group_list_.back().flipV= bVal;
|
||||
|
||||
impl_->group_list_.back()->flipV= bVal;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_group_rotate(int iVal)
|
||||
@ -299,19 +340,20 @@ void odf_drawing_context::set_group_rotate(int iVal)
|
||||
|
||||
double dRotate = (360 - iVal/60000.)/180. * 3.14159265358979323846;
|
||||
|
||||
for (long i = impl_->group_list_.size()-1; i>=0; i--)
|
||||
odf_group_state_ptr gr = impl_->current_group_;
|
||||
|
||||
int step = 2;
|
||||
while (gr && step > 0)
|
||||
{
|
||||
dRotate += impl_->group_list_[i].rotate;
|
||||
|
||||
if (impl_->group_list_[i].level <1) break;
|
||||
dRotate += gr->rotate;
|
||||
gr = gr->prev_group;
|
||||
step--;
|
||||
}
|
||||
impl_->group_list_.back().rotate = dRotate;
|
||||
|
||||
impl_->group_list_.back()->rotate = dRotate;
|
||||
}
|
||||
|
||||
void odf_drawing_context::clear()
|
||||
{
|
||||
|
||||
impl_->root_element_ = office_element_ptr();
|
||||
|
||||
impl_->anchor_settings_.clear();
|
||||
@ -350,7 +392,7 @@ void odf_drawing_context::end_drawing()
|
||||
std::wstring strTransform;
|
||||
if (impl_->current_drawing_state_.in_group && impl_->group_list_.size()>0)
|
||||
{
|
||||
double rotate = impl_->group_list_.back().rotate;
|
||||
double rotate = impl_->group_list_.back()->rotate;
|
||||
if (impl_->current_drawing_state_.rotateAngle )
|
||||
rotate += *impl_->current_drawing_state_.rotateAngle;
|
||||
|
||||
@ -372,10 +414,8 @@ void odf_drawing_context::end_drawing()
|
||||
impl_->current_drawing_state_.svg_y_ = boost::none;
|
||||
}else if (impl_->current_drawing_state_.in_group)
|
||||
{
|
||||
strTransform += std::wstring(L"translate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_x_.get() +
|
||||
(impl_->current_drawing_state_.svg_width_.get()/2))+ std::wstring(L",") +
|
||||
boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_y_.get() +
|
||||
(impl_->current_drawing_state_.svg_height_.get()/2))+ std::wstring(L")") ;
|
||||
strTransform += std::wstring(L"translate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_x_.get())
|
||||
+ std::wstring(L",") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_y_.get()) + std::wstring(L")") ;
|
||||
impl_->current_drawing_state_.svg_x_ = boost::none;
|
||||
impl_->current_drawing_state_.svg_y_ = boost::none;
|
||||
}
|
||||
@ -932,19 +972,21 @@ void odf_drawing_context::set_wrap_style(style_wrap::type type)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void odf_drawing_context::set_position(double x_pt, double y_pt)
|
||||
{
|
||||
x_pt*=20;
|
||||
y_pt*=20;
|
||||
if (impl_->group_list_.size() < 1)return;
|
||||
|
||||
if (!impl_->current_drawing_state_.svg_x_)
|
||||
{
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
x_pt += impl_->group_list_.back().delta_x;
|
||||
x_pt += impl_->group_list_.back()->delta_x;
|
||||
|
||||
impl_->current_drawing_state_.svg_x_ = length(length(x_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
if (!impl_->current_drawing_state_.svg_y_)
|
||||
{
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
y_pt += impl_->group_list_.back().delta_y;
|
||||
y_pt += impl_->group_list_.back()->delta_y;
|
||||
|
||||
impl_->current_drawing_state_.svg_y_ = length(length(y_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
@ -960,8 +1002,8 @@ void odf_drawing_context::set_size( double width_pt, double height_pt)
|
||||
{
|
||||
if (impl_->current_drawing_state_.in_group)
|
||||
{
|
||||
width_pt *= impl_->group_list_.back().koef_cx;
|
||||
height_pt *= impl_->group_list_.back().koef_cy;
|
||||
width_pt *= impl_->group_list_.back()->koef_cx;
|
||||
height_pt *= impl_->group_list_.back()->koef_cy;
|
||||
}
|
||||
//if (!impl_->current_drawing_state_.svg_width_)
|
||||
if (width_pt >= 0) impl_->current_drawing_state_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
@ -1213,9 +1255,9 @@ void odf_drawing_context::finalize(office_element_ptr & root_elm)//
|
||||
{
|
||||
for (int i=0; i< impl_->group_list_.size(); i++)
|
||||
{
|
||||
if (impl_->group_list_[i].level ==0 )
|
||||
if (impl_->group_list_[i]->level ==0 )
|
||||
{
|
||||
root_elm->add_child_element(impl_->group_list_[i].elm);
|
||||
root_elm->add_child_element(impl_->group_list_[i]->elm);
|
||||
}
|
||||
}
|
||||
for (int i=0; i< impl_->drawing_list_.size(); i++)
|
||||
|
||||
@ -59,8 +59,11 @@ void odf_page_layout_context::create_master_page(std::wstring oox_name)
|
||||
//default layout
|
||||
create_layout_page();
|
||||
master_state_list_.back().set_layout_name(layout_state_list_.back().get_name());
|
||||
}
|
||||
|
||||
|
||||
void odf_page_layout_context::set_current_master_page_base()
|
||||
{
|
||||
style_context_->set_current_master_page_base();
|
||||
}
|
||||
|
||||
void odf_page_layout_context::set_styles_context(odf_style_context * Context)
|
||||
@ -129,6 +132,36 @@ void odf_page_layout_context::set_page_margin(_CP_OPT(length) top, _CP_OPT(lengt
|
||||
// props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_right_ =
|
||||
// length(footer->get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
void odf_page_layout_context::set_page_gutter(_CP_OPT(length) length_)
|
||||
{
|
||||
if (!length_) return;
|
||||
|
||||
|
||||
}
|
||||
void odf_page_layout_context::set_page_border_shadow(bool val)
|
||||
{
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
props->style_page_layout_properties_attlist_.common_shadow_attlist_.style_shadow_ = L"#000000 0.159cm 0.159cm";
|
||||
}
|
||||
void odf_page_layout_context::set_page_border(std::wstring top, std::wstring left, std::wstring bottom, std::wstring right)
|
||||
{
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
if (bottom == top && top == left && left== right && bottom.length() > 0)
|
||||
{
|
||||
props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_ = left;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bottom.length() >0 )props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom;
|
||||
if (top.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_top_ = top;
|
||||
if (left.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_left_ = left;
|
||||
if (right.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_right_ = right;
|
||||
}
|
||||
}
|
||||
void odf_page_layout_context::set_page_size(_CP_OPT(length) width, _CP_OPT(length) height)
|
||||
{
|
||||
style_page_layout_properties * props = get_properties();
|
||||
|
||||
@ -31,9 +31,14 @@ public:
|
||||
|
||||
void set_page_margin(_CP_OPT(double) top, _CP_OPT(double) left, _CP_OPT(double) bottom, _CP_OPT(double) right, _CP_OPT(double) header, _CP_OPT(double) footer);
|
||||
void set_page_margin(_CP_OPT(length) top, _CP_OPT(length) left, _CP_OPT(length) bottom, _CP_OPT(length) right);
|
||||
void set_page_gutter(_CP_OPT(length) length_);
|
||||
void set_page_border(std::wstring top, std::wstring left, std::wstring bottom, std::wstring right);
|
||||
void set_page_border_shadow(bool val);
|
||||
void set_page_orientation(int type);
|
||||
void set_page_size(_CP_OPT(length) width, _CP_OPT(length) height);
|
||||
|
||||
void set_current_master_page_base();
|
||||
|
||||
private:
|
||||
|
||||
style_page_layout_properties *get_properties();
|
||||
|
||||
@ -90,6 +90,12 @@ void odf_style_context::add_master_style(office_element_ptr & elm)
|
||||
|
||||
}
|
||||
|
||||
void odf_style_context::set_current_master_page_base()
|
||||
{
|
||||
master_style_list_.insert(master_style_list_.begin(), master_style_list_.back());
|
||||
master_style_list_.pop_back();
|
||||
}
|
||||
|
||||
void odf_style_context::create_default_style(const style_family family)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
|
||||
@ -33,6 +33,7 @@ public:
|
||||
|
||||
void add_style(office_element_ptr elm, bool automatic = false, bool root = false, style_family style_family=style_family::None);
|
||||
void add_master_style(office_element_ptr & elm);
|
||||
void set_current_master_page_base();
|
||||
|
||||
office_element_ptr & add_or_find(std::wstring name, const style_family family, bool automatic = false, bool root = false, int id = -1);
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ public:
|
||||
_CP_OPT(length) fo_padding_right_; // +
|
||||
|
||||
// 15.5.28 style:shadow
|
||||
_CP_OPT(shadow_type) style_shadow_;
|
||||
_CP_OPT(std::wstring) style_shadow_;
|
||||
|
||||
// 15.5.29 fo:keep-with-next
|
||||
_CP_OPT(keep_together) fo_keep_with_next_; // +
|
||||
|
||||
@ -42,7 +42,7 @@ DocxConverter::DocxConverter(const std::wstring & path, const ProgressCallback*
|
||||
//set flags to default
|
||||
m_bKeepNextParagraph = false;
|
||||
|
||||
if (UpdateProgress(400000))return;
|
||||
if (UpdateProgress(290000))return;
|
||||
}
|
||||
void DocxConverter::write(const std::wstring & path)
|
||||
{
|
||||
@ -120,8 +120,10 @@ void DocxConverter::convertDocument()
|
||||
odt_context->start_document();
|
||||
|
||||
convert_styles();
|
||||
if (UpdateProgress(500000))return;
|
||||
if (UpdateProgress(300000))return;
|
||||
|
||||
convert_settings();
|
||||
|
||||
convert_document();
|
||||
|
||||
if (UpdateProgress(800000))return;
|
||||
@ -139,6 +141,7 @@ void DocxConverter::convert_document()
|
||||
if (!document)return;
|
||||
|
||||
convert(document->m_oBackground.GetPointer());//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
for ( int nIndex = 0; nIndex < document->m_arrItems.GetSize(); nIndex++ )
|
||||
{
|
||||
convert(document->m_arrItems[nIndex]);
|
||||
@ -152,6 +155,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
|
||||
switch(oox_unknown->getType())
|
||||
{
|
||||
case OOX::et_w_sdt:
|
||||
{
|
||||
OOX::Logic::CSdt* pP= static_cast<OOX::Logic::CSdt*>(oox_unknown);
|
||||
convert(pP);
|
||||
}break;
|
||||
case OOX::et_w_r:
|
||||
{
|
||||
OOX::Logic::CRun* pRun= static_cast<OOX::Logic::CRun*>(oox_unknown);
|
||||
@ -243,7 +251,21 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
void DocxConverter::convert(OOX::Logic::CSdt *oox_sdt)
|
||||
{
|
||||
if (oox_sdt == NULL) return;
|
||||
//nullable<OOX::Logic::CSdtEndPr > m_oSdtEndPr;
|
||||
//nullable<OOX::Logic::CSdtPr > m_oSdtPr;
|
||||
|
||||
if (oox_sdt->m_oSdtContent.IsInit())
|
||||
{
|
||||
for (long i=0; i< oox_sdt->m_oSdtContent->m_arrItems.GetSize(); i++)
|
||||
{
|
||||
convert(oox_sdt->m_oSdtContent->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
{
|
||||
if (oox_paragraph == NULL) return;
|
||||
|
||||
@ -582,13 +604,13 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
{
|
||||
if (oox_section_pr == NULL) return;
|
||||
|
||||
odt_context->page_layout_context()->create_master_page(L"");
|
||||
odt_context->page_layout_context()->create_master_page(root ? L"Standart" : L"");
|
||||
|
||||
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master().get_name());
|
||||
|
||||
if (oox_section_pr->m_oPgMar.IsInit())
|
||||
{
|
||||
_CP_OPT(odf::length) top, left, right, bottom;
|
||||
_CP_OPT(odf::length) top, left, right, bottom, other;
|
||||
convert(oox_section_pr->m_oPgMar->m_oBottom.GetPointer(), bottom);
|
||||
convert(oox_section_pr->m_oPgMar->m_oLeft.GetPointer() , left);
|
||||
convert(oox_section_pr->m_oPgMar->m_oRight.GetPointer() , right);
|
||||
@ -596,11 +618,42 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
|
||||
odt_context->page_layout_context()->set_page_margin(top,left,bottom, right);
|
||||
|
||||
convert(oox_section_pr->m_oPgMar->m_oGutter.GetPointer(), other);
|
||||
odt_context->page_layout_context()->set_page_gutter(other);
|
||||
|
||||
//nullable<SimpleTypes::CTwipsMeasure > m_oFooter;
|
||||
//nullable<SimpleTypes::CTwipsMeasure > m_oGutter;
|
||||
//nullable<SimpleTypes::CTwipsMeasure > m_oHeader;
|
||||
}
|
||||
if (oox_section_pr->m_oPgBorders.IsInit())
|
||||
{
|
||||
std::wstring top, left, right, bottom;
|
||||
convert(oox_section_pr->m_oPgBorders->m_oBottom.GetPointer(), bottom);
|
||||
convert(oox_section_pr->m_oPgBorders->m_oLeft.GetPointer() , left);
|
||||
convert(oox_section_pr->m_oPgBorders->m_oRight.GetPointer() , right);
|
||||
convert(oox_section_pr->m_oPgBorders->m_oTop.GetPointer() , top);
|
||||
|
||||
odt_context->page_layout_context()->set_page_border(top,left,bottom, right);
|
||||
|
||||
bool shadow = false;
|
||||
if (oox_section_pr->m_oPgBorders->m_oBottom.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oShadow->ToBool()) shadow = true;
|
||||
if (oox_section_pr->m_oPgBorders->m_oTop.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oShadow->ToBool()) shadow = true;
|
||||
if (oox_section_pr->m_oPgBorders->m_oLeft.IsInit() && oox_section_pr->m_oPgBorders->m_oLeft->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oLeft->m_oShadow->ToBool()) shadow = true;
|
||||
if (oox_section_pr->m_oPgBorders->m_oRight.IsInit() && oox_section_pr->m_oPgBorders->m_oRight->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oRight->m_oShadow->ToBool()) shadow = true;
|
||||
|
||||
if (shadow) odt_context->page_layout_context()->set_page_border_shadow(true);
|
||||
|
||||
if (oox_section_pr->m_oPgBorders->m_oDisplay.IsInit())
|
||||
{
|
||||
// todooo
|
||||
//pageborderdisplayAllPages = 0,
|
||||
//pageborderdisplayFirstPage = 1,
|
||||
//pageborderdisplayNotFirstPage = 2
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
//nullable<SimpleTypes::CPageBorderOffset<> > m_oOffsetFrom;
|
||||
//nullable<SimpleTypes::CPageBorderZOrder<> > m_oZOrder;
|
||||
|
||||
}
|
||||
if (oox_section_pr->m_oPgSz.IsInit())
|
||||
{
|
||||
if (oox_section_pr->m_oPgSz->m_oOrient.IsInit())
|
||||
@ -612,6 +665,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
convert(oox_section_pr->m_oPgSz->m_oH.GetPointer(), height);
|
||||
|
||||
odt_context->page_layout_context()->set_page_size(width, height);
|
||||
|
||||
//nullable<SimpleTypes::CDecimalNumber<> > m_oCode;
|
||||
}
|
||||
//nullable<ComplexTypes::Word::CTextDirection > m_oTextDirection;
|
||||
@ -696,6 +750,9 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
|
||||
if (root) odt_context->flush_section();
|
||||
}
|
||||
|
||||
|
||||
if (root)odt_context->page_layout_context()->set_current_master_page_base();
|
||||
}
|
||||
void DocxConverter::convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf::style_paragraph_properties * paragraph_properties)
|
||||
{
|
||||
@ -758,7 +815,7 @@ void DocxConverter::convert(OOX::Logic::CTcBorders *oox_border, odf::style_tabl
|
||||
convert(oox_border->m_oBottom.GetPointer() , bottom);
|
||||
convert(oox_border->m_oTop.GetPointer() , top);
|
||||
convert(oox_border->m_oStart.GetPointer() , left);
|
||||
convert(oox_border->m_oEnd.GetPointer() , right);
|
||||
convert(oox_border->m_oEnd.GetPointer() , right);
|
||||
|
||||
if (bottom == top && top == left && left== right && bottom.length() > 0)
|
||||
{
|
||||
@ -807,7 +864,16 @@ void DocxConverter::convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_
|
||||
if (left.length() >0 ) paragraph_properties->content().common_border_attlist_.fo_border_left_ = left;
|
||||
if (right.length() >0 ) paragraph_properties->content().common_border_attlist_.fo_border_right_ = right;
|
||||
}
|
||||
|
||||
bool shadow = false;
|
||||
if (oox_border->m_oBottom.IsInit() && oox_border->m_oBottom->m_oShadow.IsInit() && oox_border->m_oBottom->m_oShadow->ToBool()) shadow = true;
|
||||
if (oox_border->m_oTop.IsInit() && oox_border->m_oTop->m_oShadow.IsInit() && oox_border->m_oTop->m_oShadow->ToBool()) shadow = true;
|
||||
if (oox_border->m_oLeft.IsInit() && oox_border->m_oLeft->m_oShadow.IsInit() && oox_border->m_oLeft->m_oShadow->ToBool()) shadow = true;
|
||||
if (oox_border->m_oRight.IsInit() && oox_border->m_oRight->m_oShadow.IsInit() && oox_border->m_oRight->m_oShadow->ToBool()) shadow = true;
|
||||
|
||||
if (shadow)
|
||||
{
|
||||
paragraph_properties->content().style_shadow_ = L"#000000 0.159cm 0.159cm";
|
||||
}
|
||||
//if (oox_border->m_oTL2BR.IsInit())
|
||||
//{
|
||||
// convert(oox_border->m_oTL2BR.GetPointer(), odf_border);
|
||||
@ -815,18 +881,72 @@ void DocxConverter::convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_
|
||||
//}
|
||||
|
||||
}
|
||||
void DocxConverter::convert(ComplexTypes::Word::CPageBorder *borderProp, std::wstring & odf_border_prop)
|
||||
{
|
||||
odf_border_prop = L"";
|
||||
if (!borderProp)return;
|
||||
|
||||
//nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse> > m_oFrame;
|
||||
//nullable<SimpleTypes::CPointMeasure<> > m_oSpace;
|
||||
|
||||
std::wstringstream border_style;
|
||||
std::wstring border_color;
|
||||
|
||||
odf::length length;
|
||||
length = odf::length(borderProp->m_oSz.IsInit() ? borderProp->m_oSz->ToPoints() : 1 , odf::length::pt);
|
||||
|
||||
length = odf::length( length.get_value_unit(odf::length::cm), odf::length::cm);
|
||||
border_style << length;
|
||||
if (borderProp->m_oVal.IsInit())//266 styles oO
|
||||
{
|
||||
switch(borderProp->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::bordervalueDotDash:
|
||||
border_style << L" dashed";
|
||||
break;
|
||||
case SimpleTypes::bordervalueDashed:
|
||||
border_style << L" dashed";
|
||||
break;
|
||||
case SimpleTypes::bordervalueDotted:
|
||||
border_style << L" dotted";
|
||||
break;
|
||||
case SimpleTypes::bordervalueDouble:
|
||||
border_style << L" double";
|
||||
break;
|
||||
case SimpleTypes::bordervalueSingle:
|
||||
border_style << L" solid";
|
||||
break;
|
||||
case SimpleTypes::bordervalueNone:
|
||||
odf_border_prop == L"none";
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}else border_style << L" solid";
|
||||
///////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(odf::color) color;
|
||||
|
||||
if (borderProp->m_oColor.IsInit())
|
||||
{
|
||||
if (borderProp->m_oColor->GetValue() != SimpleTypes::hexcolorAuto)
|
||||
convert(borderProp->m_oColor.GetPointer(), borderProp->m_oThemeColor.GetPointer(), borderProp->m_oThemeTint.GetPointer(),borderProp->m_oThemeShade.GetPointer(), color);
|
||||
}
|
||||
if (color) border_color = color->get_hex_value();
|
||||
else border_color = L"000000";
|
||||
|
||||
odf_border_prop = border_style.str() + L" #" + border_color;
|
||||
}
|
||||
void DocxConverter::convert(ComplexTypes::Word::CBorder *borderProp, std::wstring & odf_border_prop)
|
||||
{
|
||||
odf_border_prop = L"";
|
||||
if (!borderProp)return;
|
||||
|
||||
std::wstringstream border_style;
|
||||
std::wstring border_color;
|
||||
//nullable<SimpleTypes::COnOff<> > m_oFrame;
|
||||
//nullable<SimpleTypes::COnOff<> > m_oShadow;
|
||||
//nullable<SimpleTypes::CPointMeasure<> > m_oSpace;
|
||||
//nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeShade;
|
||||
|
||||
std::wstringstream border_style;
|
||||
std::wstring border_color;
|
||||
|
||||
odf::length length;
|
||||
length = odf::length(borderProp->m_oSz.IsInit() ? borderProp->m_oSz->ToPoints() : 1 , odf::length::pt);
|
||||
|
||||
@ -1548,6 +1668,30 @@ void DocxConverter::convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf::colo
|
||||
if (!color)return;
|
||||
convert(color->m_oVal.GetPointer(), color->m_oThemeColor.GetPointer(),color->m_oThemeTint.GetPointer(),color->m_oThemeShade.GetPointer(), odf_color);
|
||||
}
|
||||
void DocxConverter::convert_settings()
|
||||
{
|
||||
if (!odt_context) return;
|
||||
OOX::CSettings * docx_settings = docx_document->GetSettings();
|
||||
|
||||
if (!docx_settings) return;
|
||||
|
||||
if (docx_settings->m_oZoom.IsInit())
|
||||
{
|
||||
}
|
||||
if (docx_settings->m_oMirrorMargins.IsInit())
|
||||
{
|
||||
}
|
||||
|
||||
if (docx_settings->m_oPrintTwoOnOne.IsInit())
|
||||
{
|
||||
if (docx_settings->m_oGutterAtTop.IsInit()){} //portrait
|
||||
else {}//landscape
|
||||
}
|
||||
//nullable<ComplexTypes::Word::CLanguage> m_oThemeFontLang;
|
||||
//nullable<OOX::Settings::CEdnDocProps> m_oEndnotePr;
|
||||
//nullable<OOX::Settings::CCaptions> m_oCaptions;
|
||||
//m_oFootnotePr;
|
||||
}
|
||||
void DocxConverter::convert_styles()
|
||||
{
|
||||
if (!odt_context) return;
|
||||
|
||||
@ -46,6 +46,7 @@ namespace OOX
|
||||
class CTableRowProperties;
|
||||
class CTcBorders;
|
||||
class CTblBorders;
|
||||
class CSdt;
|
||||
|
||||
}
|
||||
|
||||
@ -60,6 +61,7 @@ namespace ComplexTypes
|
||||
class CShading;
|
||||
class CFramePr;
|
||||
class CTblWidth;
|
||||
class CPageBorder;
|
||||
}
|
||||
}
|
||||
namespace cpdoccore
|
||||
@ -102,8 +104,10 @@ namespace Oox2Odf
|
||||
|
||||
void convert_document();
|
||||
void convert_styles();
|
||||
void convert_settings();
|
||||
void convert_comment(int oox_comm_id);
|
||||
|
||||
void convert(OOX::Logic::CSdt *oox_sdt);
|
||||
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root = false);
|
||||
void convert(OOX::Logic::CParagraph *oox_paragraph);
|
||||
void convert(OOX::Logic::CRun *oox_run);
|
||||
@ -135,6 +139,7 @@ namespace Oox2Odf
|
||||
void convert(ComplexTypes::Word::CTblWidth *oox_size, _CP_OPT(odf::length) & odf_size);
|
||||
void convert(ComplexTypes::Word::CJc *oox_jc, _CP_OPT(odf::text_align) & align);
|
||||
void convert(ComplexTypes::Word::CBorder *borderProp, std::wstring & odf_border_prop);
|
||||
void convert(ComplexTypes::Word::CPageBorder *borderProp, std::wstring & odf_border_prop);
|
||||
|
||||
void convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_properties *paragraph_properties);
|
||||
void convert(OOX::Logic::CTcBorders *oox_border, odf::style_table_cell_properties *table_cell_properties);
|
||||
|
||||
Reference in New Issue
Block a user