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

List:       kde-commits
Subject:    branches/work/koffice-essen/libs/kotext/styles
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2010-12-02 21:52:10
Message-ID: 20101202215210.DA219AC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202958 by sebsauer:

implement ODF list-level-position-and-space-mode==label-alignment
BUG:220697


 M  +30 -1     KoListLevelProperties.cpp  


--- branches/work/koffice-essen/libs/kotext/styles/KoListLevelProperties.cpp \
#1202957:1202958 @@ -520,6 +520,35 @@
             continue;
         const QString localName = property.localName();
         if (localName == "list-level-properties") {
+            QString mode(property.attributeNS(KoXmlNS::text, \
"list-level-position-and-space-mode")); +            if (mode == "label-alignment") {
+                KoXmlElement p;
+                forEachElement(p, property) {
+                     if (p.namespaceURI() == KoXmlNS::style && p.localName() == \
"list-level-label-alignment") { +                        // The \
<style:list-level-label-alignment> element and the fo:text-align attribute are used \
to define +                        // the position and spacing of the list label and \
the list item. The values of the attributes for +                        // \
text:space-before, text:min-label-width and text:min-label-distance are assumed to be \
0. +
+                        QString textAlign(p.attributeNS(KoXmlNS::fo, "text-align"));
+                        if (!textAlign.isEmpty())
+                            setAlignment(KoText::alignmentFromString(textAlign));
+
+                        QString textindent(p.attributeNS(KoXmlNS::fo, \
"text-indent")); +                        QString \
marginleft(p.attributeNS(KoXmlNS::fo, "margin-left")); +                        qreal \
ti = textindent.isEmpty() ? 0 : KoUnit::parseValue(textindent); +                     \
qreal ml = marginleft.isEmpty() ? 0 : KoUnit::parseValue(marginleft); +               \
setIndent(qMax(0.0, ti + ml)); +                
+                        setMinimumWidth(0);
+                        setMinimumDistance(0);
+                        
+                        //TODO support ODF 18.829 text:label-followed-by and 18.832 \
text:list-tab-stop-position +                     }   
+                }
+            } else { // default is mode == "label-width-and-position"
+                // The text:space-before, text:min-label-width, \
text:minimum-label-distance and fo:text-align attributes +                // are used \
to define the position and spacing of the list label and the list item. +
             QString spaceBefore(property.attributeNS(KoXmlNS::text, \
"space-before"));  if (!spaceBefore.isEmpty())
                 setIndent(KoUnit::parseValue(spaceBefore));
@@ -543,12 +572,12 @@
             QString height(property.attributeNS(KoXmlNS::fo, "height"));
             if (!height.isEmpty())
                 setHeight(KoUnit::parseValue(height));
+            }
         } else if (localName == "text-properties") {
             // TODO
             QString color(property.attributeNS(KoXmlNS::fo, "color"));
             if (!color.isEmpty())
                 setBulletColor(QColor(color));
-	
 	}
     }
 }


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

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