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

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57412 954022d7-b5bf-4e40-9824-e11837661b57
parent 1d405512
......@@ -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"; // -
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,7 +202,8 @@ public:
graphic_format_properties preset_graphic_format_properties;
std::vector<odf_group_state> group_list_; //
odf_group_state_ptr current_group_;
std::vector<odf_group_state_ptr> group_list_; //
std::vector<odf_drawing_state> drawing_list_; // ( ) .. ""
office_element_ptr root_element_;
......@@ -218,9 +236,12 @@ 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_;
// 2 !!! - 1,
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--)
{
dRotate += impl_->group_list_[i].rotate;
odf_group_state_ptr gr = impl_->current_group_;
if (impl_->group_list_[i].level <1) break;
int step = 2;
while (gr && step > 0)
{
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_; // +
......
......@@ -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);
......
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