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

List:       kde-commits
Subject:    koffice/plugins/pictureshape
From:       Sven Langkamp <sven.langkamp () gmail ! com>
Date:       2010-06-24 15:17:25
Message-ID: 20100624151725.433F9AC8DD () svn ! kde ! org
[Download RAW message or body]

SVN commit 1142287 by langkamp:

add support for draw:image-opacity
BUG:239729


 M  +13 -0     PictureShape.cpp  
 M  +2 -0      PictureShape.h  


--- trunk/koffice/plugins/pictureshape/PictureShape.cpp #1142286:1142287
@@ -31,6 +31,7 @@
 #include <KoXmlNS.h>
 #include <KoStoreDevice.h>
 #include <KoUnit.h>
+#include <KoGenStyle.h>
 
 #include <QPainter>
 #include <QTimer>
@@ -240,6 +241,14 @@
     return m_imageCollection;
 }
 
+QString PictureShape::saveStyle(KoGenStyle& style, KoShapeSavingContext& context) const
+{
+    if(transparency() > 0.0) {
+        style.addProperty("draw:image-opacity", QString("%1%").arg((1.0 - transparency()) * 100.0));
+    }
+    return KoShape::saveStyle(style, context);
+}
+
 void PictureShape::loadStyle(const KoXmlElement& element, KoShapeLoadingContext& context)
 {
     KoShape::loadStyle(element, context);
@@ -259,7 +268,11 @@
             setMode(Watermark);
         }
     }
+    const QString opacity(styleStack.property(KoXmlNS::draw, "image-opacity"));
+    if (! opacity.isEmpty() && opacity.right(1) == "%") {
+        setTransparency(1.0 - (opacity.left(opacity.length() - 1).toFloat() / 100.0));
 }
+}
 
 PictureShape::PictureMode PictureShape::mode() const
 {
--- trunk/koffice/plugins/pictureshape/PictureShape.h #1142286:1142287
@@ -64,6 +64,8 @@
 protected:
     virtual bool loadOdfFrameElement(const KoXmlElement &element, KoShapeLoadingContext &context);
 
+    virtual QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
+    
     virtual void loadStyle(const KoXmlElement& element, KoShapeLoadingContext& context);
 
 private:
[prev in list] [next in list] [prev in thread] [next in thread] 

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