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

List:       kde-commits
Subject:    koffice/libs/kotext/styles
From:       Carlos Licea <carlos_licea () hotmail ! com>
Date:       2010-09-14 19:07:46
Message-ID: 20100914190746.393B7AC88E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1175337 by clicea:

I'm affraid loading the styles is not that simple. The properties
are spread amoung different tags.

The standard is a vague on which properties can go on each element,
or if the properties can be present on both elements and if so,
which one to preffer (e.g. pragraph and graphics for border.) For
now we follow OOo lead when we read the properties.

 M  +17 -16    KoTableCellStyle.cpp  


--- trunk/koffice/libs/kotext/styles/KoTableCellStyle.cpp #1175336:1175337
@@ -994,13 +994,12 @@
     QString family = element->attributeNS(KoXmlNS::style, "family", "table-cell");
     context.addStyles(element, family.toLocal8Bit().constData());   // Load all \
parents - only because we don't support inheritance.  
-    context.styleStack().setTypeProperties("table-cell");   // load all style \
                attributes from "style:table-properties"
     loadOdfProperties(context.styleStack());   // load the KoTableCellStyle from the \
                stylestack
-    context.styleStack().restore();
 }
 
 void KoTableCellStyle::loadOdfProperties(KoStyleStack &styleStack)
 {
+    styleStack.setTypeProperties("graphic");
     // Padding
     if (styleStack.hasProperty(KoXmlNS::fo, "padding-left"))
         setLeftPadding(KoUnit::parseValue(styleStack.property(KoXmlNS::fo, \
"padding-left"))); @@ -1013,6 +1012,21 @@
     if (styleStack.hasProperty(KoXmlNS::fo, "padding"))
         setPadding(KoUnit::parseValue(styleStack.property(KoXmlNS::fo, "padding")));
 
+    // The fo:background-color attribute specifies the background color of a cell.
+    if (styleStack.hasProperty(KoXmlNS::fo, "background-color")) {
+        const QString bgcolor = styleStack.property(KoXmlNS::fo, \
"background-color"); +        QBrush brush = background();
+        if (bgcolor == "transparent")
+           clearBackground();
+        else {
+            if (brush.style() == Qt::NoBrush)
+                brush.setStyle(Qt::SolidPattern);
+            brush.setColor(bgcolor); // #rrggbb format
+            setBackground(brush);
+        }
+    }
+
+    styleStack.setTypeProperties("paragraph");
     // Borders
     if (styleStack.hasProperty(KoXmlNS::fo, "border", "left")) {
         QString border = styleStack.property(KoXmlNS::fo, "border", "left");
@@ -1115,25 +1129,12 @@
         }
     }
 
-    // The fo:background-color attribute specifies the background color of a cell.
-    if (styleStack.hasProperty(KoXmlNS::fo, "background-color")) {
-        const QString bgcolor = styleStack.property(KoXmlNS::fo, \
                "background-color");
-        QBrush brush = background();
-        if (bgcolor == "transparent")
-           clearBackground();
-        else {
-            if (brush.style() == Qt::NoBrush)
-                brush.setStyle(Qt::SolidPattern);
-            brush.setColor(bgcolor); // #rrggbb format
-            setBackground(brush);
-        }
-    }
-
     // Alignment
     const QString verticalAlign(styleStack.property(KoXmlNS::style, \
"vertical-align"));  if (!verticalAlign.isEmpty()) {
         setAlignment(KoText::valignmentFromString(verticalAlign));
     }
+    styleStack.restore();
 }
 
 void KoTableCellStyle::copyProperties(const KoTableCellStyle *style)


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

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