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)
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"w", L"logwidth");
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);
}
......
......@@ -652,6 +652,9 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
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"");
}
......@@ -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_paragraph->pPr->lvl.IsInit() || oox_paragraph->pPr->ParagraphBullet.is_init()))
if (oox_paragraph->pPr.IsInit())
{
list_present = true;
list_level = 1;
if (oox_paragraph->pPr->ParagraphBullet.is_init())
{
list_present = true;
list_level = 1;
}
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();
......@@ -1442,7 +1451,7 @@ void OoxConverter::convert(PPTX::Logic::Run *oox_run)
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);
odf_context()->text_context()->add_hyperlink(hlink, oox_run->GetText());
......
......@@ -295,15 +295,18 @@ void PptxConverter::convert_slides()
{
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
}
current_theme = slide->theme.operator->();
current_clrMap = NULL;
std::wstring master_style_name;
std::wstring layout_style_name;
PPTX::Logic::TxStyles* current_txStyles = NULL;
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);
if (pFind == m_mapMasters.end())
......@@ -323,12 +326,12 @@ void PptxConverter::convert_slides()
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
{
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())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, true);
convert_slide(&slide->Layout->cSld, current_txStyles, true);
odp_context->end_master_slide();
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()
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
convert_slide (slide->cSld.GetPointer(), true);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
convert (slide->transition.GetPointer());
convert (slide->timing.GetPointer());
convert (slide->timing.GetPointer(), slide->transition.GetPointer());
odp_context->end_slide();
......@@ -433,13 +435,7 @@ void PptxConverter::convert(PPTX::Comments *oox_comments)
odp_context->end_comment();
}
}
void PptxConverter::convert(PPTX::Logic::Transition *oox_transition)
{
if (!oox_transition) return;
}
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing)
void PptxConverter::convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition)
{
if (!oox_timing) return;
if (!oox_timing->tnLst.IsInit()) return;
......@@ -933,14 +929,13 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
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 (current_theme && current_clrMap)
current_theme->SetColorMap(*current_clrMap);
if (oox_slide->attrName.IsInit())
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
smart_ptr<PPTX::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem();
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();
if (!bPlaceholders && pShape->nvSpPr.nvPr.ph.is_init())
if (!bPlaceholders)
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;
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);
OoxConverter::convert(&update_shape);
......
......@@ -65,6 +65,7 @@ namespace PPTX
class TableCell;
class TableCellProperties;
class TcBdr;
class TxStyles;
}
}
......@@ -105,14 +106,13 @@ namespace Oox2Odf
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 (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_note);
void convert(PPTX::Logic::Bg *oox_background);
void convert(PPTX::Logic::Transition *oox_transition);
void convert(PPTX::Logic::Timing *oox_timing);
void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition);
void convert(PPTX::Logic::Table *oox_table);
void convert(PPTX::Logic::TableRow *oox_table_row);
......
......@@ -45,7 +45,6 @@ namespace PPTX
{
m_name = name_;
m_pLevelUp = NULL;
m_nMasterTextType = -1;
}
Shape::~Shape()
......@@ -55,21 +54,18 @@ namespace PPTX
Shape::Shape(XmlUtils::CXmlNode& node)
{
m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(node);
}
Shape::Shape(XmlUtils::CXmlLiteReader& oReader)
{
m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(oReader);
}
const Shape& Shape::operator =(XmlUtils::CXmlNode& node)
{
m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(node);
return *this;
......@@ -77,7 +73,6 @@ namespace PPTX
const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader)
{
m_pLevelUp = NULL;
m_nMasterTextType = -1;
fromXML(oReader);
return *this;
......@@ -462,52 +457,10 @@ namespace PPTX
if (m_pLevelUp)
m_pLevelUp->Merge(shape, true);
shape.m_name = m_name;
shape.m_nMasterTextType = m_nMasterTextType;
shape.nvSpPr = nvSpPr;
shape.m_name = m_name;
shape.nvSpPr = nvSpPr;
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())
{
shape.m_bIsFontRefInSlide = bIsSlidePlaceholder;
......
......@@ -316,7 +316,6 @@ namespace PPTX
//-------------------------------------------------------------------------------------------------
std::wstring m_name;
Shape * m_pLevelUp;
int m_nMasterTextType;
bool m_bIsFontRefInSlide;
//-------------------------------------------------------------------------------------------------
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