[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/koffice-ko/kword/part
From:       Matus Uzak <matus.uzak () ixonos ! com>
Date:       2010-04-06 9:26:49
Message-ID: 20100406092649.1D884AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1111620 by uzak:

Support for the next-style-name attribute of the master-page element added to kword.  \
 Original Author: Pavol Korinek 



 M  +1 -1      KWOdfLoader.cpp  
 M  +12 -2     KWPageManager.cpp  
 M  +15 -1     KWPageStyle.cpp  
 M  +7 -1      KWPageStyle.h  
 M  +1 -0      KWPageStyle_p.h  


--- branches/work/koffice-ko/kword/part/KWOdfLoader.cpp #1111619:1111620
@@ -295,7 +295,7 @@
         const KoXmlElement *masterNode = it.value();
         const KoXmlElement *masterPageStyle = masterNode ? \
styles.findStyle(masterNode->attributeNS(KoXmlNS::style, "page-layout-name", \
QString())) : 0;  if (masterPageStyle) {
-            masterPage.loadOdf(*masterPageStyle);
+            masterPage.loadOdf(*masterNode, *masterPageStyle);
             loadHeaderFooter(context, masterPage, *masterNode, LoadHeader);
             loadHeaderFooter(context, masterPage, *masterNode, LoadFooter);
         }
--- branches/work/koffice-ko/kword/part/KWPageManager.cpp #1111619:1111620
@@ -265,10 +265,20 @@
         page.pageNumber = 1;
     }
 
-    if (pageStyle.isValid())
+    if (pageStyle.isValid()) {
         page.style = pageStyle;
-    if (!page.style.isValid())
+    } else {
+        if (page.style.isValid()) {
+            QString nextPageMasterStyleName = page.style.nextStyleName();
+            KWPageStyle nextPageMasterStyle = \
this->pageStyle(nextPageMasterStyleName); +            if \
(nextPageMasterStyle.isValid()) { +                page.style = nextPageMasterStyle;
+            }
+        }
+    }
+    if (!page.style.isValid()) {
         page.style = defaultPageStyle();
+    }
 
     if (page.pageNumber % 2 == 0) {
         if (page.style.pageLayout().bindingSide >= 0) // pageSpread
--- branches/work/koffice-ko/kword/part/KWPageStyle.cpp #1111619:1111620
@@ -61,6 +61,7 @@
         delete background;
     }
     background = 0;
+    nextStyleName.clear();
 }
 
 ///////////
@@ -310,7 +311,7 @@
     return pageLayout;
 }
 
-void KWPageStyle::loadOdf(const KoXmlElement &style)
+void KWPageStyle::loadOdf(const KoXmlElement &masterNode, const KoXmlElement &style)
 {
     d->pageLayout.loadOdf(style);
     KoXmlElement props = KoXml::namedItemNS(style, KoXmlNS::style, \
"page-layout-properties"); @@ -358,6 +359,9 @@
             d->background->ref();
         }
     }
+
+    // Load next master-page style name
+    d->nextStyleName = masterNode.attributeNS(KoXmlNS::style, "next-style-name", \
QString());  }
 
 KoText::Direction KWPageStyle::direction() const
@@ -390,3 +394,13 @@
     return style.hash();
 }
 
+QString KWPageStyle::nextStyleName() const
+{
+    return d->nextStyleName;
+}
+
+void KWPageStyle::setNextStyleName(const QString &nextStyleName)
+{
+    d->nextStyleName = nextStyleName;
+}
+
--- branches/work/koffice-ko/kword/part/KWPageStyle.h #1111619:1111620
@@ -185,6 +185,12 @@
     /// set the background/
     void setBackground(KoShapeBackground *background);
 
+    /// get the next page master style/
+    QString nextStyleName() const;
+
+    /// set the next page master style/
+    void setNextStyleName(const QString &nextStyleName);
+
     /**
      * Save this page style to ODF.
      */
@@ -193,7 +199,7 @@
     /**
      * Load this page style from ODF
      */
-    void loadOdf(const KoXmlElement &style);
+    void loadOdf(const KoXmlElement &masterNode, const KoXmlElement &style);
 
     bool operator==(const KWPageStyle &other) const;
     inline bool operator!=(const KWPageStyle &other) const { return ! \
                operator==(other); }
--- branches/work/koffice-ko/kword/part/KWPageStyle_p.h #1111619:1111620
@@ -45,6 +45,7 @@
     // See parag 16.2 for all the ODF features.
     KoText::Direction direction;
     KoShapeBackground *background;
+    QString nextStyleName;
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic