From e371819719a099e5c4fc0af1c2d1ee8ffc4e97c0 Mon Sep 17 00:00:00 2001 From: Mark Hung Date: Wed, 14 Feb 2018 23:48:57 +0800 Subject: tdf#115623: EPUB export: support style:master-page Change-Id: I12d04c2e346c5202274a01b1f8950e3412dc9081 Reviewed-on: https://gerrit.libreoffice.org/52081 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- writerperfect/source/writer/exp/txtstyli.cxx | 8 ++++++++ writerperfect/source/writer/exp/txtstyli.hxx | 2 ++ writerperfect/source/writer/exp/xmlfmt.cxx | 10 ++++++++-- writerperfect/source/writer/exp/xmlfmt.hxx | 2 ++ writerperfect/source/writer/exp/xmlimp.cxx | 7 +++++++ writerperfect/source/writer/exp/xmlimp.hxx | 2 ++ 6 files changed, 29 insertions(+), 2 deletions(-) (limited to 'writerperfect') diff --git a/writerperfect/source/writer/exp/txtstyli.cxx b/writerperfect/source/writer/exp/txtstyli.cxx index 4a8f6a42e3c0..548aa654dcdf 100644 --- a/writerperfect/source/writer/exp/txtstyli.cxx +++ b/writerperfect/source/writer/exp/txtstyli.cxx @@ -295,6 +295,7 @@ void XMLStyleContext::startElement(const OUString &/*rName*/, const css::uno::Re m_aParagraphPropertyList.insert(sName.getStr(), sValue.getStr()); m_aGraphicPropertyList.insert(sName.getStr(), sValue.getStr()); m_aPageLayoutPropertyList.insert(sName.getStr(), sValue.getStr()); + m_aMasterPagePropertyList.insert(sName.getStr(), sValue.getStr()); } } @@ -319,6 +320,8 @@ void XMLStyleContext::endElement(const OUString &rName) m_rStyles.GetCurrentGraphicStyles()[m_aName] = m_aGraphicPropertyList; else if (rName == "style:page-layout") m_rStyles.GetCurrentPageLayouts()[m_aName] = m_aPageLayoutPropertyList; + else if (rName == "style:master-page") + m_rStyles.GetCurrentMasterStyles()[m_aName] = m_aMasterPagePropertyList; } librevenge::RVNGPropertyList &XMLStyleContext::GetTextPropertyList() @@ -361,6 +364,11 @@ librevenge::RVNGPropertyList &XMLStyleContext::GetPageLayoutPropertyList() return m_aPageLayoutPropertyList; } +librevenge::RVNGPropertyList &XMLStyleContext::GetMasterPagePropertyList() +{ + return m_aMasterPagePropertyList; +} + } // namespace exp } // namespace writerperfect diff --git a/writerperfect/source/writer/exp/txtstyli.hxx b/writerperfect/source/writer/exp/txtstyli.hxx index 82f3abea6174..05d549ab2a79 100644 --- a/writerperfect/source/writer/exp/txtstyli.hxx +++ b/writerperfect/source/writer/exp/txtstyli.hxx @@ -39,6 +39,7 @@ public: librevenge::RVNGPropertyList &GetTablePropertyList(); librevenge::RVNGPropertyList &GetGraphicPropertyList(); librevenge::RVNGPropertyList &GetPageLayoutPropertyList(); + librevenge::RVNGPropertyList &GetMasterPagePropertyList(); private: OUString m_aName; @@ -51,6 +52,7 @@ private: librevenge::RVNGPropertyList m_aTablePropertyList; librevenge::RVNGPropertyList m_aGraphicPropertyList; librevenge::RVNGPropertyList m_aPageLayoutPropertyList; + librevenge::RVNGPropertyList m_aMasterPagePropertyList; XMLStylesContext &m_rStyles; }; diff --git a/writerperfect/source/writer/exp/xmlfmt.cxx b/writerperfect/source/writer/exp/xmlfmt.cxx index a1a7c3da4db0..42e2b0aa70c0 100644 --- a/writerperfect/source/writer/exp/xmlfmt.cxx +++ b/writerperfect/source/writer/exp/xmlfmt.cxx @@ -29,13 +29,14 @@ XMLStylesContext::XMLStylesContext(XMLImport &rImport, StyleType eType) m_rRowStyles(eType == StyleType_AUTOMATIC ? mrImport.GetAutomaticRowStyles() : mrImport.GetRowStyles()), m_rTableStyles(eType == StyleType_AUTOMATIC ? mrImport.GetAutomaticTableStyles() : mrImport.GetTableStyles()), m_rGraphicStyles(eType == StyleType_AUTOMATIC ? mrImport.GetAutomaticGraphicStyles() : mrImport.GetGraphicStyles()), - m_rPageLayouts(mrImport.GetPageLayouts()) + m_rPageLayouts(mrImport.GetPageLayouts()), + m_rMasterStyles(mrImport.GetMasterStyles()) { } rtl::Reference XMLStylesContext::CreateChildContext(const OUString &rName, const css::uno::Reference &/*xAttribs*/) { - if (rName == "style:style" || rName == "style:page-layout") + if (rName == "style:style" || rName == "style:page-layout" || rName == "style:master-page" ) return new XMLStyleContext(mrImport, *this); return nullptr; } @@ -80,6 +81,11 @@ std::map &XMLStylesContext::GetCurrentPa return m_rPageLayouts; } +std::map &XMLStylesContext::GetCurrentMasterStyles() +{ + return m_rMasterStyles; +} + /// Handler for . class XMLFontFaceContext : public XMLImportContext { diff --git a/writerperfect/source/writer/exp/xmlfmt.hxx b/writerperfect/source/writer/exp/xmlfmt.hxx index 99224f317026..71c3c8e80ace 100644 --- a/writerperfect/source/writer/exp/xmlfmt.hxx +++ b/writerperfect/source/writer/exp/xmlfmt.hxx @@ -45,6 +45,7 @@ public: std::map &GetCurrentTableStyles(); std::map &GetCurrentGraphicStyles(); std::map &GetCurrentPageLayouts(); + std::map &GetCurrentMasterStyles(); private: std::map &m_rParagraphStyles; std::map &m_rTextStyles; @@ -54,6 +55,7 @@ private: std::map &m_rTableStyles; std::map &m_rGraphicStyles; std::map &m_rPageLayouts; + std::map &m_rMasterStyles; }; /// Handler for . diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx index 130d15b9fad3..b1991a5ce506 100644 --- a/writerperfect/source/writer/exp/xmlimp.cxx +++ b/writerperfect/source/writer/exp/xmlimp.cxx @@ -253,6 +253,8 @@ rtl::Reference XMLOfficeDocContext::CreateChildContext(const O return new XMLStylesContext(mrImport, XMLStylesContext::StyleType_AUTOMATIC); if (rName == "office:styles") return new XMLStylesContext(mrImport, XMLStylesContext::StyleType_NONE); + if (rName == "office:master-styles") + return new XMLStylesContext(mrImport, XMLStylesContext::StyleType_NONE); if (rName == "office:font-face-decls") return new XMLFontFaceDeclsContext(mrImport); if (rName == "office:body") @@ -531,6 +533,11 @@ std::map &XMLImport::GetPageLayouts() return maPageLayouts; } +std::map &XMLImport::GetMasterStyles() +{ + return maMasterStyles; +} + void XMLImport::startDocument() { mrGenerator.startDocument(librevenge::RVNGPropertyList()); diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx index 570cd2e1ec22..392eef4956cd 100644 --- a/writerperfect/source/writer/exp/xmlimp.hxx +++ b/writerperfect/source/writer/exp/xmlimp.hxx @@ -76,6 +76,7 @@ class XMLImport : public cppu::WeakImplHelper std::map maAutomaticGraphicStyles; std::map maGraphicStyles; std::map maPageLayouts; + std::map maMasterStyles; librevenge::RVNGPropertyListVector maCoverImages; /// Author, date, etc -- overwrites what would be from the document out of the box. librevenge::RVNGPropertyList maMetaData; @@ -105,6 +106,7 @@ public: std::map &GetTableStyles(); std::map &GetGraphicStyles(); std::map &GetPageLayouts(); + std::map &GetMasterStyles(); const librevenge::RVNGPropertyListVector &GetCoverImages(); const librevenge::RVNGPropertyList &GetMetaData(); PopupState FillPopupData(const OUString &rURL, librevenge::RVNGPropertyList &rPropList); -- cgit v1.2.3