[Libreoffice-commits] .: src/lib

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 6 17:43:46 PST 2013


 src/lib/EscherFieldIds.h   |    1 +
 src/lib/Fill.cpp           |   19 +++++++++++++++++++
 src/lib/Fill.h             |    9 +++++++++
 src/lib/MSPUBCollector.cpp |    6 +++++-
 src/lib/MSPUBParser.cpp    |    9 +++++++++
 5 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit fb7432a35aeb55634e5cf45a1f4b8d91dba8aff4
Author: Brennan Vincent <brennan.vincent at gmail.com>
Date:   Fri Feb 1 20:04:45 2013 -0700

    Respect flags that determine whether to use a shape fill's properties

diff --git a/src/lib/EscherFieldIds.h b/src/lib/EscherFieldIds.h
index b770c38..c7b2920 100644
--- a/src/lib/EscherFieldIds.h
+++ b/src/lib/EscherFieldIds.h
@@ -40,6 +40,7 @@
 #define FIELDID_FILL_OPACITY           0x0182
 #define FIELDID_FILL_BACK_COLOR        0x0183
 #define FIELDID_FILL_BACK_OPACITY      0x0184
+#define FIELDID_FILL_STYLE_BOOL_PROPS  0x01BF
 #define FIELDID_LINE_COLOR             0x01C0
 #define FIELDID_LINE_BACK_COLOR        0x01C2
 #define FIELDID_LINE_STYLE_BOOL_PROPS  0x01FF
diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp
index cade9b8..8491eb8 100644
--- a/src/lib/Fill.cpp
+++ b/src/lib/Fill.cpp
@@ -32,6 +32,25 @@
 
 using namespace libmspub;
 
+NonexistentFill::NonexistentFill(const MSPUBCollector *owner) : Fill(owner)
+{
+}
+
+bool NonexistentFill::fillExists() const
+{
+  return false;
+}
+
+WPXPropertyListVector NonexistentFill::getProperties(WPXPropertyList *) const
+{
+  return WPXPropertyListVector();
+}
+
+bool Fill::fillExists() const
+{
+  return true;
+}
+
 Fill::Fill(const MSPUBCollector *owner) : m_owner(owner)
 {
 }
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index dc6bc31..87f25d8 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -47,12 +47,21 @@ protected:
 public:
   Fill(const MSPUBCollector *owner);
   virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
+  virtual bool fillExists() const;
   virtual ~Fill() { }
 private:
   Fill(const Fill &) : m_owner(NULL) { }
   Fill &operator=(const Fill &);
 };
 
+class NonexistentFill : public Fill
+{
+public:
+  NonexistentFill(const MSPUBCollector *owner);
+  WPXPropertyListVector getProperties(WPXPropertyList *out) const;
+  bool fillExists() const;
+};
+
 class ImgFill : public Fill
 {
 protected:
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index ad3006a..c26bf7c 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -350,7 +350,11 @@ void libmspub::MSPUBCollector::setupShapeStructures(ShapeGroupElement &elt)
       unsigned index = ptr_info->m_imgIndex.get();
       if (index - 1 < m_images.size())
       {
-        ptr_info->m_fill = boost::shared_ptr<const Fill>(new ImgFill(index, this, false));
+        //if earlier we have set the fill explicitly to nonexistent, don't overwrite that now.
+        if (! (ptr_info->m_fill && !ptr_info->m_fill->fillExists()))
+        {
+          ptr_info->m_fill = boost::shared_ptr<const Fill>(new ImgFill(index, this, false));
+        }
       }
     }
     elt.setShapeInfo(*ptr_info);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 414a946..ed34f36 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1816,6 +1816,15 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
 boost::shared_ptr<libmspub::Fill> libmspub::MSPUBParser::getNewFill(const std::map<unsigned short, unsigned> &foptProperties,
     bool &skipIfNotBg)
 {
+  const unsigned *ptr_fillStyleBoolProps = getIfExists_const(foptProperties, FIELDID_FILL_STYLE_BOOL_PROPS);
+  // 0x10 is "fillShape" and 0x100000 is "useFillShape"... don't ask me to explain why MS needs two fields for one property
+  // in any case, if 0x100000 tells us we are allowed to use 0x10 and 0x10 is not set,
+  // the fill is just transparent
+  if (ptr_fillStyleBoolProps && *ptr_fillStyleBoolProps & 0x100000 && !(*ptr_fillStyleBoolProps & 0x10))
+  {
+    MSPUB_DEBUG_MSG(("Not filling shape!\n"));
+    return boost::shared_ptr<Fill>(new NonexistentFill(m_collector));
+  }
   const FillType *ptr_fillType = (FillType *)getIfExists_const(foptProperties, FIELDID_FILL_TYPE);
   FillType fillType = ptr_fillType ? *ptr_fillType : SOLID;
   switch (fillType)


More information about the Libreoffice-commits mailing list