[Libreoffice-commits] core.git: include/xmloff xmloff/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Jul 19 20:50:45 UTC 2017


 include/xmloff/xmlimp.hxx       |    5 +++--
 xmloff/source/core/xmlimp.cxx   |   11 +++++++++--
 xmloff/source/draw/sdxmlexp.cxx |    8 +++-----
 xmloff/source/draw/ximpshow.cxx |    8 ++++++--
 4 files changed, 21 insertions(+), 11 deletions(-)

New commits:
commit 58ccac44f7df4273db31e4bbe9043bfb4af4d08a
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Jul 18 19:58:06 2017 +0200

    tdf#108824 Honor ODF default for "Mouse pointer visible" property
    
    Change-Id: I6b4c431d66835b6affe834a23b900fa61830d87f
    Reviewed-on: https://gerrit.libreoffice.org/40159
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 1521dd93b0cd..3a38ec1919fc 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -540,9 +540,10 @@ public:
     static const sal_uInt16 LO_42x = 42 | LO_flag;
     static const sal_uInt16 LO_43x = 43 | LO_flag;
     static const sal_uInt16 LO_44x = 44 | LO_flag;
-    /// @ATTENTION: when adding a new value more specific than "5x", grep for
-    /// all current uses and adapt them!!!
     static const sal_uInt16 LO_5x = 50 | LO_flag;
+    /// @ATTENTION: when adding a new value more specific than "6x", grep for
+    /// all current uses and adapt them!!!
+    static const sal_uInt16 LO_6x = 60 | LO_flag;
     static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
 
     /** depending on whether the generator version indicates LO, compare
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 16fcb5791baf..10f31883f236 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -175,11 +175,18 @@ public:
                             mnGeneratorVersion = SvXMLImport::LO_44x; // 4.4
                         }
                     }
-                    else
+                    else if ('5' == loVersion[0])
                     {
-                        SAL_INFO_IF('5' != loVersion[0], "xmloff.core", "unknown LO version: " << loVersion);
                         mnGeneratorVersion = SvXMLImport::LO_5x;
                     }
+                    else if ('6' == loVersion[0])
+                    {
+                        mnGeneratorVersion = SvXMLImport::LO_6x;
+                    }
+                    else
+                    {
+                        SAL_WARN("xmloff.core", "unknown LO version: " << loVersion);
+                    }
                     return; // ignore buildIds
                 }
             }
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 3172188a747b..19ac452fb2a7 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1985,12 +1985,10 @@ void SdXMLExport::exportPresentationSettings()
             bHasAttr = true;
         }
 
+        // We need to always export this attribute, because the import had the wrong default (tdf#108824)
         xPresProps->getPropertyValue("IsMouseVisible") >>= bTemp;
-        if( bTemp )
-        {
-            AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, XML_TRUE );
-            bHasAttr = true;
-        }
+        AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, bTemp ? XML_TRUE : XML_FALSE);
+        bHasAttr = true;
 
         xPresProps->getPropertyValue("StartWithNavigator") >>= bTemp;
         if( bTemp )
diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx
index c24228673bb1..caed5664e6ef 100644
--- a/xmloff/source/draw/ximpshow.cxx
+++ b/xmloff/source/draw/ximpshow.cxx
@@ -81,6 +81,10 @@ SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport,  sal_uInt16 nPrfx, c
     {
         bool bAll = true;
         uno::Any aAny;
+        // Per ODF this is default, but we did it wrong before LO 6.0 (tdf#108824)
+        bool bIsMouseVisible = true;
+        if (rImport.getGeneratorVersion() < SvXMLImport::LO_6x)
+            bIsMouseVisible = false;
 
         // read attributes
         const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
@@ -141,8 +145,7 @@ SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport,  sal_uInt16 nPrfx, c
                 }
                 else if( IsXMLToken( aLocalName, XML_MOUSE_VISIBLE ) )
                 {
-                    aAny <<= IsXMLToken( sValue, XML_TRUE );
-                    mpImpl->mxPresProps->setPropertyValue("IsMouseVisible", aAny );
+                    bIsMouseVisible = IsXMLToken( sValue, XML_TRUE );
                 }
                 else if( IsXMLToken( aLocalName, XML_START_WITH_NAVIGATOR ) )
                 {
@@ -167,6 +170,7 @@ SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport,  sal_uInt16 nPrfx, c
             }
         }
         mpImpl->mxPresProps->setPropertyValue("IsShowAll", Any(bAll) );
+        mpImpl->mxPresProps->setPropertyValue("IsMouseVisible", Any(bIsMouseVisible) );
     }
 }
 


More information about the Libreoffice-commits mailing list