[Libreoffice-commits] .: Branch 'libreoffice-3-4' - writerperfect/source

Michael Meeks mmeeks at kemper.freedesktop.org
Mon Apr 4 03:52:54 PDT 2011


 writerperfect/source/filter/DocumentCollector.cxx |   24 +++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit b215dd3a121ea54c419b10e22a4a566aea8fe297
Author: Michael Meeks <michael.meeks at novell.com>
Date:   Mon Apr 4 11:51:38 2011 +0100

    fix crasher in header / footnotes with no occurrence set

diff --git a/writerperfect/source/filter/DocumentCollector.cxx b/writerperfect/source/filter/DocumentCollector.cxx
index 94b48bc..5093520 100644
--- a/writerperfect/source/filter/DocumentCollector.cxx
+++ b/writerperfect/source/filter/DocumentCollector.cxx
@@ -456,14 +456,20 @@ void DocumentCollector::openPageSpan(const WPXPropertyList &propList)
     mWriterDocumentStates.top().mbFirstParagraphInPageSpan = true;
 }
 
+static bool
+isOccurrenceEven (const WPXPropertyList &propList)
+{
+    const WPXProperty *occurance = propList["libwpd:occurrence"];
+    return occurance && occurance->getStr() == "even";
+}
+
 void DocumentCollector::openHeader(const WPXPropertyList &propList)
 {
     std::vector<DocumentElement *> * pHeaderFooterContentElements = new std::vector<DocumentElement *>;
-
-    if (propList["libwpd:occurrence"]->getStr() == "even")
-                mpCurrentPageSpan->setHeaderLeftContent(pHeaderFooterContentElements);
-        else
-                mpCurrentPageSpan->setHeaderContent(pHeaderFooterContentElements);
+    if (isOccurrenceEven (propList))
+        mpCurrentPageSpan->setHeaderLeftContent(pHeaderFooterContentElements);
+    else
+        mpCurrentPageSpan->setHeaderContent(pHeaderFooterContentElements);
 
     mpCurrentContentElements = pHeaderFooterContentElements;
 }
@@ -477,10 +483,10 @@ void DocumentCollector::openFooter(const WPXPropertyList &propList)
 {
     std::vector<DocumentElement *> * pHeaderFooterContentElements = new std::vector<DocumentElement *>;
 
-    if (propList["libwpd:occurrence"]->getStr() == "even")
-                mpCurrentPageSpan->setFooterLeftContent(pHeaderFooterContentElements);
-        else
-                mpCurrentPageSpan->setFooterContent(pHeaderFooterContentElements);
+    if (isOccurrenceEven (propList))
+        mpCurrentPageSpan->setFooterLeftContent(pHeaderFooterContentElements);
+    else
+        mpCurrentPageSpan->setFooterContent(pHeaderFooterContentElements);
 
     mpCurrentContentElements = pHeaderFooterContentElements;
 }


More information about the Libreoffice-commits mailing list