[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - svgio/inc svgio/source

Xisco Fauli anistenis at gmail.com
Tue Mar 15 15:56:28 UTC 2016


 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |    5 +++--
 svgio/source/svgreader/svgstyleattributes.cxx    |   23 ++++++++++++++++++-----
 2 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit a27ba3413a6ee46451041ccdfefb4f75913adf01
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sat Feb 6 17:04:41 2016 +0100

    tdf#97543 SVGIO: Rework getVisibility()
    
    Change-Id: Idb3eaa27e3e8ec177ebd2bad81f53c4d3da9d241
    Reviewed-on: https://gerrit.libreoffice.org/22169
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>
    (cherry picked from commit 842313c23ec96aeb99b68f28e7d48cc9e263a0a8)
    Reviewed-on: https://gerrit.libreoffice.org/22198
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index e138eb5..828bfb1 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -155,6 +155,7 @@ namespace svgio
 
         enum Visibility
         {
+            Visibility_notset,
             Visibility_visible,
             Visibility_hidden,
             Visibility_collapse,
@@ -412,8 +413,8 @@ namespace svgio
             void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { maOpacity = rOpacity; }
 
             /// Visibility
-            Visibility getVisibility() const { return maVisibility; }
-            void setVisibility(Visibility eVisibility) { maVisibility = eVisibility; }
+            Visibility getVisibility() const;
+            void setVisibility(const Visibility aVisibility = Visibility_notset) { maVisibility = aVisibility; }
 
             // Title content
             const OUString& getTitle() const { return maTitle; }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 5d557ac..765f8f8 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1216,7 +1216,7 @@ namespace svgio
             maTextAnchor(TextAnchor_notset),
             maColor(),
             maOpacity(),
-            maVisibility(Visibility_visible),
+            maVisibility(Visibility_notset),
             maTitle(),
             maDesc(),
             maClipPathXLink(),
@@ -1242,10 +1242,6 @@ namespace svgio
                     mbIsClipPathContent = pParentStyle->mbIsClipPathContent;
                 }
             }
-            if(pParentStyle)
-            {
-                maVisibility = pParentStyle->maVisibility;
-            }
         }
 
         SvgStyleAttributes::~SvgStyleAttributes()
@@ -2144,6 +2140,23 @@ namespace svgio
             return SvgNumber(1.0);
         }
 
+        Visibility SvgStyleAttributes::getVisibility() const
+        {
+            if(Visibility_notset == maVisibility || Visibility_inherit == maVisibility)
+            {
+                const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+
+                if(pSvgStyleAttributes)
+                {
+                    return pSvgStyleAttributes->getVisibility();
+                }
+                //default is Visible
+                return Visibility_visible;
+            }
+
+            return maVisibility;
+        }
+
         FillRule SvgStyleAttributes::getFillRule() const
         {
             if(FillRule_notset != maFillRule)


More information about the Libreoffice-commits mailing list