Compare commits

..

7 Commits

Author SHA1 Message Date
ff9ef8f941 PptFormatReader - fix users files 2018-10-23 13:19:30 +03:00
0a2401471e [x2t] Fix bug 39391
Fix writing only last ConditionalFormatting from Editor.bin
2018-10-23 11:37:06 +03:00
e55dc5ea75 . 2018-10-22 15:47:09 +03:00
fef30772fd OdfFormatWriter - fix after testing 2018-10-21 18:10:29 +03:00
8bae2e3255 . 2018-10-19 14:25:35 +03:00
35113a76ca . 2018-10-19 12:10:06 +03:00
f776bb6c4e OdfFormatWriter - fix after testing 2018-10-19 10:36:02 +03:00
26 changed files with 699 additions and 159 deletions

View File

@ -202,20 +202,25 @@ void xlsx_drawing_context::end_group()
{
if (impl_->groups_.size() < 1) return;
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
group_rect.cy -= group_rect.y;
group_rect.cx -= group_rect.x;
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
if (impl_->groups_.back()->svg_rect_)
{
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
r.y -= group_rect.y;
r.x -= group_rect.x;
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
group_rect.cy -= group_rect.y;
group_rect.cx -= group_rect.x;
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
{
if (!impl_->groups_.back()->child_objects_[i].svg_rect_) continue;
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
r.y -= group_rect.y;
r.x -= group_rect.x;
}
}
if (impl_->groups_.back()->in_group_)
if (impl_->groups_.back()->in_group_ && impl_->groups_.back()->svg_rect_)
{
_rect & objct_rect = impl_->groups_.back()->svg_rect_.get();
@ -251,7 +256,8 @@ void xlsx_drawing_context::start_drawing(std::wstring const & name)
void xlsx_drawing_context::end_drawing()
{
if (impl_->object_description_.in_group_)
if (impl_->object_description_.in_group_ &&
impl_->object_description_.svg_rect_)
{
_rect & objct_rect = impl_->object_description_.svg_rect_.get();
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();

View File

@ -209,7 +209,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"" , 7}, // shapetypeStar6,
{ L"" , 7}, // shapetypeStar7,
{ L"star8" , 7}, // shapetypeStar8,
{ L"mso-spt32" , 9}, // shapetypeStraightConnector1,
{ L"" , 7}, // shapetypeStraightConnector1,
{ L"striped-right-arrow" , 7}, // shapetypeStripedRightArrow,
{ L"" , 7}, // shapetypeSun,
{ L"" , 7}, // shapetypeSwooshArrow,

View File

@ -33,5 +33,16 @@
namespace cpdoccore
{
class oox_shape_StraightConnector1 : public oox_shape
{
public:
oox_shape_StraightConnector1()
{
odf_type_name =L"ooxml-straightConnector1";
enhanced_path = L"M 0 0 L 21600 21600 N";
view_box = L"0 0 21600 21600";
}
};
}

View File

@ -33,7 +33,6 @@
// shapetypeIrregularSeal1,
// shapetypeIrregularSeal2,
// + // shapetypeSun,
// shapetypeWave,
namespace cpdoccore
{
class oox_shape_sun : public oox_shape

View File

@ -58,6 +58,7 @@
//+ shapetypeTrapezoid
//+ shapetypeBlockArc
//+ shapetypeDonut
//+ shapetypeFrame
#include "../oox_shape_defines.h"
@ -1590,4 +1591,36 @@ public:
handles.push_back(h1);
}
};
class oox_shape_Frame : public oox_shape
{
public:
oox_shape_Frame()
{
odf_type_name =L"ooxml-frame";
modifiers = L"12500";
enhanced_path = L"M 0 0 L ?f8 0 ?f8 ?f7 0 ?f7 Z M ?f2 ?f2 L ?f2 ?f4 ?f3 ?f4 ?f3 ?f2 Z N";
text_areas = L"?f2 ?f2 ?f3 ?f4";
view_box = L"0 0 0 0";
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"min(logwidth,logheight)");
add(L"f2", L"?f1 *?f0 /100000");
add(L"f3", L"logwidth+0-?f2 ");
add(L"f4", L"logheight+0-?f2 ");
add(L"f5", L"logwidth/2");
add(L"f6", L"logheight/2");
add(L"f7", L"logheight");
add(L"f8", L"logwidth");
_handle h2;
h2.position = L"?f2 0";
h2.y_maximum= L"50000";
handles.push_back(h2);
/////////////////////////////////////////////////////////
}
};
}

View File

@ -926,6 +926,37 @@ void odf_drawing_context::end_shape()
if (line->draw_line_attlist_.svg_y1_ && impl_->current_drawing_state_.svg_height_ && !line->draw_line_attlist_.svg_y2_)
line->draw_line_attlist_.svg_y2_ = line->draw_line_attlist_.svg_y1_.get() + impl_->current_drawing_state_.svg_height_.get();
if (impl_->current_drawing_state_.rotateAngle_)
{
std::wstring strTransform;
odf_types::length x11 = odf_types::length((line->draw_line_attlist_.svg_x1_->get_value() + line->draw_line_attlist_.svg_x2_->get_value()) / 2., line->draw_line_attlist_.svg_x2_->get_unit());
odf_types::length y11 = odf_types::length((line->draw_line_attlist_.svg_y1_->get_value() + line->draw_line_attlist_.svg_y2_->get_value()) / 2., line->draw_line_attlist_.svg_y2_->get_unit());
//if (impl_->current_drawing_state_.in_group_)
{
if (line->draw_line_attlist_.svg_x1_&& line->draw_line_attlist_.svg_y1_)
{
strTransform += std::wstring(L" translate(-") + boost::lexical_cast<std::wstring>(x11)
+ std::wstring(L",-") + boost::lexical_cast<std::wstring>(y11)
+ std::wstring(L")" );
}
}
strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle_.get()) + std::wstring(L")");
if (line->draw_line_attlist_.svg_x1_&& line->draw_line_attlist_.svg_y1_)
{
strTransform += std::wstring(L" translate(") + boost::lexical_cast<std::wstring>(x11)
+ std::wstring(L",") + boost::lexical_cast<std::wstring>(y11)
+ std::wstring(L")" );
}
if (strTransform.empty() == false)
{
line->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_ = strTransform;
}
impl_->current_drawing_state_.rotateAngle_ = boost::none;
}
impl_->current_drawing_state_.svg_height_ = boost::none;
impl_->current_drawing_state_.svg_width_ = boost::none;
@ -2045,14 +2076,24 @@ void odf_drawing_context::set_line_tail(int type, int len, int width)
impl_->current_graphic_properties->draw_marker_end_ = add_marker_style(type);
switch(width)
if (impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.4, length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.3, length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.2, length::cm); break;
double sz_x =impl_->current_drawing_state_.svg_width_->get_value_unit(odf_types::length::pt);
double sz_y =impl_->current_drawing_state_.svg_height_->get_value_unit(odf_types::length::pt);
impl_->current_graphic_properties->draw_marker_end_width_ = length((std::max)(sz_x, sz_y) / 10., odf_types::length::pt);
}
if (!impl_->current_graphic_properties->draw_marker_end_width_)
{
switch(width)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.4, length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.3, length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.2, length::cm); break;
}
}
}
void odf_drawing_context::set_line_head(int type, int len, int width)
@ -2061,14 +2102,24 @@ void odf_drawing_context::set_line_head(int type, int len, int width)
impl_->current_graphic_properties->draw_marker_start_ = add_marker_style(type);
switch(width)
if (impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.4, length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.3, length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.2, length::cm); break;
double sz_x =impl_->current_drawing_state_.svg_width_->get_value_unit(odf_types::length::pt);
double sz_y =impl_->current_drawing_state_.svg_height_->get_value_unit(odf_types::length::pt);
impl_->current_graphic_properties->draw_marker_start_width_ = length((std::max)(sz_x, sz_y) / 10., odf_types::length::pt);
}
if (!impl_->current_graphic_properties->draw_marker_start_width_)
{
switch(width)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.4, length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.3, length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.2, length::cm); break;
}
}
}

View File

@ -328,28 +328,36 @@ void ods_conversion_context::add_merge_cells(const std::wstring & ref)
std::vector<std::wstring> ref_cells;
boost::algorithm::split(ref_cells,ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (ref_cells.size() !=2) return;//тута однозначно .. по правилам оох
if (ref_cells.size() != 2) return;//тута однозначно .. по правилам оохml
int start_col = -1, start_row = -1;
int end_col = -1, end_row = -1;
utils::parsing_ref (ref_cells[0], start_col, start_row);
utils::parsing_ref (ref_cells[1], end_col, end_row);
utils::parsing_ref (ref_cells[1], end_col, end_row);
current_table().set_merge_cells(start_col,start_row, end_col, end_row);
current_table().set_merge_cells(start_col, start_row, end_col, end_row);
}
void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
{
int col = 0, row = 0;
utils::parsing_ref ( ref, col,row);
int col = 0, row = 0, spanned_rows = 0, spanned_cols = 0;
utils::parsing_ref ( ref, col, row);
if (col > current_table().current_column()+1)
bool bCovered = false;
bool bSpanned = current_table().isSpannedCell(col, row, spanned_cols, spanned_rows);
if (!bSpanned)
{
int repeated = col - current_table().current_column() -1;
bCovered = current_table().isCoveredCell(col, row);
}
if (col > current_table().current_column() + 1)
{
int repeated = col - current_table().current_column() - 1;
current_table().add_default_cell(repeated);
current_table().add_default_cell(repeated);//, bCovered);
}
office_element_ptr style_elm;
@ -360,7 +368,7 @@ void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
if ( xfd_style >=0)
{
odf_style_state_ptr style_state;
styles_context()->find_odf_style_state(xfd_style, style_family::TableCell,style_state, false, true);
styles_context()->find_odf_style_state(xfd_style, style_family::TableCell, style_state, false, true);
if (style_state)
{
style_elm = style_state->get_office_element();
@ -376,11 +384,26 @@ void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
}
office_element_ptr cell_elm;
create_element(L"table", L"table-cell",cell_elm,this);
if (bCovered)
{
create_element(L"table", L"covered-table-cell", cell_elm, this);
}
else
{
create_element(L"table", L"table-cell", cell_elm, this);
}
current_table().start_cell(cell_elm, style_elm);
current_table().set_cell_format_value(format_value_type);
if (bSpanned)
{
current_table().set_cell_spanned(spanned_cols, spanned_rows);
}
if (!bCovered)
{
current_table().set_cell_format_value(format_value_type);
}
}
void ods_conversion_context::end_cell()
@ -412,12 +435,12 @@ void ods_conversion_context::end_columns()
//add default last column - ЕСЛИ они не прописаны в исходном (1024 - от балды)
//вопрос - если и добавлять то с каким стилем???
//if (current_table().current_column() < 1 )
// add_column(current_table().current_column()+1,1024,0,true);
// add_column(current_table().current_column() + 1,1024, 0, true);
//else
int repeat = (std::max)(current_table().dimension_columns,1024) - current_table().current_column();
int repeat = (std::max)(current_table().dimension_columns, 1024) - current_table().current_column();
if (repeat < 0) repeat = 1;
add_column(current_table().current_column()+1,repeat,0,true);
add_column(current_table().current_column() + 1, repeat, 0, true);
}
void ods_conversion_context::start_rows()
{

View File

@ -259,6 +259,7 @@ void ods_table_context::start_table(office_element_ptr & elm)
void ods_table_context::end_table()
{
state().check_spanned_cells();
}
}

View File

@ -265,7 +265,7 @@ void ods_table_state::add_column(office_element_ptr & elm, unsigned int repeated
ods_element_state state(elm, repeated, style_name, style_elm, defaut_column_width_, current_level_.size());
if (repeated > 10000)repeated = 1024;//????
//if (repeated > 10000) repeated = 1024;//????
current_table_column_ += repeated;
columns_.push_back(state);
@ -344,6 +344,17 @@ void ods_table_state::add_row(office_element_ptr & elm, unsigned int repeated, o
{
current_table_column_ = 0;
current_table_row_ += repeated;
current_covered_cols_ = 0;
for (size_t i = 0; i < current_covered_rows_.size(); ++i)
{
current_covered_rows_[i].count_rows--;
if (current_covered_rows_[i].count_rows <= 0)
{
current_covered_rows_.erase(current_covered_rows_.begin() + i);
i--;
}
}
current_level_.back()->add_child_element(elm);
@ -373,6 +384,16 @@ void ods_table_state::add_row_repeated()
unsigned int t = rows_.back().repeated;
rows_.back().repeated++;
current_table_row_++;
for (size_t i = 0; i < current_covered_rows_.size(); ++i)
{
current_covered_rows_[i].count_rows--;
if (current_covered_rows_[i].count_rows <= 0)
{
current_covered_rows_.erase(current_covered_rows_.begin() + i);
i--;
}
}
row->table_table_row_attlist_.table_number_rows_repeated_ = rows_.back().repeated;
}
void ods_table_state::set_row_hidden(bool Val)
@ -506,22 +527,24 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr &
{
current_row_element()->add_child_element(elm);
table_table_cell* cell = dynamic_cast<table_table_cell*>(elm.get());
if (cell == NULL)return;
std::wstring style_name;
odf_writer::style* style = dynamic_cast<odf_writer::style*>(style_elm.get());
if (style)style_name = style->style_name_;
else style_name = row_default_cell_style_name_;
if (style) style_name = style->style_name_;
else style_name = row_default_cell_style_name_;
if (style_name.length() > 0 && style_name != get_column_default_cell_style(current_column()))
table_table_cell* cell = dynamic_cast<table_table_cell*>(elm.get());
if (cell && !style_name.empty() && style_name != get_column_default_cell_style(current_column()))
{
cell->table_table_cell_attlist_.table_style_name_= style_name;
cell->table_table_cell_attlist_.table_style_name_ = style_name;
}
table_covered_table_cell* covered_cell = dynamic_cast<table_covered_table_cell*>(elm.get());
if (covered_cell && !style_name.empty() && style_name != get_column_default_cell_style(current_column()))
{
covered_cell->table_table_cell_attlist_.table_style_name_ = style_name;
}
ods_cell_state state;
state.empty = true;
state.elm = elm; state.repeated = 1; state.style_name = style_name; state.style_elm = style_elm;
state.row = current_table_row_; state.col = current_table_column_ + 1;
@ -532,6 +555,9 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr &
current_table_column_ += state.repeated;
cells_.push_back(state);
cells_size_++;
if (current_covered_cols_ > 0 && covered_cell)
current_covered_cols_--;
}
void ods_table_state::set_cell_format_value(office_value_type::type value_type)
@ -644,40 +670,133 @@ void ods_table_state::end_comment(odf_text_context *text_context)
}
}
void ods_table_state::set_merge_cells(int start_col, int start_row, int end_col, int end_row)
void ods_table_state::check_spanned_cells()
{
//потом можно переделать (оптимизировать) - добавлять мержи при добавлении ячеек
//всяко выгоднее хранить данные о мержах, а не шерстить каждый раз ВСЕ ячейки для добавления фенечки
//todooo
//разобраться когда нужно писать covered_cell
if (end_col - start_col < 0)return;
if (end_row - start_row < 0)return;
int spanned_cols = end_col - start_col + 1;
int spanned_rows = end_row - start_row + 1;
if (spanned_cols > 10000)spanned_cols = 1024;
for (size_t i = 0; i < cells_.size(); ++i)
for (std::map<int, std::map<int, _spanned_info>>::iterator it = map_merged_cells.begin(); it != map_merged_cells.end(); ++it)
{
if (cells_[i].row > end_row) break;
for (std::map<int, _spanned_info>::iterator jt = it->second.begin(); jt != it->second.end(); ++jt)
{
int start_row = it->first;
int end_row = it->first + jt->second.spanned_rows;
if (cells_[i].row >= start_row)
{
if (cells_[i].col >= start_col)
int start_col = jt->first;
int end_col = jt->first + jt->second.spanned_cols;
for (size_t i = 0; i < cells_.size(); ++i)
{
table_table_cell* cell_elm = dynamic_cast<table_table_cell*>(cells_[i].elm.get());
if (cell_elm == NULL)return;
if (cells_[i].row > end_row) break;
cell_elm->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned_cols;
cell_elm->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned_rows;
if (cells_[i].row >= start_row)
{
if (cells_[i].col >= start_col)
{
table_table_cell* cell_elm = dynamic_cast<table_table_cell*>(cells_[i].elm.get());
if (cell_elm == NULL)break;
break;
cell_elm->table_table_cell_attlist_extra_.table_number_columns_spanned_ = jt->second.spanned_cols;
cell_elm->table_table_cell_attlist_extra_.table_number_rows_spanned_ = jt->second.spanned_rows;
break;
}
}
}
}
}
}
void ods_table_state::set_merge_cells(int start_col, int start_row, int end_col, int end_row)
{
if (end_col - start_col < 0) return;
if (end_row - start_row < 0) return;
_spanned_info info;
info.spanned_cols = end_col - start_col + 1;
info.spanned_rows = end_row - start_row + 1;
//if (info.spanned_cols > 10000) info.spanned_cols = 1024;
std::map<int, std::map<int, _spanned_info>>::iterator pFindRow = map_merged_cells.find(start_row);
if (pFindRow == map_merged_cells.end())
{
std::map<int, _spanned_info> mapCols;
mapCols.insert(std::make_pair(start_col, info));
map_merged_cells.insert(std::make_pair(start_row, mapCols));
}
else
{
std::map<int, _spanned_info>::iterator pFindCol = pFindRow->second.find(start_col);
if (pFindCol == pFindRow->second.end())
{
pFindRow->second.insert(std::make_pair(start_col, info));
}
//else нереально pFindCol->second.insert(info);
}
}
bool ods_table_state::isSpannedCell(int col, int row, int &spanned_cols, int &spanned_rows )
{
spanned_cols = spanned_rows = 0;
std::map<int, std::map<int, _spanned_info>>::iterator pFindRow = map_merged_cells.find(row);
if (pFindRow != map_merged_cells.end())
{
std::map<int, _spanned_info>::iterator pFindCol = pFindRow->second.find(col);
if (pFindCol != pFindRow->second.end())
{
spanned_cols = pFindCol->second.spanned_cols;
spanned_rows = pFindCol->second.spanned_rows;
current_covered_cols_ = spanned_cols - 1;
if (spanned_rows > 1 && current_covered_cols_ > 0)
{
_covered_info info;
info.start_col = current_table_column_;
info.count_cols = spanned_cols;
info.count_rows = spanned_rows - 1;
current_covered_rows_.push_back(info);
}
pFindRow->second.erase(pFindCol);
if (pFindRow->second.empty())
{
map_merged_cells.erase(pFindRow);
}
return true;
}
}
return false;
}
bool ods_table_state::isCoveredCell( int col, int repeated_cols)
{
if (current_covered_cols_ > 0) return true;
for (size_t i = 0; i < current_covered_rows_.size(); i++)
{
if (current_covered_rows_[i].start_col <= col && col < current_covered_rows_[i].start_col + current_covered_rows_[i].count_cols)
{
current_covered_cols_ = current_covered_rows_[i].count_cols - (col - current_covered_rows_[i].start_col);
return true;
}
}
return false;
}
void ods_table_state::set_cell_spanned(int spanned_cols, int spanned_rows)
{
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
if (cell == NULL)return;
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned_cols;
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned_rows;
}
void ods_table_state::set_cell_formula(std::wstring & formula)
{
if (formula.length() < 1)return;
@ -838,8 +957,8 @@ void ods_table_state::set_cell_array_formula(std::wstring & formula, std::wstrin
std::vector<std::wstring> ref_cells;
boost::algorithm::split(ref_cells,ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
int row_span =0;
int col_span =0;
int row_span = 0;
int col_span = 0;
if (ref_cells.size() ==2)
{
@ -859,7 +978,7 @@ void ods_table_state::set_cell_array_formula(std::wstring & formula, std::wstrin
row_span = col_span = 1;//???
}
if (col_span >0 && row_span > 0)
if (col_span > 0 && row_span > 0)
{
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
if (cell == NULL)return;
@ -1053,7 +1172,7 @@ void ods_table_state::set_cell_value(const std::wstring & value, bool need_cash)
void ods_table_state::end_cell()
{
if ( cells_size_ <1)return;
if ( cells_size_ < 1)return;
if (cells_.back().comment_idx >= 0)
{
@ -1070,6 +1189,8 @@ void ods_table_state::end_cell()
void ods_table_state::add_default_cell( unsigned int repeated)
{
if (repeated < 1) return;
int comment_idx = is_cell_comment(current_table_column_ + 1, current_table_row_, repeated);
if (comment_idx >= 0 && repeated > 1)
{
@ -1084,32 +1205,120 @@ void ods_table_state::add_default_cell( unsigned int repeated)
}
//////////////////////////////////////////////////
std::map<int, std::map<int, _spanned_info>>::iterator pFindRow = map_merged_cells.find(current_table_row_);
bool bSpanned = false;
if (pFindRow != map_merged_cells.end())
{
for (std::map<int, _spanned_info>::iterator it = pFindRow->second.begin(); !bSpanned && it != pFindRow->second.end(); ++it)
{
if (it->first < current_table_column_ + repeated + 1 && it->first >= current_table_column_ + 1)
{
if (repeated > 1)
{
//делим на 3 - до, с spanned, после;
int c = current_table_column_;
add_default_cell(it->first - c - 1);
add_default_cell(1);
add_default_cell(repeated + c + 1 - it->first);
return;
}
else
{
bSpanned = true;
break;
}
}
}
}
bool bCovered = false;
if (!bSpanned)
{
for (size_t i = 0; i < current_covered_rows_.size(); i++)
{
if (current_covered_rows_[i].start_col <= current_table_column_ && current_table_column_ + repeated <= current_covered_rows_[i].start_col + current_covered_rows_[i].count_cols)
{
current_covered_cols_ = current_covered_rows_[i].start_col + current_covered_rows_[i].count_cols - current_table_column_;
bCovered = true;
break;
}
else if (!( current_table_column_ + repeated < current_covered_rows_[i].start_col ||
current_table_column_ > current_covered_rows_[i].start_col + current_covered_rows_[i].count_cols))
{
int c = current_table_column_;
int split = current_covered_rows_[i].start_col > current_table_column_ ? current_covered_rows_[i].start_col :
current_covered_rows_[i].start_col + current_covered_rows_[i].count_cols;
if (split != current_table_column_ && split != current_table_column_ + repeated)
{
add_default_cell(split - c);
add_default_cell(repeated + c - split);
return;
}
}
}
}
office_element_ptr default_cell_elm;
create_element(L"table", L"table-cell", default_cell_elm, context_);
if (bCovered)
{
create_element(L"table", L"covered-table-cell", default_cell_elm, context_);
}
else
{
create_element(L"table", L"table-cell", default_cell_elm, context_);
}
current_row_element()->add_child_element(default_cell_elm);
table_table_cell* cell = dynamic_cast<table_table_cell*>(default_cell_elm.get());
if (cell == NULL)return;
table_covered_table_cell* covered_cell = dynamic_cast<table_covered_table_cell*>(default_cell_elm.get());
if (bSpanned)
{
int spanned_rows = 0, spanned_cols = 0;
if (cell && isSpannedCell(current_table_column_, current_table_row_, spanned_cols, spanned_rows))
{
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned_cols;
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned_rows;
}
}
ods_cell_state state;
state.empty = true;
state.elm = default_cell_elm; state.repeated = repeated;
state.row=current_table_row_; state.col =current_table_column_+ 1;
state.elm = default_cell_elm;
state.repeated = repeated;
state.row = current_table_row_;
state.col = current_table_column_ + 1;
state.hyperlink_idx = is_cell_hyperlink(state.col, current_table_row_);
state.comment_idx = comment_idx;
cells_.push_back(state);
cells_size_++;
current_table_column_+= state.repeated;
current_table_column_ += state.repeated;
cell->table_table_cell_attlist_.table_number_columns_repeated_ = repeated;
if (cell)
{
cell->table_table_cell_attlist_.table_number_columns_repeated_ = repeated;
if (row_default_cell_style_name_.length() > 0)
cell->table_table_cell_attlist_.table_style_name_ = row_default_cell_style_name_;
if (!row_default_cell_style_name_.empty())
cell->table_table_cell_attlist_.table_style_name_ = row_default_cell_style_name_;
}
if (covered_cell)
{
covered_cell->table_table_cell_attlist_.table_number_columns_repeated_ = repeated;
if (!row_default_cell_style_name_.empty())
covered_cell->table_table_cell_attlist_.table_style_name_ = row_default_cell_style_name_;
current_covered_cols_ -= repeated;
}
end_cell();
}
///////////////////////////////////////////////////

View File

@ -277,16 +277,22 @@ public:
void set_row_default_cell_style(std::wstring & style_name);
void add_row_repeated();
bool isSpannedCell(int col, int row, int &spanned_cols, int &spanned_rows );
bool isCoveredCell(int col, int repeated_cols = 1);
void start_cell(office_element_ptr & elm ,office_element_ptr & style);
void end_cell();
void add_default_cell(unsigned int repeated);
void check_spanned_cells();
void set_cell_format_value(odf_types::office_value_type::type value_type);
void set_cell_type(int type);
void set_cell_value(const std::wstring & value, bool need_cash = false);
void set_cell_text(odf_text_context *text_context, bool cash_value = false);
void set_cell_formula(std::wstring &formula);
void set_cell_array_formula(std::wstring & formula, std::wstring ref);
void set_cell_spanned(int spanned_cols, int spanned_rows);
void add_or_find_cell_shared_formula(std::wstring & formula, std::wstring ref, int ind);
static std::wstring replace_cell_row(boost::wsmatch const & what);
@ -349,13 +355,28 @@ public:
std::vector<ods_comment_state> comments_;
private:
struct _spanned_info
{
int spanned_cols = 0;
int spanned_rows = 0;
int state = 0;
};
struct _covered_info
{
int start_col = 0;
int count_cols = 0;
int count_rows = 0; // от текущей строки
};
std::vector<_covered_info> current_covered_rows_;
int current_covered_cols_;
odf_conversion_context * context_;
office_element_ptr office_table_;
style* office_table_style_;//??? может хранить как office_element_ptr ???
office_element_ptr table_defined_expressions_;
std::wstring row_default_cell_style_name_;
static int current_table_column_;
@ -366,6 +387,8 @@ private:
std::vector<ods_element_state> columns_;
std::vector<ods_element_state> rows_;
std::map<int, std::map<int, _spanned_info>> map_merged_cells;
std::vector<office_element_ptr> current_level_;//постоянно меняющийся список уровней ("0-й элемент - сама таблица)

View File

@ -136,6 +136,8 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
case SimpleTypes::shapetypeBentUpArrow: return boost::make_shared<oox_shape_BentUpArrow>();
case SimpleTypes::shapetypeLeftRightUpArrow: return boost::make_shared<oox_shape_leftRightUpArrow>();
case SimpleTypes::shapetypeStraightConnector1: return boost::make_shared<oox_shape_StraightConnector1>();
case SimpleTypes::shapetypeFrame: return boost::make_shared<oox_shape_Frame>();
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):
//case (2001 + SimpleTypes::textshapetypeTextArchUp):
@ -176,7 +178,6 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
//case (2001 + SimpleTypes::textshapetypeTextWave1):
//case (2001 + SimpleTypes::textshapetypeTextWave2):
//case (2001 + SimpleTypes::textshapetypeTextWave4):
//case SimpleTypes::shapetypeStraightConnector1: return boost::make_shared<oox_shape_straightConnector1>();
default:
if (ooxPrstGeomType > 2000) return boost::make_shared<oox_shape_textPlain>();

View File

@ -45,6 +45,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaModFix.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h"
@ -513,9 +514,11 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr)
if (oox_grpSpPr->xfrm->rot.IsInit())
odf_context()->drawing_context()->set_group_rotate(oox_grpSpPr->xfrm->rot.get() / 60000.);
}
convert(oox_grpSpPr->EffectList.List.GetPointer());
convert(oox_grpSpPr->scene3d.GetPointer());
//UniFill Fill;
//EffectProperties EffectList;
//nullable<Scene3d> scene3d;
}
void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree)
@ -713,23 +716,14 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
}
odf_context()->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------------------------------
PPTX::Logic::EffectLst* effectLst = NULL;
PPTX::Logic::EffectLst* effectLst = dynamic_cast<PPTX::Logic::EffectLst*>(oox_spPr->EffectList.List.GetPointer());
if (oox_spPr->EffectList.is<PPTX::Logic::EffectLst>())
{
effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
}
if (effectLst) convert(effectLst);
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
//convert(oox_spPr->ExtLst.GetPointer());
convert(oox_spPr->scene3d.GetPointer());
convert(oox_spPr->sp3d.GetPointer());
//nullable<OOX::Drawing::CEffectContainer> EffectDag;
//nullable<OOX::Drawing::COfficeArtExtensionList> ExtLst;
//nullable<OOX::Drawing::CScene3D> Scene3D;
//nullable<OOX::Drawing::CShape3D> Sp3D;
//-----------------------------------------------------------------------------------------------------------------------------
}
@ -844,15 +838,61 @@ void OoxConverter::convert(PPTX::Logic::AhPolar *oox_handle)
{
if (!oox_handle) return;
}
void OoxConverter::convert(PPTX::Logic::EffectDag *oox_effect_dag)
{
if (!oox_effect_dag) return;
//type - sib, value
for (size_t i = 0; i < oox_effect_dag->Effects.size(); ++i)
{
convert(oox_effect_dag->Effects[i].Effect.operator->());
}
}
void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_list)
{
if (!oox_effect_list) return;
convert(oox_effect_list->blur.GetPointer());
convert(oox_effect_list->fillOverlay.GetPointer());
convert(oox_effect_list->glow.GetPointer());
convert(oox_effect_list->reflection.GetPointer());
convert(oox_effect_list->softEdge.GetPointer());
convert(oox_effect_list->innerShdw.GetPointer());
convert(oox_effect_list->outerShdw.GetPointer());
convert(oox_effect_list->prstShdw.GetPointer());
}
void OoxConverter::convert(PPTX::Logic::AlphaModFix *oox_alpha)
{
if (oox_alpha == NULL) return;
if (false == oox_alpha->amt.IsInit()) return;
odf_context()->drawing_context()->set_opacity(oox_alpha->amt.get() / 1000.);
}
void OoxConverter::convert(PPTX::Logic::Blur *oox_effect)
{
if (oox_effect == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::FillOverlay *oox_effect)
{
if (oox_effect == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::Reflection *oox_effect)
{
if (oox_effect == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::Glow *oox_effect)
{
if (oox_effect == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::SoftEdge *oox_effect)
{
if (oox_effect == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::InnerShdw *oox_shadow)
{
if (oox_shadow == NULL) return;
@ -991,10 +1031,10 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
odf_context()->drawing_context()->set_bitmap_link(pathImage);
//...
}
//for (size_t i = 0 ; i < oox_bitmap_fill->blip->m_arrEffects.size(); i++)
//{
// convert(oox_bitmap_fill->blip->m_arrEffects[i]);
//}
for (size_t i = 0 ; i < oox_bitmap_fill->blip->Effects.size(); i++)
{
convert(oox_bitmap_fill->blip->Effects[i].Effect.operator->());
}
}
if (oox_bitmap_fill->srcRect.IsInit() && Width > 0 && Height > 0)//часть изображения
{

View File

@ -61,6 +61,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaModFix.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
#include "../../../OfficeCryptReader/source/CryptTransform.h"
@ -373,6 +374,7 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
case OOX::et_p_ShapeTree:
case OOX::et_a_GroupShape:
case OOX::et_w_GroupShape:
case OOX::et_lc_LockedCanvas:
{
convert(dynamic_cast<PPTX::Logic::SpTree *>(oox_unknown));
}break;
@ -443,14 +445,42 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{
convert(dynamic_cast<PPTX::Logic::EffectStyle*>(oox_unknown));
}break;
//case OOX::et_a_alphaModFix:
//{
// OOX::Drawing::CAlphaModulateFixedEffect* pAlpha= dynamic_cast<OOX::Drawing::CAlphaModulateFixedEffect*>(oox_unknown);
// if (pAlpha)
// {
// odf_context()->drawing_context()->set_opacity(pAlpha->m_oAmt.GetValue());
// }
//}break;
case OOX::et_a_alphaModFix:
{
convert(dynamic_cast<PPTX::Logic::AlphaModFix*>(oox_unknown));
}break;
case OOX::et_a_blur:
{
convert(dynamic_cast<PPTX::Logic::Blur*>(oox_unknown));
}break;
case OOX::et_a_fillOverlay:
{
convert(dynamic_cast<PPTX::Logic::FillOverlay*>(oox_unknown));
}break;
case OOX::et_a_glow:
{
convert(dynamic_cast<PPTX::Logic::Glow*>(oox_unknown));
}break;
case OOX::et_a_innerShdw:
{
convert(dynamic_cast<PPTX::Logic::InnerShdw*>(oox_unknown));
}break;
case OOX::et_a_outerShdw:
{
convert(dynamic_cast<PPTX::Logic::OuterShdw*>(oox_unknown));
}break;
case OOX::et_a_reflection:
{
convert(dynamic_cast<PPTX::Logic::Reflection*>(oox_unknown));
}break;
case OOX::et_a_softEdge:
{
convert(dynamic_cast<PPTX::Logic::SoftEdge*>(oox_unknown));
}break;
case OOX::et_a_effectDag:
{
convert(dynamic_cast<PPTX::Logic::EffectDag*>(oox_unknown));
}break;
case OOX::et_v_imagedata:
{
convert(dynamic_cast<OOX::Vml::CImageData*>(oox_unknown));

View File

@ -294,6 +294,7 @@ namespace PPTX
class SolidFill;
class PattFill;
class EffectLst;
class EffectDag;
class FontRef;
class StyleRef;
class Ln;
@ -328,12 +329,18 @@ namespace PPTX
class QuadBezTo;
class CubicBezTo;
class Close;
class AhXY;
class AhPolar;
class EffectStyle;
class InnerShdw;
class OuterShdw;
class PrstShdw;
class AhXY;
class AhPolar;
class AlphaModFix;
class Blur;
class FillOverlay;
class Glow;
class Reflection;
class SoftEdge;
}
}
@ -448,12 +455,19 @@ public:
void convert(PPTX::Logic::Close *oox_geom_path);
void convert(PPTX::Logic::AhXY *oox_handle);
void convert(PPTX::Logic::AhPolar *oox_handle);
void convert(PPTX::Logic::EffectStyle *oox_effect);
void convert(PPTX::Logic::EffectLst *oox_effect_list);
void convert(PPTX::Logic::EffectDag *oox_effect_dag);
void convert(PPTX::Logic::InnerShdw *oox_effect);
void convert(PPTX::Logic::OuterShdw *oox_effect);
void convert(PPTX::Logic::PrstShdw *oox_effect);
void convert(PPTX::Logic::AlphaModFix *oox_effect);
void convert(PPTX::Logic::Blur *oox_effect);
void convert(PPTX::Logic::FillOverlay *oox_effect);
void convert(PPTX::Logic::Glow *oox_effect);
void convert(PPTX::Logic::Reflection *oox_effect);
void convert(PPTX::Logic::SoftEdge *oox_effect);
//.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title);

View File

@ -352,6 +352,7 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
}break;
case OOX::et_w_GroupShape:
case OOX::et_p_ShapeTree:
case OOX::et_lc_LockedCanvas:
{
convert(dynamic_cast<PPTX::Logic::SpTree*>(oox_unknown));
}break;

View File

@ -1297,7 +1297,8 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
if (oox_background->bgPr.IsInit())
{
OoxConverter::convert(&oox_background->bgPr->Fill);
//EffectProperties EffectList;
convert(oox_background->bgPr->EffectList.List.GetPointer());
//nullable_bool shadeToTitle;
}
else if (oox_background->bgRef.IsInit())

View File

@ -43,6 +43,8 @@
#include "../../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
#include "../OdfFormat/ods_conversion_context.h"
#include "../OdfFormat/odf_text_context.h"
@ -295,6 +297,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
}
ods_context->end_columns();
//мержи
for (size_t mrg = 0 ; oox_sheet->m_oMergeCells.IsInit() && mrg < oox_sheet->m_oMergeCells->m_arrItems.size(); mrg++)
{
if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit())
ods_context->add_merge_cells(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get());
}
//строки
if (oox_sheet->m_oSheetData.IsInit() )
{
@ -311,12 +319,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
oox_sheet->m_oSheetData.reset();
}
//мержи
for (size_t mrg = 0 ; oox_sheet->m_oMergeCells.IsInit() && mrg < oox_sheet->m_oMergeCells->m_arrItems.size(); mrg++)
{
if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit())
ods_context->add_merge_cells(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get());
}
if (oox_sheet->m_oDrawing.IsInit() && oox_sheet->m_oDrawing->m_oId.IsInit())
{
smart_ptr<OOX::File> oFile = oox_sheet->Find(oox_sheet->m_oDrawing->m_oId->GetValue());
@ -1117,8 +1119,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
if (ActiveCellX > 0 && ActiveCellY > 0)
{
ods_context->settings_context()->add_property(L"CursorPositionX", L"int", std::to_wstring(ActiveCellX - 1));
ods_context->settings_context()->add_property(L"CursorPositionY", L"int", std::to_wstring(ActiveCellY - 1));
ods_context->settings_context()->add_property(L"CursorPositionX", L"int", std::to_wstring(ActiveCellX - 1));
ods_context->settings_context()->add_property(L"CursorPositionY", L"int", std::to_wstring(ActiveCellY - 1));
ods_context->settings_context()->add_property(L"PositionLeft", L"int", std::to_wstring(0));
ods_context->settings_context()->add_property(L"PositionRight", L"int", std::to_wstring(0));
ods_context->settings_context()->add_property(L"PositionTop", L"int", std::to_wstring(0));
ods_context->settings_context()->add_property(L"PositionBottom", L"int", std::to_wstring(ActiveCellY > 30 ? ActiveCellY - 2 : 0));
}
}
if (selection->m_oSqref.IsInit())
@ -1759,12 +1765,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::
if(color->m_oThemeColor.IsInit() && xlsx_document->m_pTheme.IsInit())
{
DWORD argb = xlsx_document->m_pTheme->themeElements.clrScheme.GetARGBFromScheme(color->m_oThemeColor->ToString());
DWORD bgra = xlsx_document->m_pTheme->themeElements.clrScheme.GetARGBFromScheme(color->m_oThemeColor->ToString());
ucR = (argb & 0x0000FF);
ucB = (argb & 0x00FF00) >> 8;
ucG = (argb & 0xFF0000) >> 16;
ucA = argb >> 24;
ucB = (bgra & 0x0000FF);
ucG = (bgra & 0x00FF00) >> 8;
ucR = (bgra & 0xFF0000) >> 16;
ucA = bgra >> 24;
result = true;
}
@ -2121,10 +2127,77 @@ void XlsxConverter::convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spr
odf_ref_image = odf_context()->add_imageobject(pathImage);
}
//--------------------------------------------------------------------------------------------------
if (!bAnchor || odf_ref_image.empty())
if ((!bAnchor || odf_ref_image.empty()) && object->m_oShapeId.IsInit() && (oox_sheet->m_oLegacyDrawing.IsInit()) && (oox_sheet->m_oLegacyDrawing->m_oId.IsInit()))
{
//from vml drawing or oox drawing
//m_oShapeId;
//todooo вынести отдельно если понадобится еще для чего
OOX::CVmlDrawing *pVmlDrawing = NULL;
smart_ptr<OOX::File> oFileV = oox_sheet->Find(oox_sheet->m_oLegacyDrawing->m_oId->GetValue());
if (oFileV.IsInit() && OOX::FileTypes::VmlDrawing == oFileV->type())
{
pVmlDrawing = (OOX::CVmlDrawing*)oFileV.operator->();
}
OOX::WritingElement* pShapeElem = NULL;
std::wstring sShapeId = L"_x0000_s" + std::to_wstring(object->m_oShapeId->GetValue());
if (pVmlDrawing)
{
boost::unordered_map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pFind = pVmlDrawing->m_mapShapes.find(sShapeId);
if (pFind != pVmlDrawing->m_mapShapes.end())
{
pShapeElem = pFind->second.pElement;
}
}
OOX::Vml::CShape* pShape = static_cast<OOX::Vml::CShape*>(pShapeElem);
for(size_t j = 0; (pShape) && (j < pShape->m_arrItems.size()); ++j)
{
OOX::WritingElement* pChildElemShape = pShape->m_arrItems[j];
if(!bAnchor && OOX::et_v_ClientData == pChildElemShape->getType())
{
OOX::Vml::CClientData* pClientData = static_cast<OOX::Vml::CClientData*>(pChildElemShape);
SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType;
OOX::Spreadsheet::CCellAnchor *pCellAnchor = new OOX::Spreadsheet::CCellAnchor(eAnchorType);
pClientData->toCellAnchor(pCellAnchor);
oox_table_position from = {}, to = {};
convert(pCellAnchor->m_oFrom.GetPointer(), &from);
convert(pCellAnchor->m_oTo.GetPointer(), &to);
delete pCellAnchor;
double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
ods_context->current_table().convert_position(from, x1, y1);
ods_context->current_table().convert_position(to, x2, y2);
ods_context->drawing_context()->set_drawings_rect(x1, y1, x2 - x1, y2 - y1);
}
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
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();
else if (pImageData->m_rPict.IsInit()) sIdImageFileCache = pImageData->m_rPict->GetValue();
if (!sIdImageFileCache.empty())
{
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVmlDrawing->Find(sIdImageFileCache);
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
if (pImageFileCache && odf_ref_image.empty())
{
odf_ref_image = odf_context()->add_imageobject(pImageFileCache->filename().GetPath());
}
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
ods_context->drawing_context()->start_drawing();

View File

@ -2015,7 +2015,7 @@ void CPPTUserInfo::LoadNoMainMaster(_UINT32 dwMasterID)
if (pGroup)
{
LoadGroupShapeContainer(pGroup, NULL, NULL, pLayout, pThemeWrapper, pMasterWrapper);
LoadGroupShapeContainer(pGroup, NULL, pTheme, pLayout, pThemeWrapper, pMasterWrapper);
}
else
{

View File

@ -377,6 +377,10 @@
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\CustormXmlWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
>

View File

@ -30,8 +30,6 @@
*
*/
#include "EffectProperties.h"
#include "EffectLst.h"
#include "EffectDag.h"
namespace PPTX
{

View File

@ -87,7 +87,6 @@ namespace PPTX
if(is_init())
Effect->SetParentPointer(pParent);
};
private:
smart_ptr<WrapperWritingElement> Effect;
protected:
virtual void FillParentPointersForChilds(){};

View File

@ -121,8 +121,6 @@ namespace PPTX
}
}
public:
smart_ptr<WrapperWritingElement> Fill;
enum Type {notInit, noFill, solidFill, gradFill, blipFill, pattFill, grpFill};
Type m_type;

View File

@ -140,7 +140,6 @@ namespace PPTX
template<class T> T& as() {return static_cast<T&>(*Path2D);}
template<class T> const T& as() const {return static_cast<const T&>(*Path2D);}
public:
smart_ptr<PathBase> Path2D;
protected:
virtual void FillParentPointersForChilds(){};

View File

@ -147,8 +147,17 @@ namespace PPTX
{
std::map<std::wstring, Logic::UniColor>::const_iterator pPair = Scheme.find(str);
if (Scheme.end() == pPair)
return 0;
return pPair->second.GetARGB();
{//default color map extension
if (str == L"tx1") pPair = Scheme.find(L"dk1");
else if (str == L"tx2") pPair = Scheme.find(L"dk2");
else if (str == L"bg1") pPair = Scheme.find(L"lt1");
else if (str == L"bg2") pPair = Scheme.find(L"lt1");
if (Scheme.end() == pPair) return 0;
else return pPair->second.GetARGB();
}
else
return pPair->second.GetARGB();
}
virtual DWORD GetBGRAFromScheme(const std::wstring& str)const
{

View File

@ -357,6 +357,8 @@ namespace OOX
et_dsp_cNvPr,
et_dsp_txXfrm,
et_lc_LockedCanvas, // <lc:lockedCanvas>
et_graphicFrame, // <...:graphicFrame>
et_pic, // <...:pic>
et_cxnSp, // <...:cxnSp>

View File

@ -72,17 +72,22 @@
namespace BinXlsxRW
{
#define SEEK_TO_POS_START(type) \
nPos = aSeekPositions[2 * type - 1]; \
length = aSeekPositions[2 * type]; \
if (nPos > 0) \
pFind = mapPos.find(type); \
if (pFind != mapPos.end()) \
{ \
m_oBufferedStream.Seek(nPos); \
for (size_t i = 0; i < pFind->second.size() - 1; i+=2) \
{ \
nPos = pFind->second[i]; \
length = pFind->second[i + 1]; \
m_oBufferedStream.Seek(nPos); \
#define SEEK_TO_POS_END(elem) \
elem.toXML(oStreamWriter); \
elem.toXML(oStreamWriter); \
} \
}
#define SEEK_TO_POS_END2() \
} \
}
class ImageObject
@ -2571,10 +2576,8 @@ namespace BinXlsxRW
m_lObjectIdVML = m_pCurVmlDrawing->m_lObjectIdVML = (long)(1024 * (m_oWorkbook.m_oSheets->m_arrItems.size() + 1) + 1);
//todo bigger then last int c_oSerWorksheetsTypes::
_UINT32 aSeekPositions[2 * 256];
memset(aSeekPositions, 0, (2 * 256) * sizeof(_UINT32));
READ1_DEF(length, res, this->ReadWorksheetSeekPositions, aSeekPositions);
boost::unordered_map<BYTE, std::vector<unsigned int>> mapPos;
READ1_DEF(length, res, this->ReadWorksheetSeekPositions, &mapPos);
m_pCurWorksheet->m_bWriteDirectlyToFile = true;
m_oWorkbook.AssignOutputFilename(oCurWorksheetFile);
@ -2584,7 +2587,7 @@ namespace BinXlsxRW
NSFile::CStreamWriter oStreamWriter;
oStreamWriter.CreateFileW(sWsPath);
m_pCurStreamWriter = &oStreamWriter;
res = ReadWorksheet(aSeekPositions, oStreamWriter, poResult);
res = ReadWorksheet(mapPos, oStreamWriter, poResult);
oStreamWriter.CloseFile();
if(m_pCurSheet->m_oName.IsInit())
@ -2606,16 +2609,28 @@ namespace BinXlsxRW
}
int ReadWorksheetSeekPositions(BYTE type, long length, void* poResult)
{
_UINT32* aSeekPositions = static_cast<_UINT32*>(poResult);
aSeekPositions[2 * type - 1] = m_oBufferedStream.GetPos();
aSeekPositions[2 * type] = length;
boost::unordered_map<BYTE, std::vector<unsigned int>>* mapPos = static_cast<boost::unordered_map<BYTE, std::vector<unsigned int>>*>(poResult);
boost::unordered_map<BYTE, std::vector<unsigned int>>::iterator pFind = mapPos->find(type);
if(pFind != mapPos->end())
{
pFind->second.push_back(m_oBufferedStream.GetPos());
pFind->second.push_back(length);
}
else
{
std::vector<unsigned int> data;
data.push_back(m_oBufferedStream.GetPos());
data.push_back(length);
(*mapPos)[type] = data;
}
return c_oSerConstants::ReadUnknown;
}
int ReadWorksheet(_UINT32* aSeekPositions, NSFile::CStreamWriter& oStreamWriter, void* poResult)
int ReadWorksheet(boost::unordered_map<BYTE, std::vector<unsigned int>>& mapPos, NSFile::CStreamWriter& oStreamWriter, void* poResult)
{
int res = c_oSerConstants::ReadOk;
m_pCurWorksheet->toXMLStart(oStreamWriter);
LONG nOldPos = m_oBufferedStream.GetPos();
boost::unordered_map<BYTE, std::vector<unsigned int>>::iterator pFind;
LONG nPos;
LONG length;
SEEK_TO_POS_START(c_oSerWorksheetsTypes::SheetPr);