Compare commits

...

10 Commits

Author SHA1 Message Date
26c02c5766 . 2017-12-23 19:33:05 +03:00
0d8c668f95 OdfFormat, fix bug 36596 (only for onlyoffice editors) 2017-12-23 17:34:20 +03:00
310cff0dfe change non-defined temp directory to unique 2017-12-23 14:48:44 +03:00
7f6611ab21 .. 2017-12-23 14:35:52 +03:00
bb37e348f5 . 2017-12-23 13:26:11 +03:00
6b5e03df5e . 2017-12-23 12:29:40 +03:00
d0e0109560 . 2017-12-22 15:10:45 +03:00
dc33f7f197 fix WriteAutoFilter error 2017-12-21 19:06:21 +03:00
85f4aa5679 fix error in sheetViews toXML 2017-12-21 17:28:55 +03:00
d2c5ea026f OOXML - fix ole object read 2017-12-21 13:52:17 +03:00
65 changed files with 633 additions and 332 deletions

View File

@ -103,7 +103,7 @@ public:
reset_fill(l.fill_);
//floor_.content_= l;
}
void set_legend(odf_reader::chart::simple & l)
void set_legend(odf_reader::chart::legend & l)
{
reset_fill(l.fill_);
legend_.content_= l;

View File

@ -52,10 +52,9 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:legend")
{
CP_XML_NODE(L"c:legendPos")
{
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
CP_XML_ATTR(L"val", content_.position);
}
layout_.oox_serialize(CP_XML_STREAM());

View File

@ -48,7 +48,7 @@ public:
void oox_serialize(std::wostream & _Wostream);
odf_reader::chart::simple content_;
odf_reader::chart::legend content_;
private:
cpdoccore::oox::oox_layout layout_; //layout (Layout) §21.2.2.88

View File

@ -762,6 +762,28 @@ void process_build_object::visit(const chart_footer& val)
void process_build_object::visit(const chart_legend& val)
{
object_odf_context_.legend_.bEnabled = true;
object_odf_context_.legend_.position = L"r";
if (val.attlist_.chart_legend_position_)
{
std::wstring pos = val.attlist_.chart_legend_position_.get();
if ( pos == L"bottom") object_odf_context_.legend_.position = L"b";
if ( pos == L"start") object_odf_context_.legend_.position = L"l";
if ( pos == L"top") object_odf_context_.legend_.position = L"t";
if ( pos == L"top-end") object_odf_context_.legend_.position = L"tr";
if ( pos == L"top-start") object_odf_context_.legend_.position = L"tl";
if ( pos == L"bottom-start") object_odf_context_.legend_.position = L"bl";
if ( pos == L"bottom-end") object_odf_context_.legend_.position = L"br";
}
if (val.attlist_.chart_legend_align_)
{
std::wstring align = val.attlist_.chart_legend_align_.get();
//if ( pos == L"start") object_odf_context_.legend_.align = L"b";
//if ( pos == L"center") object_odf_context_.legend_.align = L"l";
//if ( pos == L"end") object_odf_context_.legend_.align = L"t";
}
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);

View File

@ -188,7 +188,7 @@ public:
office_element_ptr_array title_odf_context_;
chart::title sub_title_;
chart::simple legend_;
chart::legend legend_;
chart::plot_area plot_area_;
chart::simple wall_;

View File

@ -76,6 +76,7 @@ namespace chart {
struct simple
{
simple() : bEnabled(false) {}
bool bEnabled;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
@ -92,6 +93,11 @@ namespace chart {
treadline(){bEquation = false; bREquation = false;}
};
struct legend : public simple
{
std::wstring position;
std::wstring align;
};
struct plot_area : public simple
{
std::wstring cell_range_address_;

View File

@ -72,7 +72,6 @@ class common_chart_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_style_name_;
};
@ -117,7 +116,6 @@ class chart_title_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) table_cell_range_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
@ -194,13 +192,13 @@ class chart_legend_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_legend_position_;
_CP_OPT(std::wstring) chart_legend_align_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
_CP_OPT(std::wstring) style_legend_expansion_;
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
common_chart_attlist common_attlist_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
};

View File

@ -67,10 +67,11 @@ void table_format_properties::add_attributes( const xml::attributes_wc_ptr & Att
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"style:may-break-between-rows", style_may_break_between_rows_);
CP_APPLY_ATTR(L"table:align", table_align_);
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
CP_APPLY_ATTR(L"table:align", table_align_);
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
CP_APPLY_ATTR(L"style:use-optimal-column-width",style_use_optimal_column_width_);
}
bool table_format_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
@ -94,17 +95,22 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (style_rel_width_)
{
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
}
else if (style_width_)
else if (style_use_optimal_column_width_)
{
_tblPr << L"<w:tblW w:type=\"auto\" w:w=\"0\"/>";
}
else if (style_width_)
{
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
if (w_w > 31680)w_w = 31680;
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
}
else
{
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\"/>";
}
if (common_break_attlist_.fo_break_before_)
@ -127,23 +133,26 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
{
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\"/>";
}
}
else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
_tblPr << L"<w:jc w:val=\"" << w_val << "\"/>";
}
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
if (!style_use_optimal_column_width_)
{
_tblPr << "<w:tblLayout w:type=\"fixed\"/>";
}
if (common_background_color_attlist_.fo_background_color_)
{
const std::wstring w_fill = (common_background_color_attlist_.fo_background_color_->get_type() == background_color::Enabled
? common_background_color_attlist_.fo_background_color_->get_color().get_hex_value() : L"auto");
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\" />";
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\"/>";
}
}

View File

@ -79,7 +79,6 @@ public:
_CP_OPT(odf_types::length) style_width_;
_CP_OPT(odf_types::percent) style_rel_width_;
office_element_ptr style_background_image_;
_CP_OPT(bool) style_may_break_between_rows_;
_CP_OPT(odf_types::border_model) table_border_model_;
@ -87,6 +86,8 @@ public:
_CP_OPT(bool) table_display_;
_CP_OPT(odf_types::color) tableooo_tab_color_;
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_; //not specification
office_element_ptr style_background_image_;
};
class style_table_properties : public office_element_impl<style_table_properties>

View File

@ -337,23 +337,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
}
else
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
/*
if (CP_CHECK_NAME(L"table", L"table-column-group") && type_ != 1)
{
type_ = 0;
CP_CREATE_ELEMENT_SIMPLE(table_table_column_group_);
}
else if (( CP_CHECK_NAME(L"table", L"table-columns") ||
CP_CHECK_NAME(L"table", L"table-column") ||
CP_CHECK_NAME(L"table", L"table-header-columns") )
&& type_ != 0)
{
type_ = 1;
table_columns_no_group_.add_child_element(Reader, Ns, Name, Context);
}
else
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
*/
}
//////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -164,7 +164,6 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
if (inst && inst->content())
inst->content()->docx_convert(Context);
Context.get_styles_context().docx_serialize_table_style(_Wostream, Context.get_text_tracked_context().dumpTblPr_);
_Wostream << L"<w:tblGrid>";

View File

@ -47,8 +47,9 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\OdfFileWriterTest.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -66,7 +67,7 @@
Name="VCLinkerTool"
AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBCMTD.lib"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@ -450,6 +451,14 @@
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
</Filter>
</Filter>

View File

@ -125,7 +125,7 @@ namespace odf_writer
class odf_chart_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
{
styles_context_ = NULL;
current_series_count_ = 0;
@ -151,6 +151,9 @@ public:
std::vector<office_element_ptr> group_series_;
std::vector<unsigned int> axis_group_series_;
_CP_OPT(int) bar_overlap;
_CP_OPT(int) bar_gap_width;
struct _range
{
_range(std::wstring &r, bool l, chart_series *s) : label(l), index_cash(-1), series(s), ref(r) {}
@ -277,6 +280,9 @@ void odf_chart_context::Impl::clear_current()
group_series_.clear();
data_cell_ranges_.clear();
cash_.clear();
bar_gap_width = boost::none;
bar_overlap = boost::none;
current_series_count_ = 0;
local_table_reset_ref_ = false;
@ -335,7 +341,7 @@ void odf_chart_context::start_chart(office_element_ptr & root)
root->add_child_element(chart_elm);
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -427,8 +433,6 @@ void odf_chart_context::set_chart_bar_direction(int type)
}
void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
{
if (!impl_->current_level_.back().chart_properties_) return;
int res = val.find(L"%");
bool percent=false;
@ -438,21 +442,22 @@ void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
percent=true;
}
double dVal = boost::lexical_cast<double>(val);
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = (int)dVal;
impl_->bar_gap_width = (int)dVal;
}
void odf_chart_context::set_chart_bar_overlap(std::wstring val)
{
if (!impl_->current_level_.back().chart_properties_) return;
int res = val.find(L"%");
bool percent=false;
bool percent = false;
if (res > 0)
{
val = val.substr(0,res);
percent=true;
percent = true;
}
double dVal = boost::lexical_cast<double>(val);
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = (int)dVal;
impl_->bar_overlap = (int)dVal;
}
void odf_chart_context::set_chart_stock_candle_stick(bool val)
@ -702,15 +707,17 @@ void odf_chart_context::end_group_series()
std::wstring axis_name;
bool presentZ = false;
long countX = 0;
long countY = 0;
long countZ = 0;
for (size_t j = 0; j < impl_->axis_.size(); j++)
{
if (impl_->axis_[j].dimension ==1) countX++;
else if (impl_->axis_[j].dimension ==3) presentZ = true;
else countY++;
if (impl_->axis_[j].dimension == 1) countX++;
else if (impl_->axis_[j].dimension == 2) countY++;
else if (impl_->axis_[j].dimension == 3) countZ++;
}
if (countX < 1 && countY > 1)
{
impl_->axis_[0].dimension == 1;
@ -718,15 +725,15 @@ void odf_chart_context::end_group_series()
axis->chart_axis_attlist_.chart_dimension_ = L"x";
countY--;
}
if (presentZ == false && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
{
impl_->axis_.back().dimension == 3;
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"z";
countY--;
}
//if (countZ > 0 && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
//{
// impl_->axis_.back().dimension == 3;
// chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
// axis->chart_axis_attlist_.chart_dimension_ = L"z";
// countY--;
//}
for (size_t i=0; i < impl_->axis_group_series_.size(); i++)
for (size_t i = 0; i < impl_->axis_group_series_.size(); i++)
{
for (size_t j = 0; j < impl_->axis_.size(); j++)
{
@ -740,7 +747,7 @@ void odf_chart_context::end_group_series()
}
for (size_t i =0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
for (size_t i = 0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
{
chart_series *series= dynamic_cast<chart_series*>(impl_->group_series_[i].get());
if (series)
@ -796,7 +803,7 @@ void odf_chart_context::start_axis()
chart_axis *axis = dynamic_cast<chart_axis*>(elm.get());
if (axis == NULL)return;
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -810,10 +817,19 @@ void odf_chart_context::start_axis()
}
start_element(elm, style_elm, style_name);
odf_axis_state axis_state={0,0,L"",elm};
odf_axis_state axis_state={0, 0, L"", elm};
impl_->axis_.push_back(axis_state);
/////////////////////defaults
impl_->current_level_.back().chart_properties_->content_.chart_reverse_direction_ = false;
if (impl_->bar_overlap)
{
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = impl_->bar_overlap.get();
}
if (impl_->bar_gap_width)
{
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = impl_->bar_gap_width.get();
}
}
void odf_chart_context::start_grid(int type)
{
@ -826,7 +842,7 @@ void odf_chart_context::start_grid(int type)
if (type == 1) grid->chart_grid_attlist_.chart_class_ = L"major";
if (type == 2) grid->chart_grid_attlist_.chart_class_ = L"minor";
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -850,7 +866,7 @@ void odf_chart_context::start_title()
chart_title *title = dynamic_cast<chart_title*>(chart_elm.get());
if (title == NULL)return;
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -874,7 +890,7 @@ void odf_chart_context::start_plot_area()
plot_area->chart_plot_area_attlist_.chart_data_source_has_labels_ = L"both";
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -911,23 +927,22 @@ void odf_chart_context::start_text()
impl_->odf_context_->start_text_context();
impl_->odf_context_->text_context()->set_styles_context(impl_->styles_context_);
style_text_properties *text_props = NULL;
style *style_ = dynamic_cast<style*>(impl_->current_chart_state_.elements_.back().style_elm.get());
if (style_)
{
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
}
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_level_.back().paragraph_properties_,impl_->current_level_.back().text_properties_);
impl_->odf_context_->text_context()->set_single_object(true, impl_->current_level_.back().paragraph_properties_, impl_->current_level_.back().text_properties_);
}
void odf_chart_context::end_text()
{
odf_text_context * text_context_ = text_context();
if (text_context_ == NULL || impl_->current_level_.size() <1 )return;
odf_text_context *text_context_ = text_context();
if (text_context_ == NULL || impl_->current_level_.size() < 1 )return;
for (size_t i=0; i< text_context_->text_elements_list_.size(); i++)
for (size_t i = 0; i < text_context_->text_elements_list_.size(); i++)
{
if (text_context_->text_elements_list_[i].level ==0)
{
@ -945,6 +960,45 @@ void odf_chart_context::end_text()
impl_->odf_context_->end_text_context();
}
void odf_chart_context::set_textarea_vertical_align(int align)
{
if (!impl_->current_level_.back().chart_properties_)return;
//switch(align)
//{
//case 0://SimpleTypes::textanchoringtypeB:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Bottom); break;
//case 1://SimpleTypes::textanchoringtypeCtr:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Middle); break;
//case 2://SimpleTypes::textanchoringtypeDist:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Baseline);break;
//case 3://SimpleTypes::textanchoringtypeJust:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Justify); break;
//case 4://SimpleTypes::textanchoringtypeT:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
//}
}
void odf_chart_context::set_textarea_rotation(double val)
{
if (!impl_->current_level_.back().chart_properties_)return;
if (val < 0.001 && val > -0.001) return;
if (val < -360 || val > 360) return;
if (val < 0) val += 360;
val = 360 - val;
impl_->current_level_.back().chart_properties_->content_.common_rotation_angle_attlist_.style_rotation_angle_ = (unsigned int)val;
}
void odf_chart_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_level_.back().chart_properties_)return;
//if (left) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_left_ = length(*left, length::pt);
//if (top) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_top_ = length(*top, length::pt);
//if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
//if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
}
void odf_chart_context::start_floor()
{
office_element_ptr elm;
@ -1478,6 +1532,13 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с
impl_->current_level_.back().chart_properties_->content_.chart_pie_offset_ = val;
}
void odf_chart_context::set_series_pie_bubble(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content_.chart_pie_bubble_ = val;
}
//void odf_chart_context::set_cash(std::wstring format, std::vector<double> &data_double)
//{
// if (data_double.size() <1 || impl_->data_cell_ranges_.size() < 1) return;

View File

@ -89,6 +89,7 @@ public:
long get_count_data_points_series();
void set_series_pie_explosion(int val);
void set_series_pie_bubble(bool val);
void end_series();
void end_group_series();
@ -136,6 +137,10 @@ public:
void start_text();
void end_text();
void set_textarea_vertical_align(int align);
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in pt
void set_textarea_rotation (double val);
void add_domain(std::wstring formula);
void add_categories(std::wstring formula, office_element_ptr & axis);

View File

@ -177,7 +177,7 @@ void odf_conversion_context::start_chart()
create_object();
create_element(L"office", L"chart", objects_.back().content, this, true);
chart_context_.set_styles_context(styles_context());
chart_context_.set_styles_context(odf_conversion_context::styles_context());
chart_context_.start_chart(get_current_object_element());
}
void odf_conversion_context::start_spreadsheet()

View File

@ -2101,6 +2101,36 @@ void odf_drawing_context::set_line_dash_preset(int style)
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Solid); break;
}
}
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_vertical_align(int align)
{
@ -2136,6 +2166,18 @@ void odf_drawing_context::set_textarea_fit_to_size(bool val)
impl_->current_graphic_properties->draw_fit_to_size_ = val;
}
void odf_drawing_context::set_textarea_rotation(double val)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
if (!impl_->current_text_properties) return;
impl_->current_text_properties->content_.style_text_rotation_angle_ = (int)val;
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{
@ -2249,36 +2291,6 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
}
}
}
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_graphic_properties)return;

View File

@ -231,6 +231,7 @@ public:
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
void set_textarea_fit_to_size (bool val);
void set_textarea_rotation (double val);
void set_placeholder_id (std::wstring val);
void set_placeholder_type (int val);

View File

@ -100,6 +100,7 @@ public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
default_column_width = -1;
optimal_column_width = false;
}
odf_table_state & current_table() {return tables_.back();}
@ -107,13 +108,21 @@ public:
void start_table(odf_table_state & state) {tables_.push_back(state);}
void end_table() {if (tables_.size() > 0) tables_.pop_back(); default_column_width = -1; default_cell_properties = L"";}
void end_table()
{
if (tables_.size() > 0) tables_.pop_back();
default_column_width = -1; // todo .. in level ???
default_cell_properties = L"";
optimal_column_width = false;
}
odf_style_context * styles_context() {return odf_context_->styles_context();}
odf_conversion_context *odf_context_;
double default_column_width;
double default_column_width;
bool optimal_column_width;
std::wstring default_cell_properties; // для предустановки ..
private:
@ -307,6 +316,10 @@ void odf_table_context::set_default_column_width(double width)
{
impl_->default_column_width = width;
}
void odf_table_context::set_optimal_column_width(bool val)
{
impl_->optimal_column_width = val;
}
void odf_table_context::set_column_optimal(bool val)
{
if (impl_->empty()) return;
@ -362,7 +375,11 @@ void odf_table_context::set_column_width(double width)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = false;
if (impl_->optimal_column_width)
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
}
impl_->current_table().table_width += width;
}
@ -370,7 +387,7 @@ void odf_table_context::set_column_width(double width)
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
if (impl_->default_column_width >=0)
if (impl_->default_column_width >= 0)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);

View File

@ -66,6 +66,7 @@ public:
void start_table(office_element_ptr &elm, bool styled = false);
void set_default_column_width(double width);
void set_optimal_column_width(bool val);
void change_current_column_width(double width);
void end_table();

View File

@ -54,10 +54,10 @@ namespace cpdoccore {
namespace odf_writer
{
odf_text_context::odf_text_context(odf_conversion_context *odf_context)
odf_text_context::odf_text_context(odf_conversion_context *odf_context, odf_style_context *styles_context)
{
odf_context_ = odf_context;
styles_context_ = odf_context->styles_context();
styles_context_ = styles_context;
single_paragraph_ = false;
paragraph_properties_ = NULL;

View File

@ -53,7 +53,7 @@ class style_text_properties;
class odf_text_context: boost::noncopyable
{
public:
odf_text_context (odf_conversion_context *odf_context);
odf_text_context (odf_conversion_context *odf_context, odf_style_context *styles_context);
~odf_text_context ();
public:
odf_style_context* get_styles_context();//для embedded

View File

@ -132,8 +132,7 @@ void odp_conversion_context::end_layout_slide()
}
void odp_conversion_context::start_text_context()
{
text_context_ = new odf_text_context(this);
text_context_->set_styles_context(slide_context_.get_styles_context());
text_context_ = new odf_text_context(this, slide_context_.get_styles_context());
}
void odp_conversion_context::end_text_context()
{

View File

@ -472,8 +472,7 @@ void ods_conversion_context::add_column(int start_column, int repeated, int leve
}
void ods_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
current_text_context_ = new odf_text_context(this, styles_context());
}
void ods_conversion_context::end_text_context()
{

View File

@ -105,7 +105,8 @@ void odt_conversion_context::start_document()
root_document_ = get_current_object_element();
root_text_ = dynamic_cast<office_text*>(root_document_.get());
main_text_context_ = new odf_text_context(this);
main_text_context_ = new odf_text_context(this, styles_context());
page_layout_context()->set_styles_context(styles_context());
@ -182,7 +183,7 @@ odf_text_context* odt_conversion_context::text_context()
}
void odt_conversion_context::start_text_context()
{
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this));
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this, odf_conversion_context::styles_context()));
if (!new_text_context_)return;
text_context_.push_back(new_text_context_);

View File

@ -95,6 +95,7 @@ public:
_CP_OPT(int) chart_spline_order_;
_CP_OPT(int) chart_spline_resolution_;
_CP_OPT(int) chart_pie_offset_;
_CP_OPT(bool) chart_pie_bubble_;
_CP_OPT(int) chart_interval_minor_divisor_;
_CP_OPT(double) chart_maximum_;
@ -105,15 +106,15 @@ public:
_CP_OPT(double) chart_error_margin_;
_CP_OPT(double) chart_error_upper_limit_;
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
_CP_OPT(odf_types::chart_solid_type) chart_solid_type_;
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
_CP_OPT(odf_types::direction) style_direction_;
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
_CP_OPT(odf_types::length) chart_symbol_width_;
_CP_OPT(odf_types::length) chart_symbol_height_;
_CP_OPT(odf_types::chart_regression_type) chart_regression_type_;
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
_CP_OPT(odf_types::chart_error_category) chart_error_category_;
_CP_OPT(std::wstring) chart_axis_label_position_;

View File

@ -83,8 +83,13 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
common_keep_with_next_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
if (style_background_image_) style_background_image_->serialize(_Wostream);
CP_XML_ATTR_OPT(L"table:align", table_align_);
//not from specification !!
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
//not from specification !!
if (style_background_image_) style_background_image_->serialize(_Wostream);
}
}
}
@ -109,7 +114,8 @@ void table_format_properties::apply_from(const table_format_properties & Other)
common_keep_with_next_attlist_.apply_from(Other.common_keep_with_next_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
style_background_image_ = Other.style_background_image_;
style_background_image_ = Other.style_background_image_;
style_use_optimal_column_width_ = Other.style_use_optimal_column_width_;
}
// style:table-properties
@ -145,9 +151,10 @@ void style_table_column_properties_attlist::serialize(std::wostream & _Wostream,
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
common_break_attlist_.serialize(CP_GET_XML_NODE());
}
}

View File

@ -84,8 +84,8 @@ public:
odf_types::common_border_attlist common_border_attlist_;
office_element_ptr style_background_image_;
office_element_ptr style_background_image_;
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_;
};

View File

@ -1165,6 +1165,10 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->rot.IsInit())
{
odf_context()->drawing_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
}
switch(oox_bodyPr->Fit.type)
{
@ -1505,7 +1509,7 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
}
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
odf_writer::style_paragraph_properties* paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
odf_writer::style_text_properties* text_properties = NULL;
odf_writer::style_text_properties* text_properties = odf_context()->text_context()->get_text_properties();
if (!paragraph_properties)
{

View File

@ -395,7 +395,6 @@ public:
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
@ -420,7 +419,12 @@ public:
void convert(PPTX::Logic::Run *oox_run);
void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br);
void convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style = NULL);
void convert_chart_text(PPTX::Logic::TxBody *oox_txBody);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::MathParaWrapper *oox_math);
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
@ -453,7 +457,9 @@ public:
void convert(OOX::Spreadsheet::CT_Area3DChart *chart);
void convert(OOX::Spreadsheet::CT_AreaChart *chart);
void convert(OOX::Spreadsheet::CT_Bar3DChart *chart);
void convert_before(OOX::Spreadsheet::CT_Bar3DChart *chart);
void convert(OOX::Spreadsheet::CT_BarChart *chart);
void convert_before(OOX::Spreadsheet::CT_BarChart *chart);
void convert(OOX::Spreadsheet::CT_Line3DChart *chart);
void convert(OOX::Spreadsheet::CT_LineChart *chart);
void convert(OOX::Spreadsheet::CT_Pie3DChart *chart);

View File

@ -49,6 +49,61 @@
namespace Oox2Odf
{
void OoxConverter::convert_chart_text(PPTX::Logic::TxBody *oox_txBody)
{
if (!oox_txBody) return;
if (oox_txBody->Paragrs.empty()) return;
odf_context()->chart_context()->start_text();
convert(oox_txBody->lstStyle.GetPointer());
for (size_t i = 0; i < oox_txBody->Paragrs.size(); i++)
{
convert(&oox_txBody->Paragrs[i], oox_txBody->lstStyle.GetPointer());
//внешние настройки для текста
convert_chart_text(oox_txBody->bodyPr.GetPointer());
}
odf_context()->chart_context()->end_text();
}
void OoxConverter::convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr)
{
if (!oox_bodyPr) return;
if (oox_bodyPr->vert.IsInit())
{
//odf_context()->chart_context()->set_textarea_writing_mode (oox_bodyPr->vert->GetBYTECode());
}
if (oox_bodyPr->anchor.IsInit())
{
//odf_context()->chart_context()->set_textarea_vertical_align (oox_bodyPr->anchor->GetBYTECode());
}
_CP_OPT(double) lIns, tIns, rIns, bIns;
if (oox_bodyPr->lIns.IsInit()) lIns = oox_bodyPr->lIns.get() / 12700.; //pt
if (oox_bodyPr->tIns.IsInit()) tIns = oox_bodyPr->tIns.get() / 12700.;
if (oox_bodyPr->rIns.IsInit()) rIns = oox_bodyPr->rIns.get() / 12700.;
if (oox_bodyPr->bIns.IsInit()) bIns = oox_bodyPr->bIns.get() / 12700.;
//odf_context()->chart_context()->set_textarea_padding (lIns, tIns, rIns, bIns);
//if (oox_bodyPr->wrap.IsInit())
// odf_context()->chart_context()->set_textarea_wrap(oox_bodyPr->wrap->GetBYTECode());
if ((oox_bodyPr->numCol.IsInit()) && (oox_bodyPr->numCol.get() > 1))
{
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->rot.IsInit())
{
odf_context()->chart_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
}
}
void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
{
if (!oox_chart)return;
@ -56,7 +111,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
convert(oox_chart->m_externalData);
convert(oox_chart->m_oSpPr.GetPointer());
convert(oox_chart->m_oTxPr.GetPointer());
convert_chart_text(oox_chart->m_oTxPr.GetPointer());
convert(oox_chart->m_chart->m_title);
convert(oox_chart->m_chart->m_legend);
@ -103,7 +158,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Tx* ct_tx)
{
if (ct_tx == NULL)return;
convert(ct_tx->m_oRich.GetPointer());
convert_chart_text(ct_tx->m_oRich.GetPointer());
}
void OoxConverter::convert(OOX::Spreadsheet::CT_Layout* ct_layout)
{
@ -130,7 +185,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Title* ct_title)
odf_context()->chart_context()->start_title();
convert(ct_title->m_oSpPr.GetPointer());
convert(ct_title->m_layout);
convert(ct_title->m_oTxPr.GetPointer());
convert_chart_text(ct_title->m_oTxPr.GetPointer());
///////////////////////////////
convert(ct_title->m_tx);
odf_context()->chart_context()->end_element();
@ -145,7 +200,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Legend* ct_legend)
if ((ct_legend->m_legendPos) && (ct_legend->m_legendPos->m_val))
odf_context()->chart_context()->set_legend_position(*ct_legend->m_legendPos->m_val);
convert(ct_legend->m_oTxPr.GetPointer());
convert_chart_text(ct_legend->m_oTxPr.GetPointer());
if (ct_legend->m_legendEntry.size() > 0)
{
convert(ct_legend->m_legendEntry[0]); // в odf_writer нет в легенде множественности стилей
@ -157,7 +212,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LegendEntry* ct_legend)
{
if (ct_legend == NULL)return;
convert(ct_legend->m_oTxPr.GetPointer());
convert_chart_text(ct_legend->m_oTxPr.GetPointer());
}
void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
{
@ -167,6 +222,17 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
convert(ct_plotArea->m_layout);
///////////////////////
for (size_t i=0; i< ct_plotArea->m_Items.size(); i++)//
{
if (!ct_plotArea->m_ItemsElementName0[i]) continue;
switch(*ct_plotArea->m_ItemsElementName0[i])
{
case OOX::Spreadsheet::itemschoicetype5BAR3DCHART: convert_before((OOX::Spreadsheet::CT_Bar3DChart*) ct_plotArea->m_Items[i]); break;
case OOX::Spreadsheet::itemschoicetype5BARCHART: convert_before((OOX::Spreadsheet::CT_BarChart*) ct_plotArea->m_Items[i]); break;
}
}
for (size_t i = 0; i < ct_plotArea->m_Items1.size(); i++)
{
if (!ct_plotArea->m_ItemsElementName1[i]) continue;
@ -222,7 +288,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -249,7 +317,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
odf_context()->chart_context()->set_axis_label_position(*axis->m_tickLblPos->m_val);
///////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -263,7 +331,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DateAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -288,7 +358,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DateAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
//////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -302,7 +372,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -327,7 +399,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
///////////////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -341,7 +413,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
odf_context()->chart_context()->set_axis_dimension(2);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -365,7 +439,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
/////////////////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -451,12 +525,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
if (chart->m_barDir && chart->m_barDir->m_val)
odf_context()->chart_context()->set_chart_bar_direction(*chart->m_barDir->m_val);
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
@ -470,6 +538,34 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
}
odf_context()->chart_context()->end_group_series();
}
void OoxConverter::convert_before(OOX::Spreadsheet::CT_Bar3DChart *chart)
{
if (chart == NULL)return;
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
//else
// odf_context()->chart_context()->set_chart_bar_overlap(L"0");
}
void OoxConverter::convert_before(OOX::Spreadsheet::CT_BarChart *chart)
{
if (chart == NULL)return;
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
else
odf_context()->chart_context()->set_chart_bar_overlap(L"100");
if (chart->m_overlap && chart->m_overlap->m_val)
odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
else
odf_context()->chart_context()->set_chart_bar_overlap(L"0");
}
void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
{
if (chart == NULL)return;
@ -482,12 +578,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
if (chart->m_barDir && chart->m_barDir->m_val)
odf_context()->chart_context()->set_chart_bar_direction(*chart->m_barDir->m_val);
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
if (chart->m_overlap && chart->m_overlap->m_val)
odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
@ -971,6 +1061,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, std::vector<OOX:
convert(dPt[i]->m_marker);
if (dPt[i]->m_explosion && dPt[i]->m_explosion->m_val)
odf_context()->chart_context()->set_series_pie_explosion(*dPt[i]->m_explosion->m_val);
if (dPt[i]->m_bubble3D && dPt[i]->m_bubble3D->m_val)
odf_context()->chart_context()->set_series_pie_bubble(*dPt[i]->m_bubble3D->m_val);
odf_context()->chart_context()->end_element();
current_point = set_point+1;

View File

@ -214,6 +214,7 @@ void DocxConverter::convert_document()
section.props = document->m_oSectPr.GetPointer();
section.start_para = last_section_start;
section.end_para = document->m_arrItems.end();
sections.push_back(section);
//----------------------------------------------------------------------------------------------------------
@ -3926,13 +3927,23 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer
if (oox_table_pr == NULL) return false;
if (table_properties == NULL) return false;
if (oox_table_pr->m_oTblW.IsInit())
if (oox_table_pr->m_oTblW.IsInit() && oox_table_pr->m_oTblW->m_oW.IsInit())
{
if ((oox_table_pr->m_oTblW->m_oType.IsInit() && oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthDxa) &&
(oox_table_pr->m_oTblW->m_oW.IsInit() && oox_table_pr->m_oTblW->m_oW->GetValue() >0))
if (oox_table_pr->m_oTblW->m_oType.IsInit() && oox_table_pr->m_oTblW->m_oW.IsInit())
{
if (oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue()/20.);
if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthDxa &&
oox_table_pr->m_oTblW->m_oW->GetValue() > 0 )
{
if ( oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue() / 20.);
}
else if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthAuto &&
oox_table_pr->m_oTblW->m_oW->GetValue() == 0 )
{
//динамическое расширение - автоподбор по содержимому.
odt_context->table_context()->set_optimal_column_width(true);
table_properties->table_format_properties_.style_use_optimal_column_width_ = true;
}
}
}
@ -4033,7 +4044,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_
{//напрямую задать cell_prop на саму таблицу низя - тока как default-cell-style-name на columns & row
//общие свойства ячеек
odt_context->styles_context()->create_style(L"",odf_types::style_family::TableCell, true, false, -1); //ради нормального задания дефолтовых свойств на cells
odt_context->styles_context()->create_style(L"", odf_types::style_family::TableCell, true, false, -1); //ради нормального задания дефолтовых свойств на cells
odt_context->styles_context()->last_state()->set_dont_write(true);
odf_writer::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->last_state()->get_table_cell_properties();

View File

@ -60,6 +60,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -46,10 +46,12 @@
Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="_DEBUG;_CONSOLE;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\PptFileFormatTest.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -67,7 +69,7 @@
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMTD.lib;libcmt.lib"
IgnoreDefaultLibraryNames=""
IgnoreEmbeddedIDL="true"
GenerateDebugInformation="true"
SubSystem="1"

View File

@ -1502,7 +1502,22 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
if(pElem && NULL != pOle && pOle->m_sProgId.IsInit() && (pOle->m_oId.IsInit() || pOle->m_OleObjectFile.IsInit()))
{
PPTX::Logic::Pic* pPicture = dynamic_cast<PPTX::Logic::Pic*>(pElem->GetElem().operator ->());
if ((NULL != pPicture) && (pPicture->blipFill.blip.IsInit()))
PPTX::Logic::Shape* pShape = dynamic_cast<PPTX::Logic::Shape*>(pElem->GetElem().operator ->());
if ((!pPicture && pShape) && (pShape->spPr.Fill.is<PPTX::Logic::BlipFill>()))
{//convert pptx shape to pptx picture
pPicture = new PPTX::Logic::Pic();
pPicture->nvPicPr.nvPr = pShape->nvSpPr.nvPr;
pPicture->nvPicPr.cNvPr = pShape->nvSpPr.cNvPr;
pPicture->spPr = pShape->spPr;
pPicture->blipFill = pShape->spPr.Fill.as<PPTX::Logic::BlipFill>();
pPicture->spPr.Fill = PPTX::Logic::UniFill();
pShape = NULL;
pElem->InitElem(pPicture);
}
if ((pPicture) && (pPicture->blipFill.blip.IsInit()))
{
if (pOle->m_OleObjectFile.IsInit())
{

View File

@ -653,31 +653,34 @@ namespace PPTX
if (pVml->m_mapShapes.end() != pPair)
{
pPair->second.bUsed = true;
OOX::Vml::CShape* pShape = dynamic_cast<OOX::Vml::CShape*>(pPair->second.pElement);
for(std::list<OOX::WritingElement*>::iterator it = pShape->m_arrItems.begin();
(pShape) && (it != pShape->m_arrItems.end()); it++)
{
OOX::WritingElement* pChildElemShape = *it;
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
std::wstring sIdImageFileCache;
OOX::Vml::CVmlCommonElements* pShape = dynamic_cast<OOX::Vml::CVmlCommonElements*>(pPair->second.pElement);
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
if (!sIdImageFileCache.empty())
if (pShape)
{
for(std::list<OOX::WritingElement*>::iterator it = pShape->m_arrItems.begin();
it != pShape->m_arrItems.end(); it++)
{
OOX::WritingElement* pChildElemShape = *it;
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
std::wstring sIdImageFileCache;
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
if (!sIdImageFileCache.empty())
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
}
}
}
}
@ -1212,7 +1215,7 @@ namespace PPTX
}
}
bool bRect = bOle; //ole ВСЕГДА rect
bool bRect = bOle; //ole ВСЕГДА rect или shape c типом ctPictFrame(75)
if (spPr.Geometry.is<PPTX::Logic::PrstGeom>())
{

View File

@ -49,6 +49,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -48,6 +48,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -335,8 +335,10 @@
Optimization="0"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="_DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pch.h"
ObjectFile="$(IntDir)\"

View File

@ -48,6 +48,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
ProgramDataBaseFileName="$(IntDir)\DocxFormat.pdb"
WarningLevel="3"
DebugInformationFormat="4"

View File

@ -51,18 +51,17 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CComment)
CComment()
CComment()
{
}
virtual ~CComment()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -75,74 +74,74 @@ namespace OOX
std::wstring sName = oReader.GetName();
WritingElement *pItem = NULL;
/*if ( _T("w:altChunk") == sName )
/*if ( L"w:altChunk" ==sName )
pItem = new Logic::AltChunk( oItem );
else */if ( _T("w:bookmarkEnd") == sName )
else */if ( L"w:bookmarkEnd" ==sName )
pItem = new Logic::CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
else if ( L"w:bookmarkStart" ==sName )
pItem = new Logic::CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
else if ( L"w:commentRangeEnd" ==sName )
pItem = new Logic::CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
else if ( L"w:commentRangeStart" ==sName )
pItem = new Logic::CCommentRangeStart( oReader );
//else if ( _T("w:customXml") == sName )
//else if ( L"w:customXml" ==sName )
// pItem = new Logic::CCustomXml( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
else if ( L"w:customXmlDelRangeEnd" ==sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
else if ( L"w:customXmlDelRangeStart" ==sName )
pItem = new Logic::CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
else if ( L"w:customXmlInsRangeEnd" ==sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
else if ( L"w:customXmlInsRangeStart" ==sName )
pItem = new Logic::CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
else if ( L"w:customXmlMoveFromRangeEnd" ==sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
else if ( L"w:customXmlMoveFromRangeStart" ==sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
else if ( L"w:customXmlMoveToRangeEnd" ==sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
else if ( L"w:customXmlMoveToRangeStart" ==sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
else if ( L"w:del" ==sName )
pItem = new Logic::CDel( oReader );
else if ( _T("w:ins") == sName )
else if ( L"w:ins" ==sName )
pItem = new Logic::CIns( oReader );
else if ( _T("w:moveFrom") == sName )
else if ( L"w:moveFrom" ==sName )
pItem = new Logic::CMoveFrom( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
else if ( L"w:moveFromRangeEnd" ==sName )
pItem = new Logic::CMoveFromRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
else if ( L"w:moveFromRangeStart" ==sName )
pItem = new Logic::CMoveFromRangeStart( oReader );
else if ( _T("w:moveTo") == sName )
else if ( L"w:moveTo" ==sName )
pItem = new Logic::CMoveTo( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
else if ( L"w:moveToRangeEnd" ==sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
else if ( L"w:moveToRangeStart" ==sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
else if ( L"m:oMath" ==sName )
pItem = new Logic::COMath( oReader );
else if ( _T("m:oMathPara") == sName )
else if ( L"m:oMathPara" ==sName )
pItem = new Logic::COMathPara( oReader );
else if ( _T("w:p") == sName )
else if ( L"w:p" ==sName )
pItem = new Logic::CParagraph( oReader );
else if ( _T("w:permEnd") == sName )
else if ( L"w:permEnd" ==sName )
pItem = new Logic::CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
else if ( L"w:permStart" ==sName )
pItem = new Logic::CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
else if ( L"w:proofErr" ==sName )
pItem = new Logic::CProofErr( oReader );
else if ( _T("w:sdt") == sName )
else if ( L"w:sdt" ==sName )
pItem = new Logic::CSdt( oReader );
else if ( _T("w:tbl") == sName )
else if ( L"w:tbl" ==sName )
pItem = new Logic::CTbl( oReader );
if ( pItem )
m_arrItems.push_back( pItem );
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -160,7 +159,7 @@ namespace OOX
std::wstring getTextArr(const std::list<WritingElement* > & arrItems, bool& bFirstPar) const
{
std::wstring sRes;
for ( std::list<WritingElement *>::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
for ( std::list<WritingElement *>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
WritingElement* item = *it;
if (item == NULL) continue;
@ -221,7 +220,7 @@ namespace OOX
if(bFirstPar)
bFirstPar = false;
else
sRes += _T("\n");
sRes += L"\n";
OOX::Logic::CParagraph* pParagraph = static_cast<OOX::Logic::CParagraph*>(item);
sRes += getTextArr(pParagraph->m_arrItems, bFirstPar);
}
@ -234,7 +233,7 @@ namespace OOX
break;
case OOX::et_w_cr:
case OOX::et_w_br:
sRes += _T("\n");
sRes += L"\n";
break;
case OOX::et_w_nonBreakHyphen:
{
@ -243,7 +242,7 @@ namespace OOX
break;
}
case OOX::et_w_tab:
sRes += _T(" ");
sRes += L" ";
break;
case OOX::et_w_sym:
{
@ -271,14 +270,13 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_oAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oodata"), m_oOOData )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:initials"), m_oInitials )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w:author", m_oAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w:date", m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, L"oodata", m_oOOData )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w:id", m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w:initials", m_oInitials )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -309,7 +307,10 @@ namespace OOX
virtual ~CComments()
{
for(size_t i = 0, length = m_arrComments.size(); i < length; ++i)
{
if (m_arrComments[i]) delete m_arrComments[i];
m_arrComments[i] = NULL;
}
m_arrComments.clear();
}
virtual void read(const CPath& oFilePath)
@ -325,13 +326,13 @@ namespace OOX
return;
std::wstring sName = oReader.GetName();
if ( _T("w:comments") == sName && !oReader.IsEmptyNode() )
if ( L"w:comments" == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w:comment") == sName )
if ( L"w:comment" == sName )
m_arrComments.push_back( new CComment(oReader) );
}
}
@ -367,19 +368,19 @@ namespace OOX
virtual ~CCommentExt()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -390,12 +391,11 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:paraId"), m_oParaId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:paraIdParent"), m_oParaIdParent )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:done"), m_oDone )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w15:paraId", m_oParaId )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w15:paraIdParent", m_oParaIdParent )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w15:done", m_oDone )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -418,7 +418,10 @@ namespace OOX
virtual ~CCommentsExt()
{
for(size_t i = 0, length = m_arrComments.size(); i < length; ++i)
{
if (m_arrComments[i]) delete m_arrComments[i];
m_arrComments[i] = NULL;
}
m_arrComments.clear();
}
virtual void read(const CPath& oFilePath)
@ -434,13 +437,13 @@ namespace OOX
return;
std::wstring sName = oReader.GetName();
if ( _T("w15:commentsEx") == sName && !oReader.IsEmptyNode() )
if ( L"w15:commentsEx" == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w15:commentEx") == sName )
if ( L"w15:commentEx" == sName )
m_arrComments.push_back( new CCommentExt(oReader) );
}
}
@ -476,10 +479,10 @@ namespace OOX
virtual ~CPresenceInfo()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -488,7 +491,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -499,11 +502,10 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:providerId"), m_oProviderId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:userId"), m_oUserId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w15:providerId", m_oProviderId )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w15:userId", m_oUserId )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -522,10 +524,10 @@ namespace OOX
virtual ~CPerson()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -536,13 +538,13 @@ namespace OOX
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if ( _T("w15:presenceInfo") == sName )
if ( L"w15:presenceInfo" ==sName )
m_oPresenceInfo = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -553,10 +555,9 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:author"), m_oAuthor )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w15:author", m_oAuthor )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -592,13 +593,13 @@ namespace OOX
return;
std::wstring sName = oReader.GetName();
if ( _T("w15:people") == sName && !oReader.IsEmptyNode() )
if ( L"w15:people" == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w15:person") == sName )
if ( L"w15:person" == sName )
m_arrPeoples.push_back( new CPerson(oReader) );
}
}

View File

@ -38,7 +38,7 @@
#include "../../DocxFormat/IFileContainer.h"
#include <map>
#include <unordered_map>
namespace OOX
{
@ -74,7 +74,7 @@ namespace OOX
return m_nRow.IsInit() && m_nCol.IsInit() && m_sAuthor.IsInit();
}
};
class CAuthors : public WritingElementWithChilds<std::wstring>
class CAuthors : public WritingElement
{
public:
WritingElement_AdditionConstructors(CAuthors)
@ -83,43 +83,49 @@ namespace OOX
}
virtual ~CAuthors()
{
ClearItems();
}
virtual void ClearItems()
{
m_mapItems.clear();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(L"<authors>");
for ( SpreadsheetElemArray::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
for ( std::unordered_map<int, std::wstring>::const_iterator it = m_mapItems.begin(); it != m_mapItems.end(); it++)
{
if ( *it )
{
writer.WriteString(L"<author>");
writer.WriteEncodeXmlString(*(*it));
writer.WriteString(L"</author>");
}
writer.WriteString(L"<author>");
writer.WriteEncodeXmlString(it->second);
writer.WriteString(L"</author>");
}
writer.WriteString(L"</authors>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int index = 0;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("author") == sName )
m_arrItems.push_back(new std::wstring(oReader.GetText3()));
if ( L"author" == sName )
{
m_mapItems.insert(std::make_pair(index++, oReader.GetText3()));
}
}
}
@ -132,6 +138,8 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
std::unordered_map<int, std::wstring> m_mapItems;
};
class CComment : public WritingElement
{
@ -148,7 +156,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
@ -190,13 +198,10 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), m_oRef )
WritingElement_ReadAttributes_Read_if ( oReader, _T("authorId"), m_oAuthorId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"ref", m_oRef )
WritingElement_ReadAttributes_Read_if ( oReader, L"authorId", m_oAuthorId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId > m_oRef;
@ -219,7 +224,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
@ -247,7 +252,7 @@ namespace OOX
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("comment") == sName )
if ( L"comment" == sName )
m_arrItems.push_back(new CComment(oReader));
}
}
@ -277,8 +282,6 @@ namespace OOX
virtual ~CComments()
{
}
public:
virtual void read(const CPath& oPath)
{
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
@ -299,7 +302,7 @@ namespace OOX
return;
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("comments") == sName )
if ( L"comments" == sName )
{
ReadAttributes( oReader );
@ -310,9 +313,9 @@ namespace OOX
{
sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("authors") == sName )
if ( L"authors" == sName )
m_oAuthors = oReader;
else if ( _T("commentList") == sName )
else if ( L"commentList" == sName )
m_oCommentList = oReader;
}
}
@ -321,12 +324,12 @@ namespace OOX
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"));
sXml.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
if(m_oAuthors.IsInit())
m_oAuthors->toXML(sXml);
if(m_oCommentList.IsInit())
m_oCommentList->toXML(sXml);
sXml.WriteString(_T("</comments>"));
sXml.WriteString(L"</comments>");
std::wstring sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath, sXml.GetData());
@ -375,7 +378,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
@ -403,12 +406,9 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"r:id", m_oId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId > m_oId;

View File

@ -189,7 +189,7 @@ namespace OOX
}
void PrepareComments(OOX::Spreadsheet::CComments* pComments, OOX::CVmlDrawing* pVmlDrawing)
{
std::list<std::wstring*> & aAuthors = pComments->m_oAuthors->m_arrItems;
std::unordered_map<int, std::wstring> & mapAuthors = pComments->m_oAuthors->m_mapItems;
if(pComments->m_oCommentList.IsInit())
{
@ -212,12 +212,12 @@ namespace OOX
unsigned int nAuthorId = pComment->m_oAuthorId->GetValue();
std::list<std::wstring*>::iterator itA = aAuthors.begin();
for(int a = 0; a < nAuthorId; a++)
itA++;
if(itA != aAuthors.end())
pCommentItem->m_sAuthor = *itA;
std::unordered_map<int, std::wstring>::iterator pFind = mapAuthors.find(nAuthorId);
if (pFind != mapAuthors.end())
{
pCommentItem->m_sAuthor = pFind->second;
}
OOX::Spreadsheet::CSi* pSi = pComment->m_oText.GetPointerEmptyNullable();
if(NULL != pSi)

View File

@ -621,7 +621,7 @@ namespace OOX
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_arrItems.empty())
if(m_arrItems.empty()) return;
writer.WriteString(_T("<sheetViews>"));

View File

@ -53,6 +53,7 @@
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="0"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\agg2d.pch"
ObjectFile="$(ConfigurationName)\"

View File

@ -502,6 +502,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -50,6 +50,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -343,7 +343,8 @@
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -337,8 +337,10 @@
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -345,6 +345,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -50,6 +50,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"

View File

@ -48,8 +48,10 @@
Optimization="0"
AdditionalIncludeDirectories="..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -196,6 +196,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -51,6 +51,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -199,6 +199,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -499,8 +499,10 @@
Optimization="0"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
DisableLanguageExtensions="true"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)/"

View File

@ -212,10 +212,11 @@
Optimization="0"
AdditionalIncludeDirectories="&quot;../agg-2.4/include&quot;;&quot;../freetype-2.5.2/include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;$(NOINHERIT)"
MinimalRebuild="false"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="0"
EnableEnhancedInstructionSet="0"
DisableLanguageExtensions="false"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"

View File

@ -47,6 +47,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\vc80.pdb"

View File

@ -496,6 +496,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -47,6 +47,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -48,6 +48,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -3882,8 +3882,7 @@ namespace NExtractTools
}
else
{
sTempDir = NSDirectory::GetFolderPath(sFileFrom) + FILE_SEPARATOR_STR + _T("Temp");
NSDirectory::CreateDirectory(sTempDir);
sTempDir = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetFolderPath(sFileTo));
}
if (sTempDir.empty())
{

View File

@ -49,6 +49,7 @@
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\X2tTestD.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"

View File

@ -187,7 +187,7 @@ namespace BinXlsxRW
WriteFilterColumns(oAutofilter.m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
}
if(!oAutofilter.m_oSortState.IsInit())
if(oAutofilter.m_oSortState.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_AutoFilter::SortState);
WriteSortState(oAutofilter.m_oSortState.get());

View File

@ -74,22 +74,30 @@ namespace BinXlsxRW {
{
bool bEmpty = true;
SimpleTypes::Spreadsheet::CHexColor oRgbColor;
if(color.m_oIndexed.IsInit())
{
int nIndex = (int)color.m_oIndexed->GetValue();
bool bDefault = true;
std::map<int, OOX::Spreadsheet::CRgbColor*>::iterator pFind = pIndexedColors->mapIndexedColors.find(nIndex);
if(pFind != pIndexedColors->mapIndexedColors.end())
if (pIndexedColors)
{
OOX::Spreadsheet::CRgbColor* pRgbColor = pFind->second;
if(pRgbColor->m_oRgb.IsInit())
std::map<int, OOX::Spreadsheet::CRgbColor*>::iterator pFind = pIndexedColors->mapIndexedColors.find(nIndex);
if(pFind != pIndexedColors->mapIndexedColors.end())
{
bEmpty = false;
oRgbColor = pRgbColor->m_oRgb.get();
OOX::Spreadsheet::CRgbColor* pRgbColor = pFind->second;
if(pRgbColor->m_oRgb.IsInit())
{
bEmpty = false;
oRgbColor = pRgbColor->m_oRgb.get();
bDefault = false;
}
}
}
else
if (bDefault)
{
unsigned char ucA;
unsigned char ucR;

View File

@ -2535,14 +2535,14 @@ namespace BinXlsxRW {
{
m_pCurVmlDrawing->m_mapComments = &m_pCurWorksheet->m_mapComments;
std::map<std::wstring, unsigned int> mapAuthors;
std::map<std::wstring, unsigned int> mapByAuthors;
OOX::Spreadsheet::CComments* pComments = new OOX::Spreadsheet::CComments();
pComments->m_oCommentList.Init();
std::list<OOX::Spreadsheet::CComment*>& aComments = pComments->m_oCommentList->m_arrItems;
pComments->m_oAuthors.Init();
std::list<std::wstring*>& aAuthors = pComments->m_oAuthors->m_arrItems;
std::unordered_map<int, std::wstring> & mapByIndex = pComments->m_oAuthors->m_mapItems;
for (std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>::const_iterator it = m_pCurWorksheet->m_mapComments.begin(); it != m_pCurWorksheet->m_mapComments.end(); ++it)
{
@ -2559,15 +2559,18 @@ namespace BinXlsxRW {
if(pCommentItem->m_sAuthor.IsInit())
{
const std::wstring& sAuthor = pCommentItem->m_sAuthor.get();
std::map<std::wstring, unsigned int>::const_iterator pair = mapAuthors.find(sAuthor);
std::map<std::wstring, unsigned int>::const_iterator pFind = mapByAuthors.find(sAuthor);
int nAuthorId;
if(mapAuthors.end() != pair)
nAuthorId = (int)pair->second;
if(pFind != mapByAuthors.end())
nAuthorId = pFind->second;
else
{
nAuthorId = (int)mapAuthors.size();
mapAuthors[sAuthor] = nAuthorId;
aAuthors.push_back(new std::wstring(sAuthor));
nAuthorId = (int)mapByAuthors.size();
mapByAuthors.insert(std::make_pair(sAuthor, nAuthorId));
mapByIndex.insert(std::make_pair(nAuthorId, sAuthor));
}
pNewComment->m_oAuthorId.Init();
pNewComment->m_oAuthorId->SetValue(nAuthorId);