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

Xls, Odt - правка багов по результатам тестирования

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68683 954022d7-b5bf-4e40-9824-e11837661b57
parent 67108f22
...@@ -588,18 +588,90 @@ void docx_conversion_context::start_process_style_content() ...@@ -588,18 +588,90 @@ void docx_conversion_context::start_process_style_content()
styles_context_.start(); styles_context_.start();
} }
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns * columns)
{
int count_columns = 1;
bool sep_columns = false;
oox::section_context::_section & section = get_section_context().get();
if (columns)
{
if ((columns->fo_column_count_) && (*columns->fo_column_count_ > 1))
{
count_columns = *columns->fo_column_count_;
}
if (odf_reader::style_column_sep * columns_sep = dynamic_cast<odf_reader::style_column_sep *>( columns->style_column_sep_.get() ))
{
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
if (const odf_reader::style_instance * secStyle = root()->odf_context().styleContainer().style_by_name(section.style_, odf_types::style_family::Section, process_headers_footers_))
{
if (const odf_reader::style_content * content = secStyle->content())
{
if (odf_reader::style_section_properties * sectPr = content->get_style_section_properties())
{
if (odf_reader::style_columns * columns = dynamic_cast<odf_reader::style_columns *>( sectPr->style_columns_.get() ))
{
if (columns->fo_column_count_)
{
count_columns = *columns->fo_column_count_;
}
if (odf_reader::style_column_sep * columns_sep = dynamic_cast<odf_reader::style_column_sep *>( columns->style_column_sep_.get() ))
{
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
section.margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
section.margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
}
}
if (section.is_dump_)
{
get_section_context().remove_section();
}
}
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:cols")
{
CP_XML_ATTR(L"w:equalWidth", L"true");
CP_XML_ATTR(L"w:num", count_columns);
CP_XML_ATTR(L"w:sep", sep_columns);
CP_XML_ATTR(L"w:space",0);
}
}
}
bool docx_conversion_context::process_page_properties(std::wostream & strm) bool docx_conversion_context::process_page_properties(std::wostream & strm)
{ {
if (is_next_dump_page_properties() || get_section_context().get().is_dump_) if (is_next_dump_page_properties() || get_section_context().get().is_dump_)
{ {
std::wstring pageProperties = get_page_properties(); std::wstring pageProperties = get_page_properties();
if (!pageProperties.empty())//??? ??? odf_reader::page_layout_instance * page_layout_instance_ = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
if (page_layout_instance_)
{ {
odf_reader::page_layout_instance * page_layout_instance_ = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties); page_layout_instance_->docx_convert_serialize(strm, *this);
}
if (page_layout_instance_) else
page_layout_instance_->docx_convert_serialize(strm,*this); {
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:sectPr")
{
process_section( CP_XML_STREAM(), NULL);
CP_XML_NODE(L"w:type")
{
CP_XML_ATTR(L"w:val", L"continuous");
}
}
}
} }
next_dump_page_properties(false); next_dump_page_properties(false);
return true; return true;
...@@ -624,8 +696,8 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str ...@@ -624,8 +696,8 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
if (get_section_context().dump_.empty() == false && !ParentId.empty()) if (get_section_context().dump_.empty() == false && (!ParentId.empty() || get_section_context().get().is_dump_))
{ {//
CP_XML_NODE(L"w:pPr") CP_XML_NODE(L"w:pPr")
{ {
CP_XML_STREAM() << get_section_context().dump_; CP_XML_STREAM() << get_section_context().dump_;
......
...@@ -23,6 +23,7 @@ namespace cpdoccore { ...@@ -23,6 +23,7 @@ namespace cpdoccore {
namespace odf_types namespace odf_types
{ {
class style_ref; class style_ref;
class length_or_percent;
} }
namespace odf_reader namespace odf_reader
{ {
...@@ -33,6 +34,7 @@ namespace odf_reader ...@@ -33,6 +34,7 @@ namespace odf_reader
class draw_shape; class draw_shape;
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr; typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
class office_element; class office_element;
class style_columns;
namespace text{ namespace text{
...@@ -222,8 +224,10 @@ public: ...@@ -222,8 +224,10 @@ public:
style_ = Style; style_ = Style;
page_properties_.push_back(PageProperties); page_properties_.push_back(PageProperties);
} }
std::wstring name_; std::wstring name_;
std::wstring style_; std::wstring style_;
_CP_OPT(odf_types::length_or_percent) margin_left_, margin_right_;
std::vector<std::wstring> page_properties_; std::vector<std::wstring> page_properties_;
...@@ -453,6 +457,8 @@ public: ...@@ -453,6 +457,8 @@ public:
bool process_page_properties(std::wostream & strm); bool process_page_properties(std::wostream & strm);
void process_headers_footers(); void process_headers_footers();
void process_comments (); void process_comments ();
void process_section (std::wostream & strm, odf_reader::style_columns * columns = NULL);
void set_settings_property(const odf_reader::_property & prop); void set_settings_property(const odf_reader::_property & prop);
std::vector<odf_reader::_property> & get_settings_properties(); std::vector<odf_reader::_property> & get_settings_properties();
......
...@@ -34,6 +34,39 @@ percent percent::parse(const std::wstring & Str) ...@@ -34,6 +34,39 @@ percent percent::parse(const std::wstring & Str)
strm >> per_; strm >> per_;
return per_; return per_;
} }
//----------------------------------------------------------------
std::wostream & operator << (std::wostream & _Wostream, const percent_rel & _percent_rel)
{
if (_percent_rel.get_value() >= 0)
_Wostream << _percent_rel.get_value() << L"*";
else
_Wostream << L"-1*";
return _Wostream;
}
std::wistream & operator >> (std::wistream & _Wistream, percent_rel & _percent_rel)
{
wchar_t p;
int val;
_Wistream >> val >> p;
if (p != L'*')
_percent_rel = percent_rel(0);
else
_percent_rel = percent_rel(val);
return _Wistream;
}
percent_rel percent_rel::parse(const std::wstring & Str)
{
percent_rel per_(0);
std::wstringstream strm;
strm << Str;
strm >> per_;
return per_;
}
} }
} }
......
...@@ -8,27 +8,44 @@ ...@@ -8,27 +8,44 @@
#include <iosfwd> #include <iosfwd>
#include "odfattributes.h" #include "odfattributes.h"
namespace cpdoccore { namespace odf_types { namespace cpdoccore {
namespace odf_types {
class percent class percent
{ {
public: public:
percent(double val = 100.0) : value_(val) percent(double val = 100.0) : value_(val)
{} {}
double get_value() const { return value_; } double get_value() const { return value_; }
static percent parse(const std::wstring & Str); static percent parse(const std::wstring & Str);
private: private:
double value_; double value_;
}; };
std::wostream & operator << (std::wostream & _Wostream, const percent & _Percent); std::wostream & operator << (std::wostream & _Wostream, const percent & _Percent);
} class percent_rel
{
public:
percent_rel(int val) : value_(val)
{}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::percent); int get_value() const { return value_; }
static percent_rel parse(const std::wstring & Str);
} private:
int value_;
};
std::wostream & operator << (std::wostream & _Wostream, const percent_rel & _Percent);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::percent);
APPLY_PARSE_XML_ATTRIBUTES(odf_types::percent_rel);
}
#endif #endif
...@@ -72,7 +72,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -72,7 +72,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
if (layout) //äâà ðàçà - ÷òîáû äåôîëòîâûå íàñòðîéêè âñåãäà áûëè if (layout) //äâà ðàçà - ÷òîáû äåôîëòîâûå íàñòðîéêè âñåãäà áûëè
{ {
Context.add_page_properties(layout->name()); //Context.add_page_properties(layout->name());
Context.add_page_properties(layout->name()); Context.add_page_properties(layout->name());
} }
else else
...@@ -98,10 +98,19 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -98,10 +98,19 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
content_->docx_convert(Context); content_->docx_convert(Context);
Context.get_headers_footers().set_enable_write(true); Context.get_headers_footers().set_enable_write(true);
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
if (!Context.get_section_context().dump_.empty())
{ {
lastPageLayout->docx_convert_serialize(Context.output_stream(), Context); Context.output_stream() << Context.get_section_context().dump_;
//Context.remove_page_properties(); Context.get_section_context().dump_.clear();
}
else
{
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
lastPageLayout->docx_convert_serialize(Context.output_stream(), Context);
//Context.remove_page_properties();
}
} }
Context.end_body(); Context.end_body();
......
...@@ -1217,59 +1217,14 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1217,59 +1217,14 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
return; return;
} }
_CP_OPT(length_or_percent) sect_margin_left_, sect_margin_right_; style_columns * columns = dynamic_cast<style_columns *>( style_page_layout_properties_elements_.style_columns_.get());
int count_columns = 1;
bool sep_columns = false;
if (style_columns * columns = dynamic_cast<style_columns *>( style_page_layout_properties_elements_.style_columns_.get() ))
{
if ((columns->fo_column_count_) && (*columns->fo_column_count_ > 1))
{
count_columns = *columns->fo_column_count_;
}
if (style_column_sep * columns_sep = dynamic_cast<style_column_sep *>( columns->style_column_sep_.get() ))
{
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"w:sectPr") CP_XML_NODE(L"w:sectPr")
{ {
oox::section_context::_section & section = Context.get_section_context().get(); Context.process_section( CP_XML_STREAM(), columns);
if (const style_instance * secStyle =
Context.root()->odf_context().styleContainer().style_by_name(section.style_, style_family::Section,Context.process_headers_footers_))
{
if (const style_content * content = secStyle->content())
{
if (style_section_properties * sectPr = content->get_style_section_properties())
{
if (style_columns * columns = dynamic_cast<style_columns *>( sectPr->style_columns_.get() ))
{
if (columns->fo_column_count_)
{
count_columns = *columns->fo_column_count_;
}
if (style_column_sep * columns_sep = dynamic_cast<style_column_sep *>( columns->style_column_sep_.get() ))
{
if (columns_sep->style_style_ != _T("none"))
sep_columns = true;
}
}
sect_margin_left_ = sectPr->common_horizontal_margin_attlist_.fo_margin_left_;
sect_margin_right_ = sectPr->common_horizontal_margin_attlist_.fo_margin_right_;
}
}
if (section.is_dump_)
{
Context.get_section_context().remove_section();
}
}
CP_XML_NODE(L"w:type") CP_XML_NODE(L"w:type")
{ {
if (Context.is_next_dump_page_properties()) if (Context.is_next_dump_page_properties())
...@@ -1280,16 +1235,7 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1280,16 +1235,7 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
CP_XML_ATTR(L"w:val", L"continuous"); CP_XML_ATTR(L"w:val", L"continuous");
} }
} }
if (count_columns > 1)
{
CP_XML_NODE(L"w:cols")
{
CP_XML_ATTR(L"w:equalWidth", L"true");
CP_XML_ATTR(L"w:num", count_columns);
CP_XML_ATTR(L"w:sep", sep_columns);
CP_XML_ATTR(L"w:space",0);
}
}
std::wstring masterPageName = Context.get_master_page_name();// document.xml!!! std::wstring masterPageName = Context.get_master_page_name();// document.xml!!!
bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm); bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm);
if (res == false) if (res == false)
...@@ -1303,8 +1249,10 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, ...@@ -1303,8 +1249,10 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm); bool res = Context.get_headers_footers().write_sectPr(masterPageName, strm);
} }
oox::section_context::_section & section = Context.get_section_context().get();
style_page_layout_properties_attlist_.docx_convert_serialize(strm, Context, sect_margin_left_, sect_margin_right_); style_page_layout_properties_attlist_.docx_convert_serialize(strm, Context, section.margin_left_, section.margin_right_);
//todooo - !! //todooo - !!
} }
} }
......
...@@ -156,14 +156,32 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co ...@@ -156,14 +156,32 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
const std::wstring id = Context.get_style_map().get( styleInst->name(), styleInst->type() ); const std::wstring id = Context.get_style_map().get( styleInst->name(), styleInst->type() );
std::wostream & _Wostream = Context.output_stream(); std::wostream & _Wostream = Context.output_stream();
_Wostream << L"<w:pPr>"; _Wostream << L"<w:pPr>";
Context.process_page_properties(_Wostream); _Wostream << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
_Wostream << L"<w:pStyle w:val=\"" << id << L"\" />"; _Wostream << L"<w:pStyle w:val=\"" << id << L"\" />";
Context.docx_serialize_list_properties(_Wostream); Context.docx_serialize_list_properties(_Wostream);
_Wostream << L"</w:pPr>"; _Wostream << L"</w:pPr>";
return 2; return 2;
} }
} }
else if (!Context.get_section_context().dump_.empty())
{
Context.output_stream() << L"<w:pPr>";
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
Context.output_stream() << L"</w:pPr>";
}
return 3;
} }
else if (!Context.get_section_context().dump_.empty())
{
Context.output_stream() << L"<w:pPr>";
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
Context.output_stream() << L"</w:pPr>";
return 3;
}
return 0; return 0;
} }
} }
...@@ -295,14 +313,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context) ...@@ -295,14 +313,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
} }
bool is_empty= paragraph_content_.size()==0; bool is_empty= paragraph_content_.size()==0;
// BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
// {
// if (elm->get_type() == typeTextSoftPageBreak && !Context.get_page_break_after() && !Context.get_page_break_before() && !(next_section_ || next_end_section_))
// {//1 (206).odt - soft-break
// // 1 (130).odt (
// Context.set_page_break_before(true);
// }
//}
Context.start_paragraph(); Context.start_paragraph();
...@@ -377,7 +387,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context) ...@@ -377,7 +387,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
Context.get_drop_cap_context().state(0);//disable Context.get_drop_cap_context().state(0);//disable
} }
if (textStyle>0) if (textStyle > 0)
{ {
is_empty = false; is_empty = false;
if (textStyle==1) Context.pop_text_properties(); if (textStyle==1) Context.pop_text_properties();
...@@ -684,11 +694,14 @@ void text_section::add_child_element( xml::sax * Reader, const ::std::wstring & ...@@ -684,11 +694,14 @@ void text_section::add_child_element( xml::sax * Reader, const ::std::wstring &
void text_section::docx_convert(oox::docx_conversion_context & Context) void text_section::docx_convert(oox::docx_conversion_context & Context)
{ {
Context.get_section_context().add_section( std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_, text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(), text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
Context.get_page_properties() current_page_properties
); );
Context.add_page_properties(current_page_properties);
BOOST_FOREACH(const office_element_ptr & elm, text_content_) BOOST_FOREACH(const office_element_ptr & elm, text_content_)
{ {
......
...@@ -396,7 +396,12 @@ void odt_conversion_context::set_master_page_name(std::wstring master_name) ...@@ -396,7 +396,12 @@ void odt_conversion_context::set_master_page_name(std::wstring master_name)
if (style_)style_->style_master_page_name_ = master_name; if (style_)style_->style_master_page_name_ = master_name;
} }
int odt_conversion_context::get_current_section_columns()
{
if (sections_.size() > 0)
sections_.back().count_columns;
else return 1;
}
void odt_conversion_context::add_section(bool continuous) void odt_conversion_context::add_section(bool continuous)
{ {
odt_section_state state; odt_section_state state;
...@@ -426,6 +431,7 @@ void odt_conversion_context::add_section_columns(int count, double space_pt, boo ...@@ -426,6 +431,7 @@ void odt_conversion_context::add_section_columns(int count, double space_pt, boo
create_element(L"style", L"columns",section_properties->style_columns_,this); create_element(L"style", L"columns",section_properties->style_columns_,this);
style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get()); style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get());
if (!columns)return; if (!columns)return;
sections_.back().count_columns = count;
columns->fo_column_count_ = count; columns->fo_column_count_ = count;
if (space_pt >= 0) columns->fo_column_gap_ = length(length(space_pt,length::pt).get_value_unit(length::cm),length::cm); if (space_pt >= 0) columns->fo_column_gap_ = length(length(space_pt,length::pt).get_value_unit(length::cm),length::cm);
...@@ -451,17 +457,47 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou ...@@ -451,17 +457,47 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou
if (!style_)return; if (!style_)return;
style_section_properties * section_properties = style_->style_content_.get_style_section_properties(); style_section_properties * section_properties = style_->style_content_.get_style_section_properties();
section_properties->text_dont_balance_text_columns_ = true; //section_properties->text_dont_balance_text_columns_ = true;
style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get()); style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get());
if (!columns)return; if (!columns)return;
double width_all = 0;
for (int i = 0; i < width_space.size() ; i++)
{
if (width_space[i].first >= 0)
width_all += width_space[i].first/* + width_space[i].second*/;
}
double curr = 0;
int width_absolute = 0;
if (width_all < 1) return;
//office_element_ptr col_elm; section_properties->style_editable_ = false;
//
//create_element(L"style", L"column",col_elm,this); for (int i = 0; i < width_space.size() && width_all > 0 ; i++)
//style_column* col = dynamic_cast<style_column*>(col_elm.get()); {
//if (!col) return; office_element_ptr col_elm;
create_element(L"style", L"column", col_elm, this);
style_column* col = dynamic_cast<style_column*>(col_elm.get());
if (!col) continue;
int val = (width_space[i].first/* + width_space[i].second*/)* 65535. /width_all /*:65535 - width_absolute*/;
col->style_rel_width_ = odf_types::percent_rel(val);
width_absolute += val;
//col->fo_start_indent_ = odf_types::length(curr,odf_types::length::pt);
//curr += width_space[0].first;
//
//col->fo_end_indent_ = odf_types::length(curr,odf_types::length::pt);
//curr += width_space[0].second;
columns->add_child_element(col_elm);
}
} }
void odt_conversion_context::end_field() void odt_conversion_context::end_field()
{ {
......
...@@ -23,6 +23,7 @@ struct odt_section_state ...@@ -23,6 +23,7 @@ struct odt_section_state
bool empty; bool empty;
bool continuous; bool continuous;
int count_columns;
}; };
...@@ -70,6 +71,7 @@ public: ...@@ -70,6 +71,7 @@ public:
void add_section(bool continuous); void add_section(bool continuous);
void add_section_columns(int count, double space_pt, bool separator ); void add_section_columns(int count, double space_pt, bool separator );
void add_section_column(std::vector<std::pair<double,double>> width_space); void add_section_column(std::vector<std::pair<double,double>> width_space);
int get_current_section_columns();
void flush_section(); void flush_section();
void set_master_page_name(std::wstring master_name); void set_master_page_name(std::wstring master_name);
......
...@@ -157,7 +157,8 @@ void style_section_properties::serialize(std::wostream & strm) ...@@ -157,7 +157,8 @@ void style_section_properties::serialize(std::wostream & strm)
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE()); common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE()); common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"style:protect", style_protect_); // default false CP_XML_ATTR_OPT(L"style:editable", style_editable_);
CP_XML_ATTR_OPT(L"style:protect", style_protect_); // default false
CP_XML_ATTR_OPT(L"text:dont-balance-text-columns", text_dont_balance_text_columns_); CP_XML_ATTR_OPT(L"text:dont-balance-text-columns", text_dont_balance_text_columns_);
if (style_columns_) style_columns_->serialize(CP_XML_STREAM()); if (style_columns_) style_columns_->serialize(CP_XML_STREAM());
......
...@@ -29,11 +29,11 @@ public: ...@@ -29,11 +29,11 @@ public:
virtual void serialize(std::wostream & strm); virtual void serialize(std::wostream & strm);
_CP_OPT(unsigned int) fo_column_count_; _CP_OPT(unsigned int) fo_column_count_;
_CP_OPT(odf_types::length) fo_column_gap_; _CP_OPT(odf_types::length) fo_column_gap_;
office_element_ptr style_column_sep_; office_element_ptr style_column_sep_;
office_element_ptr_array style_column_; office_element_ptr_array style_column_;
}; };
...@@ -53,11 +53,11 @@ public: ...@@ -53,11 +53,11 @@ public:
virtual void add_child_element( const office_element_ptr & child){} virtual void add_child_element( const office_element_ptr & child){}
virtual void serialize(std::wostream & strm); virtual void serialize(std::wostream & strm);
_CP_OPT(odf_types::length) style_rel_width_; _CP_OPT(odf_types::percent_rel) style_rel_width_;
_CP_OPT(odf_types::length) fo_start_indent_; _CP_OPT(odf_types::length) fo_start_indent_;
_CP_OPT(odf_types::length) fo_end_indent_; _CP_OPT(odf_types::length) fo_end_indent_;
_CP_OPT(odf_types::length) fo_space_before_; _CP_OPT(odf_types::length) fo_space_before_;
_CP_OPT(odf_types::length) fo_space_after_; _CP_OPT(odf_types::length) fo_space_after_;
}; };
...@@ -103,14 +103,15 @@ public: ...@@ -103,14 +103,15 @@ public:
virtual void serialize(std::wostream & strm); virtual void serialize(std::wostream & strm);
odf_types::common_background_color_attlist common_background_color_attlist_; odf_types::common_background_color_attlist common_background_color_attlist_;
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_; odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(odf_types::Bool) style_protect_; // default false _CP_OPT(odf_types::Bool) style_editable_;
_CP_OPT(odf_types::Bool) text_dont_balance_text_columns_; _CP_OPT(odf_types::Bool) style_protect_; // default false
_CP_OPT(odf_types::Bool) text_dont_balance_text_columns_;
office_element_ptr style_columns_; office_element_ptr style_columns_;
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(style_section_properties); CP_REGISTER_OFFICE_ELEMENT2(style_section_properties);
......
...@@ -34,11 +34,11 @@ public: ...@@ -34,11 +34,11 @@ public:
void serialize(std::wostream & strm ,const wchar_t * ns, const wchar_t * name ); void serialize(std::wostream & strm ,const wchar_t * ns, const wchar_t * name );
_CP_OPT(odf_types::length) style_width_; _CP_OPT(odf_types::length) style_width_;
_CP_OPT(odf_types::percent) style_rel_width_; _CP_OPT(odf_types::percent) style_rel_width_;
_CP_OPT(odf_types::Bool) style_may_break_between_rows_; _CP_OPT(odf_types::Bool) style_may_break_between_rows_;
_CP_OPT(odf_types::border_model) table_border_model_; _CP_OPT(odf_types::border_model) table_border_model_;
_CP_OPT(odf_types::Bool) table_display_; _CP_OPT(odf_types::Bool) table_display_;
_CP_OPT(odf_types::table_align) table_align_; _CP_OPT(odf_types::table_align) table_align_;
_CP_OPT(odf_types::color) tableooo_tab_color_; _CP_OPT(odf_types::color) tableooo_tab_color_;
odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_; odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_;
......
...@@ -874,9 +874,10 @@ void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic:: ...@@ -874,9 +874,10 @@ void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic::
{ {
props->m_oCols.Init(); props->m_oCols.Init();
props->m_oCols->m_oEqualWidth = other->m_oCols->m_oEqualWidth; props->m_oCols->m_oEqualWidth = other->m_oCols->m_oEqualWidth;
props->m_oCols->m_oNum = other->m_oCols->m_oNum; props->m_oCols->m_oNum = other->m_oCols->m_oNum; //
props->m_oCols->m_oSep = other->m_oCols->m_oSep; props->m_oCols->m_oSep = other->m_oCols->m_oSep;
props->m_oCols->m_oSpace = other->m_oCols->m_oSpace; props->m_oCols->m_oSpace = other->m_oCols->m_oSpace;
for (unsigned int i =0; i < other->m_oCols->m_arrColumns.size(); i++) for (unsigned int i =0; i < other->m_oCols->m_arrColumns.size(); i++)
{ {
if (other->m_oCols->m_arrColumns[i] == NULL)continue; if (other->m_oCols->m_arrColumns[i] == NULL)continue;
...@@ -888,6 +889,11 @@ void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic:: ...@@ -888,6 +889,11 @@ void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic::
props->m_oCols->m_arrColumns.push_back(col); props->m_oCols->m_arrColumns.push_back(col);
} }
if (props->m_oCols->m_arrColumns.size() > 0 && other->m_oCols->m_oNum->GetValue() > 1)
{
props->m_oCols->m_oNum = new SimpleTypes::CDecimalNumber<0>();
props->m_oCols->m_oNum->SetValue(props->m_oCols->m_arrColumns.size());
}
} }
if (other->m_arrFooterReference.size() > 0) if (other->m_arrFooterReference.size() > 0)
...@@ -934,7 +940,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -934,7 +940,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
{ {
if (oox_section_pr == NULL) return; if (oox_section_pr == NULL) return;
odt_context->text_context()->set_type_break(-1,0); odt_context->text_context()->set_type_break(-1, 0);
bool continuous = false; bool continuous = false;
...@@ -958,7 +964,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -958,7 +964,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
{ // . { // .
// + // +
// !! .. continues // !! .. continues
apply_from(last_section_properties,oox_section_pr); apply_from(last_section_properties, oox_section_pr);
} }
else else
{ {
...@@ -966,7 +972,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -966,7 +972,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
//oox_section_pr = last_section_properties; //oox_section_pr = last_section_properties;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
odt_context->page_layout_context()->start_master_page(root ? L"Standard" : L""); if (!continuous/* || root*/)
{
odt_context->page_layout_context()->start_master_page(root ? L"Standard" : L"");
}
bool present_header = false; bool present_header = false;
bool present_footer = false; bool present_footer = false;
...@@ -1117,11 +1126,12 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -1117,11 +1126,12 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
} }
//-------------------------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------------------------
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master() ? if (!continuous)
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master() ?
odt_context->page_layout_context()->last_master()->get_name() : L""); odt_context->page_layout_context()->last_master()->get_name() : L"");
// - // -
if (!root)odt_context->add_section(continuous); //if (!root)odt_context->add_section(continuous);
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oBidi; //nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oBidi;
//nullable<ComplexTypes::Word::CDocGrid > m_oDocGrid; //nullable<ComplexTypes::Word::CDocGrid > m_oDocGrid;
...@@ -1137,18 +1147,27 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -1137,18 +1147,27 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
//nullable<OOX::Logic::CSectPrChange > m_oSectPrChange; //nullable<OOX::Logic::CSectPrChange > m_oSectPrChange;
//-------------------------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------------------------
if ((oox_section_pr->m_oCols.IsInit()) && (oox_section_pr->m_oCols->m_oNum.IsInit()) && (oox_section_pr->m_oCols->m_oNum->GetValue() > 1))// int num_columns = 1;
if (oox_section_pr->m_oCols.IsInit())
{ {
if (root)odt_context->add_section(continuous); num_columns = oox_section_pr->m_oCols->m_oNum.IsInit() ? oox_section_pr->m_oCols->m_oNum->GetValue() : 1;
unsigned int count = oox_section_pr->m_oCols->m_oNum->GetValue(); if (num_columns > 1 && oox_section_pr->m_oCols->m_arrColumns.size() > 0)
num_columns = /*(std::max)*/( /*num_columns,*/ (int)oox_section_pr->m_oCols->m_arrColumns.size()) ;
}
if (/*num_columns != odt_context->get_current_section_columns() || */num_columns >= 1) //
{
odt_context->add_section(continuous);
double default_space_pt = -1; double default_space_pt = -1;
if (oox_section_pr->m_oCols->m_oSpace.IsInit()) default_space_pt = oox_section_pr->m_oCols->m_oSpace->ToPoints(); if (oox_section_pr->m_oCols->m_oSpace.IsInit()) default_space_pt = oox_section_pr->m_oCols->m_oSpace->ToPoints();
bool separator = oox_section_pr->m_oCols->m_oSep.IsInit() && oox_section_pr->m_oCols->m_oSep->ToBool(); bool separator = oox_section_pr->m_oCols->m_oSep.IsInit() && oox_section_pr->m_oCols->m_oSep->ToBool();
odt_context->add_section_columns(count, default_space_pt, separator ); odt_context->add_section_columns(num_columns,
oox_section_pr->m_oCols->m_arrColumns.size() > 0 ? -1 : default_space_pt , separator );
std::vector<std::pair<double,double>> width_space; std::vector<std::pair<double,double>> width_space;
...@@ -1163,19 +1182,19 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -1163,19 +1182,19 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oW.IsInit()) if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oW.IsInit())
w = oox_section_pr->m_oCols->m_arrColumns[i]->m_oW->ToPoints(); w = oox_section_pr->m_oCols->m_arrColumns[i]->m_oW->ToPoints();
width_space.push_back(std::pair<double,double>(w,space)); width_space.push_back(std::pair<double,double>(w, space));
}
for (unsigned int i= oox_section_pr->m_oCols->m_arrColumns.size(); i< count; i ++)
{
width_space.push_back(std::pair<double,double>(-1, default_space_pt));
} }
//for (unsigned int i= oox_section_pr->m_oCols->m_arrColumns.size(); i< num_columns; i ++)
//{
// width_space.push_back(std::pair<double,double>(-1, default_space_pt));
//}
odt_context->add_section_column(width_space); odt_context->add_section_column(width_space);
if (root) odt_context->flush_section(); if (root) odt_context->flush_section();
} }
odt_context->page_layout_context()->end_master_page(); // if (!continuous) odt_context->page_layout_context()->end_master_page(); //
if (root)odt_context->page_layout_context()->set_current_master_page_base(); if (root) odt_context->page_layout_context()->set_current_master_page_base();
last_section_properties = oox_section_pr; last_section_properties = oox_section_pr;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* File created by MIDL compiler version 7.00.0555 */ /* File created by MIDL compiler version 7.00.0555 */
/* at Sun Jun 07 15:31:58 2015 /* at Thu Feb 25 16:45:28 2016
*/ */
/* Compiler settings for .\ASCOfficeOdfFileW.idl: /* Compiler settings for .\ASCOfficeOdfFileW.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555
......
...@@ -36,7 +36,7 @@ const int normalizeColumn(const int column) ...@@ -36,7 +36,7 @@ const int normalizeColumn(const int column)
} }
const std::wstring column2str(const int column) const std::wstring column2str(const int column, const bool col_rel)
{ {
int column_value = normalizeColumn(column); int column_value = normalizeColumn(column);
const int radix = L'Z' - L'A' + 1; const int radix = L'Z' - L'A' + 1;
...@@ -48,7 +48,8 @@ const std::wstring column2str(const int column) ...@@ -48,7 +48,8 @@ const std::wstring column2str(const int column)
ret_val = sym + ret_val; ret_val = sym + ret_val;
column_value = (column_value - 1) / radix; column_value = (column_value - 1) / radix;
} }
return ret_val;
return (col_rel ? L"" : L"$") + ret_val;
} }
...@@ -67,16 +68,16 @@ const int normalizeRow(const int row) ...@@ -67,16 +68,16 @@ const int normalizeRow(const int row)
} }
const std::wstring row2str(const int row) const std::wstring row2str(const int row, const bool row_rel)
{ {
int row_value = normalizeRow(row); int row_value = normalizeRow(row);
return STR::int2wstr(row_value + 1, 10); return (row_rel ? L"" : L"$") + STR::int2wstr(row_value + 1, 10);
} }
const std::wstring loc2str(const int row, const bool row_rel, const int column, const bool col_rel) const std::wstring loc2str(const int row, const bool row_rel, const int column, const bool col_rel)
{ {
return (col_rel ? L"" : L"$") + column2str(column) + (row_rel ? L"" : L"$") + row2str(row); return column2str(column, col_rel) + row2str(row, row_rel);
} }
......
...@@ -22,13 +22,13 @@ namespace AUX ...@@ -22,13 +22,13 @@ namespace AUX
const int normalizeColumn (const int column); const int normalizeColumn (const int column);
const int normalizeRow (const int row); const int normalizeRow (const int row);
const std::wstring column2str (const int column); const std::wstring column2str (const int column, const bool col_rel);
const std::wstring row2str (const int row); const std::wstring row2str (const int row, const bool row_rel);
const std::wstring loc2str (const int row, const bool row_rel, const int column, const bool col_rel); const std::wstring loc2str (const int row, const bool row_rel, const int column, const bool col_rel);
void str2loc (const std::wstring& str, int& row, bool& row_rel, int& column, bool& col_rel); void str2loc (const std::wstring& str, int& row, bool& row_rel, int& column, bool& col_rel);
void str2loc (std::wstring::const_iterator& str_begin, std::wstring::const_iterator& str_end, int& row, bool& row_rel, int& column, bool& col_rel); void str2loc (std::wstring::const_iterator& str_begin, std::wstring::const_iterator& str_end, int& row, bool& row_rel, int& column, bool& col_rel);
void str2refs (const std::wstring& str, std::vector<XLS::CellRangeRef>& vec); void str2refs (const std::wstring& str, std::vector<XLS::CellRangeRef>& vec);
}; };
......
#include "Format.h" #include "Format.h"
#include <utils.h>
namespace XLS namespace XLS
{ {
...@@ -25,21 +26,20 @@ void Format::writeFields(CFRecord& record) ...@@ -25,21 +26,20 @@ void Format::writeFields(CFRecord& record)
record << ifmt << stFormat; record << ifmt << stFormat;
} }
void Format::readFields(CFRecord& record) void Format::readFields(CFRecord& record)
{ {
record >> ifmt >> stFormat; record >> ifmt >> stFormat;
stFormat = xml::utils::replace_xml_to_text(stFormat.value());
} }
int Format::serialize(std::wostream & stream) int Format::serialize(std::wostream & stream)
{ {
if (ifmt < 164) return 0;
CP_XML_WRITER(stream) CP_XML_WRITER(stream)
{ {
CP_XML_NODE(L"numFmt") CP_XML_NODE(L"numFmt")
{ {
CP_XML_ATTR(L"numFmtId", ifmt); CP_XML_ATTR(L"numFmtId", ifmt);
CP_XML_ATTR(L"formatCode", stFormat.value()); CP_XML_ATTR(L"formatCode", /*xml::utils::replace_text_to_xml*/(stFormat.value()));
} }
} }
return 1; return 1;
......
...@@ -106,6 +106,7 @@ int SST::serialize(std::wostream & stream) ...@@ -106,6 +106,7 @@ int SST::serialize(std::wostream & stream)
{ {
CP_XML_NODE(L"t") CP_XML_NODE(L"t")
{ {
CP_XML_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM() << STR::escape_ST_Xstring(xml::utils::replace_text_to_xml(richText->str_)); CP_XML_STREAM() << STR::escape_ST_Xstring(xml::utils::replace_text_to_xml(richText->str_));
} }
} }
......
...@@ -89,15 +89,16 @@ const std::wstring CellRangeRef::toString(const bool useShortForm) const ...@@ -89,15 +89,16 @@ const std::wstring CellRangeRef::toString(const bool useShortForm) const
{ {
if(to_string_cache.empty()) if(to_string_cache.empty())
{ {
int rowLast_norm = AUX::normalizeRow(rowLast); int rowLast_norm = AUX::normalizeRow (rowLast);
int rowFirst_norm = AUX::normalizeRow(rowFirst); int rowFirst_norm = AUX::normalizeRow (rowFirst);
int columnFirst_norm = AUX::normalizeColumn(columnFirst); int columnFirst_norm = AUX::normalizeColumn (columnFirst);
int columnLast_norm = AUX::normalizeColumn(columnLast); int columnLast_norm = AUX::normalizeColumn (columnLast);
if(0 == rowFirst_norm && 65535 == rowLast_norm ) // whole column or range of columns if(0 == rowFirst_norm && 65535 == rowLast_norm ) // whole column or range of columns
{ {
if(useShortForm) if(useShortForm)
{ {
return to_string_cache = AUX::column2str(columnFirst_norm) + L':' + AUX::column2str(columnLast_norm); return to_string_cache = AUX::column2str(columnFirst_norm, columnFirstRelative) + L':' + AUX::column2str(columnLast_norm, columnLastRelative);
} }
else else
{ {
...@@ -108,7 +109,7 @@ const std::wstring CellRangeRef::toString(const bool useShortForm) const ...@@ -108,7 +109,7 @@ const std::wstring CellRangeRef::toString(const bool useShortForm) const
{ {
if(useShortForm) if(useShortForm)
{ {
return to_string_cache = AUX::row2str(rowFirst_norm) + L':' + AUX::row2str(rowLast_norm); return to_string_cache = AUX::row2str(rowFirst_norm, rowFirstRelative) + L':' + AUX::row2str(rowLast_norm, rowLastRelative);
} }
else else
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "DXFN.h" #include "DXFN.h"
#include <Binary/CFRecord.h> #include <Binary/CFRecord.h>
#include <utils.h>
namespace XLS namespace XLS
{ {
...@@ -62,7 +63,7 @@ int DXFNum::serialize(std::wostream & stream) ...@@ -62,7 +63,7 @@ int DXFNum::serialize(std::wostream & stream)
if (!parent->ifmtNinch) if (!parent->ifmtNinch)
CP_XML_ATTR(L"numFmtId", fmt_id.ifmt); CP_XML_ATTR(L"numFmtId", fmt_id.ifmt);
if (!parent->fIfmtUser) if (!parent->fIfmtUser)
CP_XML_ATTR(L"formatCode", user_defined.fmt.value()); CP_XML_ATTR(L"formatCode", /*xml::utils::replace_text_to_xml*/(user_defined.fmt.value()));
} }
} }
return 0; return 0;
......
...@@ -30,15 +30,6 @@ BiffStructurePtr PtgArea3d::clone() ...@@ -30,15 +30,6 @@ BiffStructurePtr PtgArea3d::clone()
return BiffStructurePtr(new PtgArea3d(*this)); return BiffStructurePtr(new PtgArea3d(*this));
} }
//void PtgArea3d::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"ixti", ixti);
//
// area.toXML(xml_tag);
//}
void PtgArea3d::storeFields(CFRecord& record) void PtgArea3d::storeFields(CFRecord& record)
{ {
record << ixti; record << ixti;
......
...@@ -30,16 +30,6 @@ BiffStructurePtr PtgRef3d::clone() ...@@ -30,16 +30,6 @@ BiffStructurePtr PtgRef3d::clone()
return BiffStructurePtr(new PtgRef3d(*this)); return BiffStructurePtr(new PtgRef3d(*this));
} }
//
//void PtgRef3d::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// static std::wstring ixti_name(L"ixti");
// xml_tag->setAttribute(ixti_name, ixti);
//
// rgce_loc.toXML(xml_tag);
//}
void PtgRef3d::storeFields(CFRecord& record) void PtgRef3d::storeFields(CFRecord& record)
{ {
rgce_loc_rel = rgce_loc; rgce_loc_rel = rgce_loc;
...@@ -69,7 +59,9 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data) ...@@ -69,7 +59,9 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
std::wstring cell_ref = rgce_loc.toString(); std::wstring cell_ref = rgce_loc.toString();
ptg_stack.push(XMLSTUFF::make3dRef(ixti, cell_ref, global_info->xti_parsed)); cell_ref = XMLSTUFF::make3dRef(ixti, cell_ref, global_info->xti_parsed);
ptg_stack.push(cell_ref);
} }
......
...@@ -18,7 +18,6 @@ public: ...@@ -18,7 +18,6 @@ public:
void fromString(const std::wstring& str); void fromString(const std::wstring& str);
virtual void loadFields(CFRecord& record); virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record); virtual void storeFields(CFRecord& record);
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <Logic/Biff_structures/BitMarkedStructs.h> #include <Logic/Biff_structures/BitMarkedStructs.h>
#include <utils.h>
namespace XLS namespace XLS
{ {
...@@ -140,7 +142,7 @@ static void serialize_val_prop(std::wostream & stream, const std::wstring & name ...@@ -140,7 +142,7 @@ static void serialize_val_prop(std::wostream & stream, const std::wstring & name
if (byte_) CP_XML_ATTR(L"val", byte_->value()); if (byte_) CP_XML_ATTR(L"val", byte_->value());
LPWideString * str_ = dynamic_cast<LPWideString*>(val.get()); LPWideString * str_ = dynamic_cast<LPWideString*>(val.get());
if (str_) CP_XML_ATTR(L"val", str_->value()); if (str_) CP_XML_ATTR(L"val", xml::utils::replace_text_to_xml(str_->value()));
} }
} }
} }
......
...@@ -106,6 +106,7 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream) ...@@ -106,6 +106,7 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream)
CP_XML_NODE(L"t") CP_XML_NODE(L"t")
{ {
CP_XML_ATTR(L"xml:space", L"preserve");
std::wstring str_part = str_.substr( start_string, str_.size() - start_string ); std::wstring str_part = str_.substr( start_string, str_.size() - start_string );
CP_XML_STREAM() << xml::utils::replace_text_to_xml(str_part); CP_XML_STREAM() << xml::utils::replace_text_to_xml(str_part);
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <Logic/Biff_records/NameFnGrp12.h> #include <Logic/Biff_records/NameFnGrp12.h>
#include <Logic/Biff_records/NamePublish.h> #include <Logic/Biff_records/NamePublish.h>
#include <Logic/Biff_structures/PtgRef3d.h>
#include <utils.h> #include <utils.h>
namespace XLS namespace XLS
...@@ -105,8 +107,6 @@ const bool LBL::loadContent(BinProcessor& proc) ...@@ -105,8 +107,6 @@ const bool LBL::loadContent(BinProcessor& proc)
} }
int LBL::serialize(std::wostream & stream) int LBL::serialize(std::wostream & stream)
{ {
//if (isSerialize == false) return 0;
Lbl *lbl = dynamic_cast<Lbl*>(m_Lbl.get()); Lbl *lbl = dynamic_cast<Lbl*>(m_Lbl.get());
if (lbl == NULL) return 0; if (lbl == NULL) return 0;
...@@ -115,9 +115,13 @@ int LBL::serialize(std::wostream & stream) ...@@ -115,9 +115,13 @@ int LBL::serialize(std::wostream & stream)
if (value.empty()) return 0; if (value.empty()) return 0;
int res = 0; int res = 0;
if (lbl->itab == 0 && (res = value.find(L"!")) < 0)
if ((lbl->itab == 0) &&
(res = value.find(L"!")) < 0 &&
(lbl->rgce.rgce.sequence.size() < 2))
{ {
value = std::wstring(L"#REF!"); PtgRef3d* ptg = dynamic_cast<PtgRef3d*>(lbl->rgce.rgce.sequence[0].get());
if (ptg) value = std::wstring(L"#REF!");
} }
CP_XML_WRITER(stream) CP_XML_WRITER(stream)
......
...@@ -460,13 +460,14 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state) ...@@ -460,13 +460,14 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
} }
if ( drawing_state->type == external_items::typeComment ) if ( drawing_state->type == external_items::typeComment )
{ {
std::wstringstream strm; //serialize_vml_shape()
//context_.get_comments_context().set_drawing(drawing_state->text.content);
context_.get_comments_context().set_fill_color(drawing_state->fill.color.sRGB); context_.get_comments_context().set_fill_color(drawing_state->fill.color.sRGB);
context_.get_comments_context().set_line_color(drawing_state->line.fill.color.sRGB); context_.get_comments_context().set_line_color(drawing_state->line.fill.color.sRGB);
context_.get_comments_context().set_content(drawing_state->text.content); context_.get_comments_context().set_content(drawing_state->text.content);
std::wstringstream strm;
strm << drawing_state->sheet_anchor.colFrom << L", " << (int)(2 * drawing_state->sheet_anchor.xFrom / 12700.) << L", " strm << drawing_state->sheet_anchor.colFrom << L", " << (int)(2 * drawing_state->sheet_anchor.xFrom / 12700.) << L", "
<< drawing_state->sheet_anchor.rwFrom << L", " << (int)(2 * drawing_state->sheet_anchor.yFrom / 12700.) << L", " << drawing_state->sheet_anchor.rwFrom << L", " << (int)(2 * drawing_state->sheet_anchor.yFrom / 12700.) << L", "
<< drawing_state->sheet_anchor.colTo << L", " << (int)(2 * drawing_state->sheet_anchor.xTo / 12700.) << L", " << drawing_state->sheet_anchor.colTo << L", " << (int)(2 * drawing_state->sheet_anchor.xTo / 12700.) << L", "
...@@ -1488,6 +1489,7 @@ void xlsx_drawing_context::set_group_anchor(int x, int y, int cx, int cy) ...@@ -1488,6 +1489,7 @@ void xlsx_drawing_context::set_group_anchor(int x, int y, int cx, int cy)
void xlsx_drawing_context::set_absolute_anchor(double x, double y, double cx, double cy) void xlsx_drawing_context::set_absolute_anchor(double x, double y, double cx, double cy)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (current_drawing_states->back()->type_anchor != 0) return;
current_drawing_states->back()->absolute_anchor.x = x; current_drawing_states->back()->absolute_anchor.x = x;
current_drawing_states->back()->absolute_anchor.y = y; current_drawing_states->back()->absolute_anchor.y = y;
......
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