summaryrefslogtreecommitdiff
path: root/writerperfect/source/writer
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2018-02-20 18:40:38 +0800
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-04-10 09:33:51 +0200
commitc6d3d0642e0f5d24cab402a8a7c6f81406d044cf (patch)
tree849e29a0ef41b537e3d7038f6542ecf807dd729c /writerperfect/source/writer
parent8cbf84ed33014339cfc9741c1371cd065110060f (diff)
tdf#115623: invoke openPageSpan / closePageSpan
* For paragraphs or tables whose styles specify style:master-page-name, it indicate starting a new page style and should invoke openPageSpan / closePageSapn properly. * closePageSpan at the end of text body is invoked. Change-Id: Ic85157c9b1a43c94a027b464ad9105e9072afcf7 Reviewed-on: https://gerrit.libreoffice.org/52082 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect/source/writer')
-rw-r--r--writerperfect/source/writer/exp/txtparai.cxx1
-rw-r--r--writerperfect/source/writer/exp/txtstyli.cxx1
-rw-r--r--writerperfect/source/writer/exp/xmlimp.cxx32
-rw-r--r--writerperfect/source/writer/exp/xmlimp.hxx5
-rw-r--r--writerperfect/source/writer/exp/xmltbli.cxx3
-rw-r--r--writerperfect/source/writer/exp/xmltext.cxx7
-rw-r--r--writerperfect/source/writer/exp/xmltext.hxx1
7 files changed, 50 insertions, 0 deletions
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx
index 904c865bf90d..e02e83d5fdbf 100644
--- a/writerperfect/source/writer/exp/txtparai.cxx
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -402,6 +402,7 @@ void XMLParaContext::startElement(const OUString &/*rName*/, const css::uno::Ref
m_aStyleName = rAttributeValue;
FillStyles(m_aStyleName, mrImport.GetAutomaticParagraphStyles(), mrImport.GetParagraphStyles(), aPropertyList);
FillStyles(m_aStyleName, mrImport.GetAutomaticTextStyles(), mrImport.GetTextStyles(), m_aTextPropertyList);
+ mrImport.HandlePageSpan(aPropertyList);
}
else
{
diff --git a/writerperfect/source/writer/exp/txtstyli.cxx b/writerperfect/source/writer/exp/txtstyli.cxx
index 548aa654dcdf..90cc66b9c80b 100644
--- a/writerperfect/source/writer/exp/txtstyli.cxx
+++ b/writerperfect/source/writer/exp/txtstyli.cxx
@@ -296,6 +296,7 @@ void XMLStyleContext::startElement(const OUString &/*rName*/, const css::uno::Re
m_aGraphicPropertyList.insert(sName.getStr(), sValue.getStr());
m_aPageLayoutPropertyList.insert(sName.getStr(), sValue.getStr());
m_aMasterPagePropertyList.insert(sName.getStr(), sValue.getStr());
+ m_aTablePropertyList.insert(sName.getStr(), sValue.getStr());
}
}
diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx
index 9ef9afa837c1..5c22a5f911d7 100644
--- a/writerperfect/source/writer/exp/xmlimp.cxx
+++ b/writerperfect/source/writer/exp/xmlimp.cxx
@@ -339,6 +339,7 @@ void XMLOfficeDocContext::HandleFixedLayoutPage(const FixedLayoutPage &rPage, bo
XMLImport::XMLImport(const uno::Reference<uno::XComponentContext> &xContext, librevenge::RVNGTextInterface &rGenerator, const OUString &rURL, const uno::Sequence<beans::PropertyValue> &rDescriptor, const std::vector<FixedLayoutPage> &rPageMetafiles)
: mrGenerator(rGenerator),
mxContext(xContext),
+ mbIsInPageSpan(false),
mrPageMetafiles(rPageMetafiles)
{
uno::Sequence<beans::PropertyValue> aFilterData;
@@ -595,6 +596,37 @@ void XMLImport::setDocumentLocator(const uno::Reference<xml::sax::XLocator> &/*x
{
}
+void XMLImport::HandlePageSpan(const librevenge::RVNGPropertyList &rPropertyList)
+{
+ OUString sMasterPageName;
+ OUString sLayoutName;
+
+ if (rPropertyList["style:master-page-name"])
+ sMasterPageName = OStringToOUString(rPropertyList["style:master-page-name"]->getStr().cstr(), RTL_TEXTENCODING_UTF8);
+ else if (!GetIsInPageSpan())
+ sMasterPageName = "Standard";
+
+ if (sMasterPageName.getLength())
+ {
+ librevenge::RVNGPropertyList &rMasterPage = GetMasterStyles()[sMasterPageName];
+ if (rMasterPage["style:page-layout-name"])
+ {
+ sLayoutName = OStringToOUString(rMasterPage["style:page-layout-name"]->getStr().cstr(), RTL_TEXTENCODING_UTF8);
+ }
+ }
+
+ if (sLayoutName.getLength())
+ {
+ librevenge::RVNGPropertyList &rPageLayout = GetPageLayouts()[sLayoutName];
+
+ if (GetIsInPageSpan())
+ GetGenerator().closePageSpan();
+
+ GetGenerator().openPageSpan(rPageLayout);
+ SetIsInPageSpan(true);
+ }
+}
+
} // namespace exp
} // namespace writerperfect
diff --git a/writerperfect/source/writer/exp/xmlimp.hxx b/writerperfect/source/writer/exp/xmlimp.hxx
index 392eef4956cd..097a96cdcce9 100644
--- a/writerperfect/source/writer/exp/xmlimp.hxx
+++ b/writerperfect/source/writer/exp/xmlimp.hxx
@@ -83,6 +83,7 @@ class XMLImport : public cppu::WeakImplHelper
const css::uno::Reference<css::uno::XComponentContext> &mxContext;
css::uno::Reference<css::uri::XUriReferenceFactory> mxUriReferenceFactory;
OUString maMediaDir;
+ bool mbIsInPageSpan;
const std::vector<FixedLayoutPage> &mrPageMetafiles;
public:
@@ -113,6 +114,10 @@ public:
const std::vector<FixedLayoutPage> &GetPageMetafiles() const;
const css::uno::Reference<css::uno::XComponentContext> &GetComponentContext() const;
+ bool GetIsInPageSpan() const { return mbIsInPageSpan; }
+ void SetIsInPageSpan(bool bSet) { mbIsInPageSpan = bSet; }
+ void HandlePageSpan(const librevenge::RVNGPropertyList &rPropertyList);
+
// XDocumentHandler
void SAL_CALL startDocument() override;
void SAL_CALL endDocument() override;
diff --git a/writerperfect/source/writer/exp/xmltbli.cxx b/writerperfect/source/writer/exp/xmltbli.cxx
index bec52dab0f22..82468e12a91a 100644
--- a/writerperfect/source/writer/exp/xmltbli.cxx
+++ b/writerperfect/source/writer/exp/xmltbli.cxx
@@ -205,7 +205,10 @@ void XMLTableContext::startElement(const OUString &/*rName*/, const css::uno::Re
const OUString &rAttributeValue = xAttribs->getValueByIndex(i);
if (rAttributeName == "table:style-name")
+ {
FillStyles(rAttributeValue, mrImport.GetAutomaticTableStyles(), mrImport.GetTableStyles(), m_aPropertyList);
+ mrImport.HandlePageSpan(m_aPropertyList);
+ }
else
{
OString sName = OUStringToOString(rAttributeName, RTL_TEXTENCODING_UTF8);
diff --git a/writerperfect/source/writer/exp/xmltext.cxx b/writerperfect/source/writer/exp/xmltext.cxx
index 3902e15ae839..a6624b1f2115 100644
--- a/writerperfect/source/writer/exp/xmltext.cxx
+++ b/writerperfect/source/writer/exp/xmltext.cxx
@@ -13,6 +13,7 @@
#include "xmltbli.hxx"
#include "XMLSectionContext.hxx"
#include "XMLTextListContext.hxx"
+#include "xmlimp.hxx"
using namespace com::sun::star;
@@ -26,6 +27,12 @@ XMLBodyContentContext::XMLBodyContentContext(XMLImport &rImport)
{
}
+void XMLBodyContentContext::endElement(const OUString &/*rName*/)
+{
+ if (mrImport.GetIsInPageSpan())
+ mrImport.GetGenerator().closePageSpan();
+}
+
rtl::Reference<XMLImportContext> XMLBodyContentContext::CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/)
{
return CreateTextChildContext(mrImport, rName);
diff --git a/writerperfect/source/writer/exp/xmltext.hxx b/writerperfect/source/writer/exp/xmltext.hxx
index bce957c4f7e8..1c9a1e131542 100644
--- a/writerperfect/source/writer/exp/xmltext.hxx
+++ b/writerperfect/source/writer/exp/xmltext.hxx
@@ -24,6 +24,7 @@ public:
XMLBodyContentContext(XMLImport &rImport);
rtl::Reference<XMLImportContext> CreateChildContext(const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/) override;
+ void SAL_CALL endElement(const OUString &rName) override;
};
/// Context factory for body text, section, table cell, etc.