summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerperfect/source/writer/exp/txtstyli.cxx44
-rw-r--r--writerperfect/source/writer/exp/txtstyli.hxx2
-rw-r--r--writerperfect/source/writer/exp/xmlfmt.cxx10
-rw-r--r--writerperfect/source/writer/exp/xmlfmt.hxx2
-rw-r--r--writerperfect/source/writer/exp/xmlimp.cxx5
-rw-r--r--writerperfect/source/writer/exp/xmlimp.hxx2
6 files changed, 62 insertions, 3 deletions
diff --git a/writerperfect/source/writer/exp/txtstyli.cxx b/writerperfect/source/writer/exp/txtstyli.cxx
index 931fbe459f65..4a8f6a42e3c0 100644
--- a/writerperfect/source/writer/exp/txtstyli.cxx
+++ b/writerperfect/source/writer/exp/txtstyli.cxx
@@ -102,6 +102,38 @@ void XMLGraphicPropertiesContext::startElement(const OUString &/*rName*/, const
}
}
+/// Handler for <style:page-layout-properties>.
+class XMLPageLayoutPropertiesContext : public XMLImportContext
+{
+public:
+ XMLPageLayoutPropertiesContext(XMLImport &rImport, XMLStyleContext &rStyle);
+
+ void SAL_CALL startElement(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
+
+private:
+ XMLStyleContext &mrStyle;
+};
+
+XMLPageLayoutPropertiesContext::XMLPageLayoutPropertiesContext(XMLImport &rImport, XMLStyleContext &rStyle)
+ : XMLImportContext(rImport)
+ , mrStyle(rStyle)
+{
+}
+
+void XMLPageLayoutPropertiesContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs)
+{
+ for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i)
+ {
+ OString sName = OUStringToOString(xAttribs->getNameByIndex(i), RTL_TEXTENCODING_UTF8);
+ OString sValue = OUStringToOString(xAttribs->getValueByIndex(i), RTL_TEXTENCODING_UTF8);
+ // We only care about writing-mode for now.
+ if (sName != "style:writing-mode")
+ continue;
+
+ mrStyle.GetPageLayoutPropertyList().insert(sName.getStr(), sValue.getStr());
+ }
+}
+
/// Handler for <style:table-properties>.
class XMLTablePropertiesContext : public XMLImportContext
{
@@ -240,6 +272,8 @@ rtl::Reference<XMLImportContext> XMLStyleContext::CreateChildContext(const OUStr
return new XMLTablePropertiesContext(mrImport, *this);
if (rName == "style:graphic-properties")
return new XMLGraphicPropertiesContext(mrImport, *this);
+ if (rName == "style:page-layout-properties")
+ return new XMLPageLayoutPropertiesContext(mrImport, *this);
return nullptr;
}
@@ -260,10 +294,11 @@ void XMLStyleContext::startElement(const OUString &/*rName*/, const css::uno::Re
m_aTextPropertyList.insert(sName.getStr(), sValue.getStr());
m_aParagraphPropertyList.insert(sName.getStr(), sValue.getStr());
m_aGraphicPropertyList.insert(sName.getStr(), sValue.getStr());
+ m_aPageLayoutPropertyList.insert(sName.getStr(), sValue.getStr());
}
}
-void XMLStyleContext::endElement(const OUString &/*rName*/)
+void XMLStyleContext::endElement(const OUString &rName)
{
if (m_aName.isEmpty())
return;
@@ -282,6 +317,8 @@ void XMLStyleContext::endElement(const OUString &/*rName*/)
m_rStyles.GetCurrentTableStyles()[m_aName] = m_aTablePropertyList;
else if (m_aFamily == "graphic")
m_rStyles.GetCurrentGraphicStyles()[m_aName] = m_aGraphicPropertyList;
+ else if (rName == "style:page-layout")
+ m_rStyles.GetCurrentPageLayouts()[m_aName] = m_aPageLayoutPropertyList;
}
librevenge::RVNGPropertyList &XMLStyleContext::GetTextPropertyList()
@@ -319,6 +356,11 @@ librevenge::RVNGPropertyList &XMLStyleContext::GetGraphicPropertyList()
return m_aGraphicPropertyList;
}
+librevenge::RVNGPropertyList &XMLStyleContext::GetPageLayoutPropertyList()
+{
+ return m_aPageLayoutPropertyList;
+}
+
} // namespace exp
} // namespace writerperfect
diff --git a/writerperfect/source/writer/exp/txtstyli.hxx b/writerperfect/source/writer/exp/txtstyli.hxx
index f3b3b6da38c9..82f3abea6174 100644
--- a/writerperfect/source/writer/exp/txtstyli.hxx
+++ b/writerperfect/source/writer/exp/txtstyli.hxx
@@ -38,6 +38,7 @@ public:
librevenge::RVNGPropertyList &GetRowPropertyList();
librevenge::RVNGPropertyList &GetTablePropertyList();
librevenge::RVNGPropertyList &GetGraphicPropertyList();
+ librevenge::RVNGPropertyList &GetPageLayoutPropertyList();
private:
OUString m_aName;
@@ -49,6 +50,7 @@ private:
librevenge::RVNGPropertyList m_aRowPropertyList;
librevenge::RVNGPropertyList m_aTablePropertyList;
librevenge::RVNGPropertyList m_aGraphicPropertyList;
+ librevenge::RVNGPropertyList m_aPageLayoutPropertyList;
XMLStylesContext &m_rStyles;
};
diff --git a/writerperfect/source/writer/exp/xmlfmt.cxx b/writerperfect/source/writer/exp/xmlfmt.cxx
index 266b2ee110c9..a1a7c3da4db0 100644
--- a/writerperfect/source/writer/exp/xmlfmt.cxx
+++ b/writerperfect/source/writer/exp/xmlfmt.cxx
@@ -28,13 +28,14 @@ XMLStylesContext::XMLStylesContext(XMLImport &rImport, StyleType eType)
m_rColumnStyles(eType == StyleType_AUTOMATIC ? mrImport.GetAutomaticColumnStyles() : mrImport.GetColumnStyles()),
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_rGraphicStyles(eType == StyleType_AUTOMATIC ? mrImport.GetAutomaticGraphicStyles() : mrImport.GetGraphicStyles()),
+ m_rPageLayouts(mrImport.GetPageLayouts())
{
}
rtl::Reference<XMLImportContext> XMLStylesContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
- if (rName == "style:style")
+ if (rName == "style:style" || rName == "style:page-layout")
return new XMLStyleContext(mrImport, *this);
return nullptr;
}
@@ -74,6 +75,11 @@ std::map<OUString, librevenge::RVNGPropertyList> &XMLStylesContext::GetCurrentGr
return m_rGraphicStyles;
}
+std::map<OUString, librevenge::RVNGPropertyList> &XMLStylesContext::GetCurrentPageLayouts()
+{
+ return m_rPageLayouts;
+}
+
/// 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 3b0c88616b7c..99224f317026 100644
--- a/writerperfect/source/writer/exp/xmlfmt.hxx
+++ b/writerperfect/source/writer/exp/xmlfmt.hxx
@@ -44,6 +44,7 @@ public:
std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentRowStyles();
std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentTableStyles();
std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentGraphicStyles();
+ std::map<OUString, librevenge::RVNGPropertyList> &GetCurrentPageLayouts();
private:
std::map<OUString, librevenge::RVNGPropertyList> &m_rParagraphStyles;
std::map<OUString, librevenge::RVNGPropertyList> &m_rTextStyles;
@@ -52,6 +53,7 @@ private:
std::map<OUString, librevenge::RVNGPropertyList> &m_rRowStyles;
std::map<OUString, librevenge::RVNGPropertyList> &m_rTableStyles;
std::map<OUString, librevenge::RVNGPropertyList> &m_rGraphicStyles;
+ std::map<OUString, librevenge::RVNGPropertyList> &m_rPageLayouts;
};
/// Handler for <office:font-face-decls>.
diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx
index f64a688de256..130d15b9fad3 100644
--- a/writerperfect/source/writer/exp/xmlimp.cxx
+++ b/writerperfect/source/writer/exp/xmlimp.cxx
@@ -526,6 +526,11 @@ std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetGraphicStyles()
return maGraphicStyles;
}
+std::map<OUString, librevenge::RVNGPropertyList> &XMLImport::GetPageLayouts()
+{
+ return maPageLayouts;
+}
+
void XMLImport::startDocument()
{
mrGenerator.startDocument(librevenge::RVNGPropertyList());
diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx
index 1953c7196772..570cd2e1ec22 100644
--- a/writerperfect/source/writer/exp/xmlimp.hxx
+++ b/writerperfect/source/writer/exp/xmlimp.hxx
@@ -75,6 +75,7 @@ class XMLImport : public cppu::WeakImplHelper
std::map<OUString, librevenge::RVNGPropertyList> maTableStyles;
std::map<OUString, librevenge::RVNGPropertyList> maAutomaticGraphicStyles;
std::map<OUString, librevenge::RVNGPropertyList> maGraphicStyles;
+ std::map<OUString, librevenge::RVNGPropertyList> maPageLayouts;
librevenge::RVNGPropertyListVector maCoverImages;
/// Author, date, etc -- overwrites what would be from the document out of the box.
librevenge::RVNGPropertyList maMetaData;
@@ -103,6 +104,7 @@ public:
std::map<OUString, librevenge::RVNGPropertyList> &GetRowStyles();
std::map<OUString, librevenge::RVNGPropertyList> &GetTableStyles();
std::map<OUString, librevenge::RVNGPropertyList> &GetGraphicStyles();
+ std::map<OUString, librevenge::RVNGPropertyList> &GetPageLayouts();
const librevenge::RVNGPropertyListVector &GetCoverImages();
const librevenge::RVNGPropertyList &GetMetaData();
PopupState FillPopupData(const OUString &rURL, librevenge::RVNGPropertyList &rPropList);