[Libreoffice-commits] core.git: writerperfect/source

Mark Hung marklh9 at gmail.com
Sun Apr 8 13:18:45 UTC 2018


 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(-)

New commits:
commit e371819719a099e5c4fc0af1c2d1ee8ffc4e97c0
Author: Mark Hung <marklh9 at gmail.com>
Date:   Wed Feb 14 23:48:57 2018 +0800

    tdf#115623: EPUB export: support style:master-page
    
    Change-Id: I12d04c2e346c5202274a01b1f8950e3412dc9081
    Reviewed-on: https://gerrit.libreoffice.org/52081
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

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<XMLImportContext> XMLStylesContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*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<OUString, librevenge::RVNGPropertyList> &XMLStylesContext::GetCurrentPa
     return m_rPageLayouts;
 }
 
+std::map<OUString, librevenge::RVNGPropertyList> &XMLStylesContext::GetCurrentMasterStyles()
+{
+    return m_rMasterStyles;
+}
+
 /// Handler for <style:font-face>.
 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<OUString, librevenge::RVNGPropertyList> &GetCurrentTableStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentGraphicStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentPageLayouts();
+    std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentMasterStyles();
 private:
     std::map<OUString, librevenge::RVNGPropertyList> &m_rParagraphStyles;
     std::map<OUString, librevenge::RVNGPropertyList> &m_rTextStyles;
@@ -54,6 +55,7 @@ private:
     std::map<OUString, librevenge::RVNGPropertyList> &m_rTableStyles;
     std::map<OUString, librevenge::RVNGPropertyList> &m_rGraphicStyles;
     std::map<OUString, librevenge::RVNGPropertyList> &m_rPageLayouts;
+    std::map<OUString, librevenge::RVNGPropertyList> &m_rMasterStyles;
 };
 
 /// Handler for <office:font-face-decls>.
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<XMLImportContext> 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<OUString, librevenge::RVNGPropertyList> &XMLImport::GetPageLayouts()
     return maPageLayouts;
 }
 
+std::map<OUString, librevenge::RVNGPropertyList> &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<OUString, librevenge::RVNGPropertyList> maAutomaticGraphicStyles;
     std::map<OUString, librevenge::RVNGPropertyList> maGraphicStyles;
     std::map<OUString, librevenge::RVNGPropertyList> maPageLayouts;
+    std::map<OUString, librevenge::RVNGPropertyList> 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<OUString, librevenge::RVNGPropertyList> &GetTableStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetGraphicStyles();
     std::map<OUString, librevenge::RVNGPropertyList> &GetPageLayouts();
+    std::map<OUString, librevenge::RVNGPropertyList> &GetMasterStyles();
     const librevenge::RVNGPropertyListVector &GetCoverImages();
     const librevenge::RVNGPropertyList &GetMetaData();
     PopupState FillPopupData(const OUString &rURL, librevenge::RVNGPropertyList &rPropList);


More information about the Libreoffice-commits mailing list