Commit cb5d9233 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation ...

parent f6dbc6b9
...@@ -1453,11 +1453,11 @@ void odf_drawing_context::add_formula (std::wstring name, std::wstring fmla) ...@@ -1453,11 +1453,11 @@ void odf_drawing_context::add_formula (std::wstring name, std::wstring fmla)
break; break;
} }
XmlUtils::replace_all(odf_fmla, L"gd", L"?f"); //XmlUtils::replace_all(odf_fmla, L"gd", L"?f");
XmlUtils::replace_all(odf_fmla, L"h", L"logheight"); XmlUtils::replace_all(odf_fmla, L"h", L"logheight");
XmlUtils::replace_all(odf_fmla, L"w", L"logwidth"); XmlUtils::replace_all(odf_fmla, L"w", L"logwidth");
XmlUtils::replace_all(odf_fmla, L"adj", L"$"); XmlUtils::replace_all(odf_fmla, L"adj", L"$");
XmlUtils::replace_all(name, L"gd", L"f"); //XmlUtils::replace_all(name, L"gd", L"f");
impl_->current_drawing_state_.oox_shape_->add(name, odf_fmla); impl_->current_drawing_state_.oox_shape_->add(name, odf_fmla);
} }
......
...@@ -652,6 +652,9 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path) ...@@ -652,6 +652,9 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
convert(pathBase); convert(pathBase);
} }
if (oox_geom_path->stroke.IsInit() && *oox_geom_path->stroke == false)
odf_context()->drawing_context()->add_path_element(std::wstring(L"S"), L"");
odf_context()->drawing_context()->add_path_element(std::wstring(L"N"), L""); odf_context()->drawing_context()->add_path_element(std::wstring(L"N"), L"");
} }
...@@ -1084,13 +1087,19 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T ...@@ -1084,13 +1087,19 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
if (oox_paragraph->pPr.IsInit() || oox_list_style) if (oox_paragraph->pPr.IsInit() || oox_list_style)
{ {
if (oox_paragraph->pPr.IsInit() && (oox_paragraph->pPr->lvl.IsInit() || oox_paragraph->pPr->ParagraphBullet.is_init())) if (oox_paragraph->pPr.IsInit())
{ {
list_present = true; if (oox_paragraph->pPr->ParagraphBullet.is_init())
{
list_level = 1; list_present = true;
list_level = 1;
}
if (oox_paragraph->pPr->lvl.IsInit()) if (oox_paragraph->pPr->lvl.IsInit())
list_level = *oox_paragraph->pPr->lvl; {
list_level = *oox_paragraph->pPr->lvl;
if (list_level > 0)
list_present = true;
}
} }
odf_writer::style_paragraph_properties * paragraph_properties = odf_context()->text_context()->get_paragraph_properties(); odf_writer::style_paragraph_properties * paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
...@@ -1442,7 +1451,7 @@ void OoxConverter::convert(PPTX::Logic::Run *oox_run) ...@@ -1442,7 +1451,7 @@ void OoxConverter::convert(PPTX::Logic::Run *oox_run)
odf_context()->text_context()->start_span(styled); odf_context()->text_context()->start_span(styled);
if ((oox_run->rPr->hlinkClick.IsInit()) && (oox_run->rPr->hlinkClick->id.IsInit())) if ((oox_run->rPr.IsInit()) && (oox_run->rPr->hlinkClick.IsInit()) && (oox_run->rPr->hlinkClick->id.IsInit()))
{ {
std::wstring hlink = find_link_by_id(oox_run->rPr->hlinkClick->id.get(), 2); std::wstring hlink = find_link_by_id(oox_run->rPr->hlinkClick->id.get(), 2);
odf_context()->text_context()->add_hyperlink(hlink, oox_run->GetText()); odf_context()->text_context()->add_hyperlink(hlink, oox_run->GetText());
......
...@@ -295,15 +295,18 @@ void PptxConverter::convert_slides() ...@@ -295,15 +295,18 @@ void PptxConverter::convert_slides()
{ {
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
} }
current_theme = slide->theme.operator->(); current_theme = slide->theme.operator->();
current_clrMap = NULL; current_clrMap = NULL;
std::wstring master_style_name; std::wstring master_style_name;
std::wstring layout_style_name; std::wstring layout_style_name;
PPTX::Logic::TxStyles* current_txStyles = NULL;
if (slide->Master.IsInit()) if (slide->Master.IsInit())
{ {
current_clrMap = &slide->Master->clrMap; current_clrMap = &slide->Master->clrMap;
current_txStyles = slide->Master->txStyles.GetPointer();
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename); std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename);
if (pFind == m_mapMasters.end()) if (pFind == m_mapMasters.end())
...@@ -323,12 +326,12 @@ void PptxConverter::convert_slides() ...@@ -323,12 +326,12 @@ void PptxConverter::convert_slides()
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true) //if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
{ {
current_slide = slide->Master.operator->(); current_slide = slide->Master.operator->();
convert_slide(&slide->Master->cSld, false); convert_slide(&slide->Master->cSld, current_txStyles, false);
} }
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit()) if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer(); current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->(); current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, true); convert_slide(&slide->Layout->cSld, current_txStyles, true);
odp_context->end_master_slide(); odp_context->end_master_slide();
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name)); m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name));
...@@ -370,12 +373,11 @@ void PptxConverter::convert_slides() ...@@ -370,12 +373,11 @@ void PptxConverter::convert_slides()
//nullable_bool showMasterPhAnim; //nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp; //nullable_bool showMasterSp;
convert_slide (slide->cSld.GetPointer(), true); convert_slide (slide->cSld.GetPointer(), current_txStyles, true);
convert (slide->comments.operator->()); convert (slide->comments.operator->());
convert (slide->Note.operator->()); convert (slide->Note.operator->());
convert (slide->transition.GetPointer()); convert (slide->timing.GetPointer(), slide->transition.GetPointer());
convert (slide->timing.GetPointer());
odp_context->end_slide(); odp_context->end_slide();
...@@ -433,13 +435,7 @@ void PptxConverter::convert(PPTX::Comments *oox_comments) ...@@ -433,13 +435,7 @@ void PptxConverter::convert(PPTX::Comments *oox_comments)
odp_context->end_comment(); odp_context->end_comment();
} }
} }
void PptxConverter::convert(PPTX::Logic::Transition *oox_transition) void PptxConverter::convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition)
{
if (!oox_transition) return;
}
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing)
{ {
if (!oox_timing) return; if (!oox_timing) return;
if (!oox_timing->tnLst.IsInit()) return; if (!oox_timing->tnLst.IsInit()) return;
...@@ -933,14 +929,13 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background) ...@@ -933,14 +929,13 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
odp_context->end_drawings(); odp_context->end_drawings();
} }
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholders) void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders)
{ {
if (oox_slide == NULL) return; if (oox_slide == NULL) return;
if (current_theme && current_clrMap) if (current_theme && current_clrMap)
current_theme->SetColorMap(*current_clrMap); current_theme->SetColorMap(*current_clrMap);
if (oox_slide->attrName.IsInit()) if (oox_slide->attrName.IsInit())
odp_context->current_slide().set_page_name(oox_slide->attrName.get()); odp_context->current_slide().set_page_name(oox_slide->attrName.get());
...@@ -951,13 +946,41 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholde ...@@ -951,13 +946,41 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholde
smart_ptr<PPTX::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem(); smart_ptr<PPTX::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem();
smart_ptr<PPTX::Logic::Shape> pShape = pElem.smart_dynamic_cast<PPTX::Logic::Shape>(); smart_ptr<PPTX::Logic::Shape> pShape = pElem.smart_dynamic_cast<PPTX::Logic::Shape>();
if (pShape.IsInit()) if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
{ {
pShape->FillLevelUp(); pShape->FillLevelUp();
if (!bPlaceholders && pShape->nvSpPr.nvPr.ph.is_init())
if (!bPlaceholders)
continue; continue;
PPTX::Logic::TextListStyle * listMasterStyle = NULL;
if (txStyles)
{
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
if ((type == L"title") || (type == L"ctrTitle"))
listMasterStyle = txStyles->titleStyle.GetPointer();
else if ((type == L"body") || (type == L"subTitle") || (type == L"obj"))
listMasterStyle = txStyles->bodyStyle.GetPointer();
else if (type != L"")
listMasterStyle = txStyles->otherStyle.GetPointer();
}
PPTX::Logic::Shape update_shape; PPTX::Logic::Shape update_shape;
if (listMasterStyle)
{
update_shape.txBody = new PPTX::Logic::TxBody();
PPTX::Logic::TextListStyle *newListStyle = new PPTX::Logic::TextListStyle();
for (int i = 0; i < 10; i++)
{
if(listMasterStyle->levels[i].is_init())
listMasterStyle->levels[i]->Merge(newListStyle->levels[i]);
}
update_shape.txBody->lstStyle.reset(newListStyle);
}
pShape->Merge(update_shape); pShape->Merge(update_shape);
OoxConverter::convert(&update_shape); OoxConverter::convert(&update_shape);
......
...@@ -65,6 +65,7 @@ namespace PPTX ...@@ -65,6 +65,7 @@ namespace PPTX
class TableCell; class TableCell;
class TableCellProperties; class TableCellProperties;
class TcBdr; class TcBdr;
class TxStyles;
} }
} }
...@@ -105,14 +106,13 @@ namespace Oox2Odf ...@@ -105,14 +106,13 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown); void convert(OOX::WritingElement *oox_unknown);
void convert_slide (PPTX::Logic::CSld *oox_slide, bool bPlaceholders = true); void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders = true);
void convert_layout (PPTX::Logic::CSld *oox_slide); void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert (PPTX::Comments *oox_comments); void convert (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_note); void convert (PPTX::NotesSlide *oox_note);
void convert(PPTX::Logic::Bg *oox_background); void convert(PPTX::Logic::Bg *oox_background);
void convert(PPTX::Logic::Transition *oox_transition); void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition);
void convert(PPTX::Logic::Timing *oox_timing);
void convert(PPTX::Logic::Table *oox_table); void convert(PPTX::Logic::Table *oox_table);
void convert(PPTX::Logic::TableRow *oox_table_row); void convert(PPTX::Logic::TableRow *oox_table_row);
......
...@@ -45,7 +45,6 @@ namespace PPTX ...@@ -45,7 +45,6 @@ namespace PPTX
{ {
m_name = name_; m_name = name_;
m_pLevelUp = NULL; m_pLevelUp = NULL;
m_nMasterTextType = -1;
} }
Shape::~Shape() Shape::~Shape()
...@@ -55,21 +54,18 @@ namespace PPTX ...@@ -55,21 +54,18 @@ namespace PPTX
Shape::Shape(XmlUtils::CXmlNode& node) Shape::Shape(XmlUtils::CXmlNode& node)
{ {
m_pLevelUp = NULL; m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(node); fromXML(node);
} }
Shape::Shape(XmlUtils::CXmlLiteReader& oReader) Shape::Shape(XmlUtils::CXmlLiteReader& oReader)
{ {
m_pLevelUp = NULL; m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(oReader); fromXML(oReader);
} }
const Shape& Shape::operator =(XmlUtils::CXmlNode& node) const Shape& Shape::operator =(XmlUtils::CXmlNode& node)
{ {
m_pLevelUp = NULL; m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(node); fromXML(node);
return *this; return *this;
...@@ -77,7 +73,6 @@ namespace PPTX ...@@ -77,7 +73,6 @@ namespace PPTX
const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader) const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader)
{ {
m_pLevelUp = NULL; m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(oReader); fromXML(oReader);
return *this; return *this;
...@@ -462,52 +457,10 @@ namespace PPTX ...@@ -462,52 +457,10 @@ namespace PPTX
if (m_pLevelUp) if (m_pLevelUp)
m_pLevelUp->Merge(shape, true); m_pLevelUp->Merge(shape, true);
shape.m_name = m_name; shape.m_name = m_name;
shape.m_nMasterTextType = m_nMasterTextType; shape.nvSpPr = nvSpPr;
shape.nvSpPr = nvSpPr;
spPr.Merge(shape.spPr); spPr.Merge(shape.spPr);
if (parentFileIs<SlideMaster>() && (parentFileAs<SlideMaster>()).txStyles.IsInit())
{
TextListStyle * listMasterStyle = NULL;
std::wstring type = nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
if ((type == L"title") || (type == L"ctrTitle"))
{
m_nMasterTextType = 1;
listMasterStyle = (parentFileAs<SlideMaster>()).txStyles->titleStyle.GetPointer();
}
else if ((type == L"body") || (type == L"subTitle") || (type == L"obj"))
{
m_nMasterTextType = 2;
listMasterStyle = (parentFileAs<SlideMaster>()).txStyles->bodyStyle.GetPointer();
}
else if (type != L"")
{
m_nMasterTextType = 3;
listMasterStyle = (parentFileAs<SlideMaster>()).txStyles->otherStyle.GetPointer();
}
if (listMasterStyle)
{
if(!txBody.is_init())
txBody = new TxBody();
TextListStyle *newListStyle = new TextListStyle();
for (int i = 0; i < 10; i++)
{
if(listMasterStyle->levels[i].is_init())
listMasterStyle->levels[i]->Merge(newListStyle->levels[i]);
if(txBody->lstStyle->levels[i].is_init())
txBody->lstStyle->levels[i]->Merge(newListStyle->levels[i]);
}
txBody->lstStyle.reset(newListStyle);
}
}
shape.m_nMasterTextType = m_nMasterTextType;
if (style.is_init()) if (style.is_init())
{ {
shape.m_bIsFontRefInSlide = bIsSlidePlaceholder; shape.m_bIsFontRefInSlide = bIsSlidePlaceholder;
......
...@@ -316,7 +316,6 @@ namespace PPTX ...@@ -316,7 +316,6 @@ namespace PPTX
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
std::wstring m_name; std::wstring m_name;
Shape * m_pLevelUp; Shape * m_pLevelUp;
int m_nMasterTextType;
bool m_bIsFontRefInSlide; bool m_bIsFontRefInSlide;
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
NvSpPr nvSpPr; NvSpPr nvSpPr;
......
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