Commit 449bab1a authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent c1e5e336
......@@ -687,6 +687,7 @@ void common_shape_draw_attlist::add_attributes( const xml::attributes_wc_ptr & A
CP_APPLY_ATTR(L"draw:transform", draw_transform_);
CP_APPLY_ATTR(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:text-style-name", draw_text_style_name_);
CP_APPLY_ATTR(L"drawooo:display", drawooo_display_);
}
void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Other)
{
......@@ -698,6 +699,7 @@ void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Oth
_CP_APPLY_PROP2(draw_transform_);
_CP_APPLY_PROP2(draw_name_);
_CP_APPLY_PROP2(draw_text_style_name_);
_CP_APPLY_PROP2(drawooo_display_);
}
void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
......@@ -710,6 +712,7 @@ void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:text-style-name", draw_text_style_name_);
CP_XML_ATTR_OPT(L"drawooo:display", drawooo_display_);
}
void common_draw_shape_with_text_and_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......
......@@ -501,6 +501,7 @@ public:
_CP_OPT(std::wstring) draw_layer_;
_CP_OPT(std::wstring) draw_transform_;
_CP_OPT(int) draw_z_index_;
_CP_OPT(std::wstring) drawooo_display_;
};
class common_draw_position_attlist
......
......@@ -384,9 +384,11 @@ void odf_drawing_context::start_group()
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
if (impl_->current_drawing_state_.z_order_ >= 0)
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
if (!impl_->current_drawing_state_.name_.empty())
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
//if (!impl_->current_drawing_state_.description_.empty())
// group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.description_;
if (impl_->current_drawing_state_.hidden_)
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer";
impl_->current_drawing_state_.name_ = L"";
impl_->current_drawing_state_.z_order_ = -1;
......@@ -519,10 +521,12 @@ void odf_drawing_context::end_drawing()
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_class_ = impl_->current_drawing_state_.presentation_class_;
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_layer_ = draw_layer;
}
if (impl_->current_drawing_state_.name_.length() > 0)
if (!impl_->current_drawing_state_.name_.empty())
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
if (impl_->current_drawing_state_.z_order_ >= 0)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
if (impl_->current_drawing_state_.hidden_)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer";
std::wstring strTransform;
......@@ -2125,6 +2129,13 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
}
void odf_drawing_context::set_textarea_fit_to_size(bool val)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->draw_fit_to_size_ = val;
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{
......
......@@ -228,6 +228,7 @@ public:
void set_textarea_wrap (bool val);
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_placeholder_id (std::wstring val);
void set_placeholder_type (int val);
......
......@@ -1137,12 +1137,24 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->Fit.type == PPTX::Logic::TextFit::FitSpAuto)
{
//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
switch(oox_bodyPr->Fit.type)
{
case PPTX::Logic::TextFit::FitSpAuto:
{//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
}break;
case PPTX::Logic::TextFit::FitNo:
{
}break;
case PPTX::Logic::TextFit::FitNormAuto:
{
}break;
default:
{
}
}
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
......
......@@ -1436,6 +1436,8 @@ void PptxConverter::convert_layout(PPTX::Logic::CSld *oox_slide)
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
{
pShape->FillLevelUp();
int type = 0;
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
......
......@@ -128,27 +128,32 @@ namespace PPTX
{
if (!pShape) return;
if(pShape->nvSpPr.nvPr.ph.is_init())
if (pShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(_T("0"));
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(L"");
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(L"body");
if(type == L"ctrTitle") type = L"title";
if (type == L"ctrTitle") type = L"title";
for(size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
for (size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
{
smart_ptr<Logic::Shape> pLayoutShape = cSld.spTree.SpTreeElems[i].GetElem().smart_dynamic_cast<Logic::Shape>();
if(pLayoutShape.IsInit())
if (pLayoutShape.IsInit())
{
if(pLayoutShape->nvSpPr.nvPr.ph.is_init())
if (pLayoutShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring lIdx = pLayoutShape->nvSpPr.nvPr.ph->idx.get_value_or(_T("0"));
std::wstring lIdx = pLayoutShape->nvSpPr.nvPr.ph->idx.get_value_or(_T(""));
std::wstring lType = pLayoutShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
if(lType == _T("ctrTitle")) lType = _T("title");
if (lType == L"ctrTitle") lType = L"title";
if((type == lType) && (idx == lIdx))
if ((type == lType) && (idx == lIdx) && !idx.empty())
{
pShape->SetLevelUpElement(pLayoutShape.operator->());
return;
}
else if ((type == lType) && idx.empty() && lIdx.empty())
{
pShape->SetLevelUpElement(pLayoutShape.operator->());
return;
......
......@@ -66,7 +66,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
{
CFRecordType::TypeString rec_name = records_cache.front()->getTypeString();
Log::warning(rec_name);
//Log::warning(rec_name);
if (desirable_type == rt_MsoDrawingGroup) // объединяем rt_MsoDrawingGroup + rt_Continue в один блок
{
......
......@@ -621,12 +621,12 @@ namespace NSCustomShapesConvert
ConvertSum(oHandle.PolarCentre.y, oHandle.PolarCentreType.y, m_lIndexDst-2, ptFormula, 0, ptValue, false, true, false, m_oGuidsRes);
m_arIndexDst.push_back(m_lIndexDst-1);
std::wstring strMem = boost::lexical_cast<std::wstring>(m_lIndexDst-2);
std::wstring strMem = std::to_wstring(m_lIndexDst - 2);
oHandle.Pos.x = GetHandlePos(strMem, _T("w"), m_lWidth);
oHandle.PosType.x = ptFormula;
strMem = boost::lexical_cast<std::wstring>(m_lIndexDst-2);
strMem = std::to_wstring(m_lIndexDst - 2);
oHandle.Pos.y = GetHandlePos(strMem, _T("h"), m_lHeight);
oHandle.PosType.y = ptFormula;
}
......@@ -800,20 +800,20 @@ namespace NSCustomShapesConvert
case ptFormula:
{
if (bExtShape)
strValue = boost::lexical_cast<std::wstring>(lParam);
strValue = std::to_wstring(lParam);
else
strValue = boost::lexical_cast<std::wstring>(m_arIndexDst[lParam]);
strValue = std::to_wstring(m_arIndexDst[lParam]);
strValue = _T("gd") + strValue;
break;
}
case ptAdjust:
{
strValue = _T("adj") + boost::lexical_cast<std::wstring>(lParam);
strValue = _T("adj") + std::to_wstring(lParam);
break;
}
case ptValue:
{
strValue = boost::lexical_cast<std::wstring>(lParam);
strValue = std::to_wstring(lParam);
break;
}
default:
......@@ -1080,7 +1080,7 @@ namespace NSCustomShapesConvert
std::wstring strSize;
std::wstring strIndex;
strSize = boost::lexical_cast<std::wstring>( lSize);
strSize = std::to_wstring( lSize);
if ('#' == strParam[0])
{
......@@ -1114,7 +1114,7 @@ namespace NSCustomShapesConvert
m_lIndexSrc++;
m_arIndexDst.push_back(m_lIndexDst);
strIndex = boost::lexical_cast<std::wstring>(m_lIndexDst);
strIndex = std::to_wstring(m_lIndexDst);
m_oGuidsRes.WriteString(_T("<a:gd name=\"gd"));
m_oGuidsRes.WriteString(strIndex);
......
......@@ -347,7 +347,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
count_sheets++;
xls_global_info->current_sheet = count_sheets;
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + boost::lexical_cast<std::wstring>(count_sheets));
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + std::to_wstring(count_sheets));
xlsx_context->set_state(xls_global_info->sheets_state.size() > i ? xls_global_info->sheets_state[i] : L"visible");
convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
......@@ -356,7 +356,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
{
count_chart_sheets++;
xls_global_info->current_sheet = -1;
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"ChartSheet_" + boost::lexical_cast<std::wstring>(count_chart_sheets));
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"ChartSheet_" + std::to_wstring(count_chart_sheets));
convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
}
......@@ -639,7 +639,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
xlsx_context->get_mediaitems().create_media_path(xlsx_path);
bool res = false;
std::wstring file_name = L"image" + boost::lexical_cast<std::wstring>(id);
std::wstring file_name = L"image" + std::to_wstring(id);
if (type_ext == L"dib_data")
......
......@@ -86,7 +86,7 @@ std::wstring static get_default_file_name(external_items::Type type)
// }
// //todooo проверить
//
// return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
// return get_default_file_name(type) + std::to_wstring(Num) + sExt;
//}
......@@ -95,7 +95,7 @@ std::wstring external_items::add_image(const std::wstring & image, int bin_id)
{
const bool isMediaInternal = true;
std::wstring rId = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image+1);
std::wstring rId = std::wstring(L"picId") + std::to_wstring(count_image+1);
count_image++;
items_.push_back( item(image, typeImage, isMediaInternal, bin_id, rId) );
......@@ -108,8 +108,8 @@ std::wstring external_items::add_chart(std::wstring & oox_target)
count_charts++;
std::wstring rId = std::wstring(L"chartId") + boost::lexical_cast<std::wstring>(count_charts);
oox_target = std::wstring(L"charts/chart") + boost::lexical_cast<std::wstring>(count_charts) + L".xml";
std::wstring rId = std::wstring(L"chartId") + std::to_wstring(count_charts);
oox_target = std::wstring(L"charts/chart") + std::to_wstring(count_charts) + L".xml";
items_.push_back( item(oox_target, typeChart, isMediaInternal, -1, rId) );
......
......@@ -114,14 +114,14 @@ public:
if (c.author_ == author_list_[i])
{
find = true;
c.author_ = boost::lexical_cast<std::wstring>(i);
c.author_ = std::to_wstring(i);
break;
}
}
if (!find)
{
author_list_.push_back(c.author_);
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1);
c.author_ = std::to_wstring(author_list_.size()-1);
}
xlsx_comment_.push_back(c);
}
......
......@@ -52,13 +52,13 @@ public:
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
{
const std::wstring file_comments_id = boost::lexical_cast<std::wstring>(next_comments_file_id_++);
const std::wstring file_comments_id = std::to_wstring(next_comments_file_id_++);
const std::wstring fileName = std::wstring(L"comments") + file_comments_id + L".xml";
comments_.push_back(comment_elm(fileName, content, comments));
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId);
}
......
......@@ -165,7 +165,7 @@ void xlsx_conversion_context::end_document()
{
xlsx_xml_worksheet_ptr & sheet = sheets_[i];
count++;
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(count);
const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(count);
package::sheet_content_ptr content = package::sheet_content::create();
////////////////////////////////////////////////////////////////////////////////////////////
......@@ -219,7 +219,7 @@ void xlsx_conversion_context::end_document()
CP_XML_ATTR(L"name", sheet->name());
CP_XML_ATTR(L"sheetId", count);
CP_XML_ATTR(L"state", sheet->state() );
CP_XML_ATTR(L"r:id", id);
CP_XML_ATTR(L"r:id", slideRId);
}
}
......@@ -287,8 +287,6 @@ void xlsx_conversion_context::end_document()
{
CP_XML_ATTR(L"cacheId", std::to_wstring(i));
CP_XML_ATTR(L"r:id", rId);
//workbook_content.add_rels(relationship(rId, sType, sName));
}
pivot_caches_[i]->dump_rels(content->get_rels());
......
......@@ -86,7 +86,7 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
{//todooo отсчеты номеров файлов отдельно
const std::wstring id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
const std::wstring id = std::to_wstring(next_drawing_id_++);
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
drawings_.push_back(drawing_elm(fileName, content, rels));
......@@ -97,8 +97,8 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
{
const std::wstring drawing_id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
const std::wstring file_vml_id = boost::lexical_cast<std::wstring>(next_vml_file_id_++);
const std::wstring drawing_id = std::to_wstring(next_drawing_id_++);
const std::wstring file_vml_id = std::to_wstring(next_vml_file_id_++);
const std::wstring fileName = std::wstring(L"vmlDrawing") + file_vml_id + L".vml";
drawings_vml_.push_back(drawing_elm(fileName, content, rels));
......@@ -587,7 +587,7 @@ void xlsx_drawing_context::serialize_group()
if (drawing_state->name.empty())
{
drawing_state->name = L"Group_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"Group_" + std::to_wstring(count_object);
}
CP_XML_ATTR(L"name", drawing_state->name);
......@@ -641,24 +641,24 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
std::wstringstream strmStyle;
strmStyle << L"position:absolute;";
strmStyle << L"margin-left:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
strmStyle << L"margin-top:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.y / 12700.) << L"pt;";
strmStyle << L"width:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << boost::lexical_cast<std::wstring>(drawing_state->id) << L";";
strmStyle << L"margin-left:" << std::to_wstring(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
strmStyle << L"margin-top:" << std::to_wstring(drawing_state->child_anchor.y / 12700.) << L"pt;";
strmStyle << L"width:" << std::to_wstring(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << std::to_wstring(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << std::to_wstring(drawing_state->id) << L";";
if (drawing_state->object.visible == false)
strmStyle << L"visibility:hidden;";
CP_XML_NODE(L"v:shape")
{
//CP_XML_ATTR(L"id" , boost::lexical_cast<std::wstring>(drawing_state->object.id));
//CP_XML_ATTR(L"id" , std::to_wstring(drawing_state->object.id));
CP_XML_ATTR(L"type" , L"_x0000_t202");
CP_XML_ATTR(L"fillcolor" , L"#" + drawing_state->fill.color.sRGB);
if (drawing_state->line.width > 0)
{
CP_XML_ATTR(L"strokeweight", boost::lexical_cast<std::wstring>(drawing_state->line.width) +L"pt");
CP_XML_ATTR(L"strokeweight", std::to_wstring(drawing_state->line.width) +L"pt");
}
CP_XML_ATTR(L"style", strmStyle.str());
......@@ -770,9 +770,9 @@ void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state,
std::wstring style = std::wstring(L"position:absolute;margin-left:0;margin-top:0;");
//todooo сделать "покороче" значения .. достаточно 2 знаков после запятой
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
style += std::wstring(L"z-index:") + boost::lexical_cast<std::wstring>(drawing_state->id) + std::wstring(L";");
style += std::wstring(L"width:") + std::to_wstring(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
style += std::wstring(L"height:") + std::to_wstring(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
style += std::wstring(L"z-index:") + std::to_wstring(drawing_state->id) + std::wstring(L";");
CP_XML_ATTR(L"style",style);
......@@ -865,7 +865,7 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty())
drawing_state->name = L"Chart_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"Chart_" + std::to_wstring(count_object);
CP_XML_ATTR(L"name", drawing_state->name);
if (!drawing_state->description.empty())
......@@ -941,9 +941,9 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
if (drawing_state->name.empty())
{
if (drawing_state->wordart.is)
drawing_state->name = L"WordArt_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
else
drawing_state->name = L"Shape_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"Shape_" + std::to_wstring(count_object);
}
CP_XML_ATTR(L"name", drawing_state->name);
......@@ -2232,7 +2232,7 @@ void xlsx_drawing_context::set_hyperlink(const std::wstring & link, const std::w
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
std::wstring sId = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_.size()+1);
std::wstring sId = std::wstring(L"hId") + std::to_wstring(hlinks_.size()+1);
std::wstring link_correct = link;
if (!is_external) link_correct = std::wstring(L"#") + link_correct;
......
......@@ -80,7 +80,7 @@ public:
record r;
r.ref = ref;
r.display = display;
r.id = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(records_.size()+1);
r.id = std::wstring(L"hId") + std::to_wstring(records_.size()+1);
r.location = target;
if (bExternal) r.type = L"External" ;
......
......@@ -128,33 +128,32 @@ void sheets_files::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"worksheets";
NSDirectory::CreateDirectory(path.c_str());
for (int i = 0; i < sheets_.size(); i++)
for (size_t i = 0; i < sheets_.size(); i++)
{
if (sheets_[i])
if (!sheets_[i]) continue;
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
if (rels_)
{
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
if (rels_)
{
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
rels_->add(id, kWSRel, fileRef);
}
sheets_[i]->get_rel_file()->set_file_name(fileName + L".rels");
rels_files relFiles;
relFiles.add_rel_file(sheets_[i]->get_rel_file());
relFiles.write(path);
//item->get_rel_file()->write(path.string<std::wstring>());
package::simple_element(fileName, sheets_[i]->str()).write(path);
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
rels_->add(id, kWSRel, fileRef);
}
sheets_[i]->get_rel_file()->set_file_name(fileName + L".rels");
rels_files relFiles;
relFiles.add_rel_file(sheets_[i]->get_rel_file());
relFiles.write(path);
//item->get_rel_file()->write(path.string<std::wstring>());
package::simple_element(fileName, sheets_[i]->str()).write(path);
}
}
......@@ -213,6 +212,7 @@ void xl_files::write(const std::wstring & RootPath)
charts_files_.write(path);
}
{
pivot_cache_files_.set_rels(&rels_files_);
pivot_cache_files_.set_main_document(get_main_document());
pivot_cache_files_.write(path);
}
......@@ -314,6 +314,13 @@ void xl_pivot_cache_files::write(const std::wstring & RootPath)
relFiles.add_rel_file(pivot_caches_[i]->definitions_rels_file_);
relFiles.write(path);
}
if (rels_) //for workbook
{
const std::wstring id = std::wstring(L"pcId") + std::to_wstring(i + 1);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
const std::wstring fileRef = std::wstring(L"pivotCache/") + fileNameD;
rels_->add(id, kWSRel, fileRef);
}
std::wstring content_records = pivot_caches_[i]->str_r();
if (!content_records.empty())
{
......@@ -371,7 +378,7 @@ void xl_drawings::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
NSDirectory::CreateDirectory(path.c_str());
for (int i = 0; i < drawings_.size(); i++)
for (size_t i = 0; i < drawings_.size(); i++)
{
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
......@@ -406,7 +413,7 @@ void xl_comments::write(const std::wstring & RootPath)
std::wstring vml_path = RootPath + FILE_SEPARATOR_STR + L"drawings";
NSDirectory::CreateDirectory(vml_path.c_str());
for (int i = 0; i < comments_.size(); i++)
for (size_t i = 0; i < comments_.size(); i++)
{
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
......
......@@ -103,7 +103,6 @@ public:
virtual void write(const std::wstring & RootPath);
public:
std::vector<sheet_content_ptr> sheets_;
rels_files * rels_;
......@@ -126,11 +125,17 @@ class xl_pivot_cache_files : public element
public:
xl_pivot_cache_files(){}
void add_pivot_cache(pivot_cache_content_ptr pivot_cache);
void set_rels(rels_files * rels)
{
rels_ = rels;
}
void add_pivot_cache(pivot_cache_content_ptr pivot_cache);
virtual void write(const std::wstring & RootPath);
std::vector<pivot_cache_content_ptr> pivot_caches_;
rels_files * rels_;
};
///////////////////////////////////////////////////////////
......@@ -202,6 +207,7 @@ private:
sheets_files sheets_files_;
xl_charts_files charts_files_;
xl_pivot_cache_files pivot_cache_files_;
element_ptr theme_;
element_ptr workbook_;
......
......@@ -95,12 +95,11 @@ std::wostream & xlsx_pivot_cache_context::records()
//}
void xlsx_pivot_cache_context::dump_rels(rels & Rels)
{
// impl_->dump_rels(Rels);
if (isRecordsPresent)
{
Rels.add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
L"pivotCache/pivotCacheDefinition" + std::to_wstring(index) + L".xml", L""));
L"pivotCacheRecords" + std::to_wstring(index) + L".xml", L""));
}
}
void xlsx_pivot_cache_context::write_to(std::wostream & strm)
......@@ -109,13 +108,14 @@ void xlsx_pivot_cache_context::write_to(std::wostream & strm)
{
CP_XML_NODE(L"pivotCacheDefinition")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
if (isRecordsPresent)
{
CP_XML_ATTR(L"r:id", L"rId1" );
}
CP_XML_ATTR(L"recordCount", 0);
//refreshedBy="Debra S Dalgleish"
//refreshedDate="39449.496381365738"
//createdVersion="1"
......@@ -135,8 +135,10 @@ void xlsx_pivot_cache_context::write_records_to(std::wostream & strm)
{
CP_XML_NODE(L"pivotCacheRecords")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"count", 0);
CP_XML_STREAM() << impl_->recordsData_.str();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment