Commit 44fdbf6d authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - fix notes layouts

parent 582fce4c
...@@ -449,25 +449,21 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes) ...@@ -449,25 +449,21 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
PPTX::Theme* old_theme = current_theme; PPTX::Theme* old_theme = current_theme;
PPTX::Logic::ClrMap* old_clrMap = current_clrMap; PPTX::Logic::ClrMap* old_clrMap = current_clrMap;
smart_ptr<PPTX::NotesMaster> notes_master;
if (!presentation->notesMasterIdLst.empty())
{
std::wstring rId = presentation->notesMasterIdLst[0].rid.get();
notes_master = ((*presentation)[rId]).smart_dynamic_cast<PPTX::NotesMaster>();
}
odp_context->start_note(); odp_context->start_note();
if (notes_master.IsInit()) if (oox_notes->master_.IsInit())
{ {
current_theme = notes_master->theme_.operator->(); current_theme = oox_notes->master_->theme_.operator->();
current_clrMap = &notes_master->clrMap; current_clrMap = &oox_notes->master_->clrMap;
} }
current_slide = dynamic_cast<OOX::IFileContainer*>(oox_notes); current_slide = dynamic_cast<OOX::IFileContainer*>(oox_notes);
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit()) if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
{
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer(); current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
}
convert_slide(&oox_notes->cSld, NULL, true, true, Notes); convert_slide(&oox_notes->cSld, NULL, true, true, Notes);
......
...@@ -102,7 +102,6 @@ namespace PPTX ...@@ -102,7 +102,6 @@ namespace PPTX
} }
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{ {
const OOX::FileType& curType = pPair->second->type(); const OOX::FileType& curType = pPair->second->type();
...@@ -128,7 +127,6 @@ namespace PPTX ...@@ -128,7 +127,6 @@ namespace PPTX
} }
} }
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{ {
const OOX::FileType& curType = pPair->second->type(); const OOX::FileType& curType = pPair->second->type();
...@@ -141,6 +139,18 @@ namespace PPTX ...@@ -141,6 +139,18 @@ namespace PPTX
} }
} }
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{
const OOX::FileType& curType = pPair->second->type();
if (OOX::Presentation::FileTypes::NotesSlide == curType)
{
smart_ptr<PPTX::NotesSlide> pointer = pPair->second.smart_dynamic_cast<PPTX::NotesSlide>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
if (Event) if (Event)
Event->Progress(0, 1000000); Event->Progress(0, 1000000);
} }
......
...@@ -469,9 +469,17 @@ namespace PPTX ...@@ -469,9 +469,17 @@ namespace PPTX
if ((nvSpPr.nvPr.ph->type.IsInit()) || (nvSpPr.nvPr.ph->idx.IsInit())) if ((nvSpPr.nvPr.ph->type.IsInit()) || (nvSpPr.nvPr.ph->idx.IsInit()))
{ {
if (parentFileIs<Slide>()) if (parentFileIs<Slide>())
{
parentFileAs<Slide>().Layout->GetLevelUp(this); parentFileAs<Slide>().Layout->GetLevelUp(this);
}
else if(parentFileIs<SlideLayout>()) else if(parentFileIs<SlideLayout>())
{
parentFileAs<SlideLayout>().Master->GetLevelUp(this); parentFileAs<SlideLayout>().Master->GetLevelUp(this);
}
else if(parentFileIs<NotesSlide>())
{
parentFileAs<NotesSlide>().master_->GetLevelUp(this);
}
} }
} }
} }
......
...@@ -58,7 +58,6 @@ namespace PPTX ...@@ -58,7 +58,6 @@ namespace PPTX
{ {
} }
public:
virtual void read(const OOX::CPath& filename, FileMap& map) virtual void read(const OOX::CPath& filename, FileMap& map)
{ {
//FileContainer::read(filename, map); //FileContainer::read(filename, map);
...@@ -85,8 +84,6 @@ namespace PPTX ...@@ -85,8 +84,6 @@ namespace PPTX
WrapperFile::write(filename, directory, content); WrapperFile::write(filename, directory, content);
FileContainer::write(filename, directory, content); FileContainer::write(filename, directory, content);
} }
public:
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return OOX::Presentation::FileTypes::NotesMaster; return OOX::Presentation::FileTypes::NotesMaster;
...@@ -186,10 +183,48 @@ namespace PPTX ...@@ -186,10 +183,48 @@ namespace PPTX
pReader->Seek(end); pReader->Seek(end);
} }
virtual void GetLevelUp(Logic::Shape* pShape)
{
if (!pShape) return;
public: if (pShape->nvSpPr.nvPr.ph.is_init())
smart_ptr<Theme> theme_; {
smart_ptr<TableStyles> tableStyles_; 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";
for (size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
{
smart_ptr<Logic::Shape> pMasterShape = cSld.spTree.SpTreeElems[i].GetElem().smart_dynamic_cast<Logic::Shape>();
if (pMasterShape.IsInit())
{
if (pMasterShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring lIdx = pMasterShape->nvSpPr.nvPr.ph->idx.get_value_or(_T(""));
std::wstring lType = pMasterShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
if (lType == L"ctrTitle") lType = L"title";
if ((type == lType) && (idx == lIdx) && !idx.empty())
{
pShape->SetLevelUpElement(pMasterShape.operator->());
return;
}
else if ((type == lType) && idx.empty() && lIdx.empty())
{
pShape->SetLevelUpElement(pMasterShape.operator->());
return;
}
}
}
}
}
}
smart_ptr<Theme> theme_;
smart_ptr<TableStyles> tableStyles_;
Logic::CSld cSld; Logic::CSld cSld;
Logic::ClrMap clrMap; Logic::ClrMap clrMap;
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
#include "FileContainer.h" #include "FileContainer.h"
#include "FileTypes.h" #include "FileTypes.h"
#include "Logic/ClrMapOvr.h" #include "NotesMaster.h"
#include "Logic/CSld.h"
namespace PPTX namespace PPTX
{ {
...@@ -55,8 +54,6 @@ namespace PPTX ...@@ -55,8 +54,6 @@ namespace PPTX
virtual ~NotesSlide() virtual ~NotesSlide()
{ {
} }
public:
virtual void read(const OOX::CPath& filename, FileMap& map) virtual void read(const OOX::CPath& filename, FileMap& map)
{ {
//FileContainer::read(filename, map); //FileContainer::read(filename, map);
...@@ -79,8 +76,6 @@ namespace PPTX ...@@ -79,8 +76,6 @@ namespace PPTX
WrapperFile::write(filename, directory, content); WrapperFile::write(filename, directory, content);
FileContainer::write(filename, directory, content); FileContainer::write(filename, directory, content);
} }
public:
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return OOX::Presentation::FileTypes::NotesSlide; return OOX::Presentation::FileTypes::NotesSlide;
...@@ -127,7 +122,6 @@ namespace PPTX ...@@ -127,7 +122,6 @@ namespace PPTX
pWriter->EndNode(_T("p:notes")); pWriter->EndNode(_T("p:notes"));
} }
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{ {
pReader->Skip(1); // type pReader->Skip(1); // type
...@@ -145,7 +139,6 @@ namespace PPTX ...@@ -145,7 +139,6 @@ namespace PPTX
else if (1 == _at) else if (1 == _at)
showMasterSp = pReader->GetBool(); showMasterSp = pReader->GetBool();
} }
while (pReader->GetPos() < end) while (pReader->GetPos() < end)
{ {
BYTE _rec = pReader->GetUChar(); BYTE _rec = pReader->GetUChar();
...@@ -173,13 +166,25 @@ namespace PPTX ...@@ -173,13 +166,25 @@ namespace PPTX
pReader->Seek(end); pReader->Seek(end);
} }
void ApplyRels()
{
smart_ptr<OOX::File> pFile = FileContainer::Get(OOX::Presentation::FileTypes::NotesMaster);
public: master_ = pFile.smart_dynamic_cast<PPTX::NotesMaster>();
if (master_.IsInit())
{
theme_ = master_->theme_;
}
}
Logic::CSld cSld; Logic::CSld cSld;
nullable<Logic::ClrMapOvr> clrMapOvr; nullable<Logic::ClrMapOvr> clrMapOvr;
nullable_bool showMasterPhAnim; nullable_bool showMasterPhAnim;
nullable_bool showMasterSp; nullable_bool showMasterSp;
smart_ptr<NotesMaster> master_;
smart_ptr<Theme> theme_;
}; };
} // namespace PPTX } // namespace PPTX
......
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