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

List:       kde-commits
Subject:    branches/work/koffice-essen/libs/kotext/styles
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2010-10-07 12:17:57
Message-ID: 20101007121757.22FDAAC89F () svn ! kde ! org
[Download RAW message or body]

SVN commit 1183424 by rempt:

Add line-numbering properties to the paragraph style

 M  +32 -0     KoParagraphStyle.cpp  
 M  +23 -2     KoParagraphStyle.h  


--- branches/work/koffice-essen/libs/kotext/styles/KoParagraphStyle.cpp \
#1183423:1183424 @@ -878,6 +878,26 @@
     return propertyInt(DefaultOutlineLevel);
 }
 
+bool KoParagraphStyle::lineNumbering() const
+{
+    return propertyBoolean(LineNumbering);
+}
+
+void KoParagraphStyle::setLineNumbering(bool lineNumbering)
+{
+    setProperty(LineNumbering, lineNumbering);
+}
+
+int KoParagraphStyle::lineNumberStartValue() const
+{
+    return propertyInt(LineNumberStartValue);
+}
+
+void KoParagraphStyle::setLineNumberStartValue(int lineNumberStartValue)
+{
+    setProperty(LineNumberStartValue, lineNumberStartValue);
+}
+
 void KoParagraphStyle::setIsListHeader(bool on)
 {
     setProperty(IsListHeader, on);
@@ -979,6 +999,18 @@
             setDefaultOutlineLevel(level);
     }
 
+    // 15.5.30 - 31
+    if (element->hasAttributeNS(KoXmlNS::text, "number-lines")) {
+        setLineNumbering(element->attributeNS(KoXmlNS::text, "number-lines", \
"false") == "true"); +            if (lineNumbering()) {
+            bool ok;
+                int startValue = element->attributeNS(KoXmlNS::text, \
"line-number").toInt(&ok); +                if (ok) {
+                setLineNumberStartValue(startValue);
+                }
+            }
+    }           
+
     //1.6: KoTextFormat::load
     KoCharacterStyle *charstyle = characterStyle();
     context.styleStack().setTypeProperties("text");   // load all style attributes \
                from "style:text-properties"
--- branches/work/koffice-essen/libs/kotext/styles/KoParagraphStyle.h \
#1183423:1183424 @@ -124,14 +124,19 @@
         MasterPageName,         ///< Optional name of the master-page
 
         OutlineLevel,            ///< Outline level for headings
-        DefaultOutlineLevel
+        DefaultOutlineLevel,
+
+        // numbering
+        LineNumbering,           ///< bool, specifies whether lines should be \
numbered in this paragraph +        LineNumberStartValue     ///< integer value that \
specifies the number for the first line in the paragraph +
 // do 15.5.24
 // continue at 15.5.28
     };
 
     /// Constructor
     KoParagraphStyle(QObject *parent = 0);
-    /// Creates a KoParagraphStyle with the given block format, the block character \
format and \a parent +    /// Creates a KoParagrahStyle with the given block format, \
                the block character format and \a parent
     KoParagraphStyle(const QTextBlockFormat &blockFormat, const QTextCharFormat \
&blockCharFormat, QObject *parent = 0);  /// Destructor
     ~KoParagraphStyle();
@@ -491,6 +496,22 @@
     void setDefaultOutlineLevel(int outline);
 
 
+    /**
+     * 15.5.30: The text:number-lines attribute controls whether or not lines are \
numbered +     */
+    bool lineNumbering() const;
+    void setLineNumbering(bool lineNumbering);
+
+    /**
+     * 15.5.31:
+     * The text:line-number property specifies a new start value for line numbering. \
The attribute is +     * only recognized if there is also a text:number-lines \
attribute with a value of true in the +     * same properties element.
+     */
+    int lineNumberStartValue() const;
+    void setLineNumberStartValue(int lineNumberStartValue);
+
+
     /// copy all the properties from the other style to this style, effectively \
duplicating it.  void copyProperties(const KoParagraphStyle *style);
 


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

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