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

List:       kde-commits
Subject:    koffice/plugins/variables
From:       Pierre Ducroquet <pinaraf () gmail ! com>
Date:       2007-07-21 10:31:05
Message-ID: 1185013865.118718.16747.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 690519 by ducroquet:

Add support for the page number. Thanks Thomas for your help...

 M  +1 -1      CMakeLists.txt  
 M  +14 -6     PageVariable.cpp  
 M  +2 -0      PageVariable.h  


--- trunk/koffice/plugins/variables/CMakeLists.txt #690518:690519
@@ -1,6 +1,6 @@
 project(textvariables)
 
-include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${KOTEXT_INCLUDES} \
${KOMAIN_INCLUDES} ) +include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} \
${KOTEXT_INCLUDES} ${KOGUIUTILS_INCLUDES} ${KOMAIN_INCLUDES} )  
 set(textvariables_SRCS
     VariablesPlugin.cpp
--- trunk/koffice/plugins/variables/PageVariable.cpp #690518:690519
@@ -21,7 +21,8 @@
 
 #include <KoProperties.h>
 #include <kdebug.h>
-#include <KoDocument.h>
+#include <KoTextShapeData.h>
+#include <KoShape.h>
 
 PageVariable::PageVariable()
     : KoVariable(true),
@@ -30,7 +31,6 @@
 }
 
 void PageVariable::setProperties(const KoProperties *props) {
-    // Nothing to be done here ?
     if (props->boolProperty("count")) {
         m_type = PageCount;
     } else {
@@ -41,8 +41,16 @@
 void PageVariable::propertyChanged(Property property, const QVariant &value) {
     if ((property == KoInlineObject::PageCount) && (m_type == PageCount)) {
         setValue(value.toString());
-    }// else if ((property == KoInlineObject::StartPage) && (m_type == PageNumber)) \
                {
-    //    setValue(value.toString());
-    //}
-    //TODO: support for the PageNumber...
+    }
 }
+
+void PageVariable::variableMoved(const KoShape *shape, const QTextDocument \
*document, int posInDocument) { +    if (m_type == PageNumber) {
+        if (shape) {
+            KoTextShapeData *shapeData = dynamic_cast<KoTextShapeData \
*>(shape->userData()); +            if (shapeData) {
+                setValue(QString::number(shapeData->pageNumber()));
+            }
+        }
+    }
+}
\ No newline at end of file
--- trunk/koffice/plugins/variables/PageVariable.h #690518:690519
@@ -42,6 +42,8 @@
 
     void propertyChanged(Property property, const QVariant &value);
 private:
+    void variableMoved(const KoShape *shape, const QTextDocument *document, int \
posInDocument); +    
     PageType m_type;
 };
 


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

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