Commit 598bb419 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation - fields

parent 087da9d2
......@@ -154,13 +154,35 @@ void odf_text_context::add_text_content(const std::wstring & text)
std::wstring last = text.substr(pos);
if (last.length() > 0)current_level_.back().elm->add_text(last);
}
void odf_text_context::add_text_date(const std::wstring & text)
{
office_element_ptr s_elm;
create_element(L"text", L"date", s_elm, odf_context_);
text_date* s = dynamic_cast<text_date*>(s_elm.get());
if (s) s->add_text(text);
if (current_level_.size()>0)
current_level_.back().elm->add_child_element(s_elm);
}
void odf_text_context::add_text_page_number(const std::wstring & text)
{
office_element_ptr s_elm;
create_element(L"text", L"page-number", s_elm, odf_context_);
text_page_number* s = dynamic_cast<text_page_number*>(s_elm.get());
if (s) s->add_text(text);
if (current_level_.size()>0)
current_level_.back().elm->add_child_element(s_elm);
}
void odf_text_context::add_text_space(int count)
{
office_element_ptr s_elm;
create_element(L"text", L"s", s_elm, odf_context_);
text_s* s = dynamic_cast<text_s*>(s_elm.get());
if (s)s->text_c_ = count;
if (s) s->text_c_ = count;
//необязательно хранить..
//int level = current_level_.size();
......
......@@ -67,8 +67,10 @@ public:
void add_text_content (const std::wstring & text);
void add_text_space (int count);
void set_symbol_font (const std::wstring & font);
void add_text_date (const std::wstring & text);
void add_text_page_number(const std::wstring & text);
void set_symbol_font (const std::wstring & font);
void set_symbol_text (int sym);
void start_paragraph (bool styled = false);
......
......@@ -1727,6 +1727,45 @@ void OoxConverter::convert(PPTX::Logic::Run *oox_run)
void OoxConverter::convert(PPTX::Logic::Fld *oox_fld)
{
if (!oox_fld) return;
bool styled = false;
if (oox_fld->rPr.IsInit())
{
odf_writer::style_text_properties * text_properties = odf_context()->text_context()->get_text_properties();
if (!text_properties)
{
odf_context()->styles_context()->create_style(L"", odf_types::style_family::Text, true, false, -1);
text_properties = odf_context()->styles_context()->last_state()->get_text_properties();
styled = true;
}
convert(oox_fld->rPr.GetPointer(), text_properties);
}
odf_context()->text_context()->start_span(styled);
std::wstring fld_type = oox_fld->type.get_value_or(L"");
if ((oox_fld->rPr.IsInit()) && (oox_fld->rPr->hlinkClick.IsInit()) && (oox_fld->rPr->hlinkClick->id.IsInit()))
{
std::wstring hlink = find_link_by_id(oox_fld->rPr->hlinkClick->id.get(), 2);
odf_context()->text_context()->add_hyperlink(hlink, oox_fld->GetText());
}
else if (fld_type == L"slidenum")
{
odf_context()->text_context()->add_text_page_number( oox_fld->GetText());
}
else if (fld_type == L"datetime1")
{
odf_context()->text_context()->add_text_date( oox_fld->GetText());
}
else
{
odf_context()->text_context()->add_text_content( oox_fld->GetText());
}
odf_context()->text_context()->end_span();
}
void OoxConverter::convert(PPTX::Logic::Br *oox_br)
{
......
......@@ -319,12 +319,15 @@ void PptxConverter::convert_slides()
if (pFind == m_mapMasters.end())
{
master_style_name = L"MasterPage";
if (bShowMasterSp)
{
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
}
bool bShowLayoutMasterAnim = slide->Layout->showMasterPhAnim.get_value_or(true);
bool bShowLayoutMasterSp = slide->Layout->showMasterSp.get_value_or(true);
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
master_style_name += L"_" ;
if (slide->Layout->cSld.attrName.IsInit()) master_style_name += slide->Layout->cSld.attrName.get();
else if (slide->Layout->attrType.IsInit()) master_style_name += slide->Layout->attrType->get();
else
......@@ -334,7 +337,8 @@ void PptxConverter::convert_slides()
convert_common();
current_slide = slide->Master.operator->();
if (bShowMasterSp)
if (bShowLayoutMasterSp && bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false);
else
convert(slide->Master->cSld.bg.GetPointer());
......@@ -342,6 +346,7 @@ void PptxConverter::convert_slides()
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, current_txStyles, true);
//add note master
odp_context->end_master_slide();
......@@ -949,6 +954,8 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
convert(oox_slide->bg.GetPointer());
bool bMaster = *odf_context()->drawing_context()->get_presentation();
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
{
......@@ -962,7 +969,14 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
pShape->FillLevelUp();
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
odf_context()->drawing_context()->set_placeholder_type(pShape->nvSpPr.nvPr.ph->type->GetBYTECode());
{
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);
}
else
odf_context()->drawing_context()->set_placeholder_type(0);
......
......@@ -63,6 +63,8 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("sz"), sz)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("type"), type)
WritingElement_ReadAttributes_End( oReader )
if (idx.IsInit() && *idx == L"4294967295") idx = L"0"; //100818_건강보험과_보건의료_김용익_최종.pptx
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
......@@ -71,6 +73,8 @@ namespace PPTX
node.ReadAttributeBase(L"orient", orient);
node.ReadAttributeBase(L"sz", sz);
node.ReadAttributeBase(L"type", type);
if (idx.IsInit() && *idx == L"4294967295") idx = L"0";
}
virtual std::wstring toXML() const
{
......
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