[Libreoffice-commits] .: Branch 'libreoffice-4-0-0' - sc/inc sc/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jan 26 16:14:53 PST 2013


 sc/inc/unonames.hxx                 |    1 +
 sc/source/ui/unoobj/chart2uno.cxx   |    8 +++++++-
 xmloff/source/chart/SchXMLTools.cxx |   30 +++++++++++++++++++++++++-----
 3 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit 2b641b29b55c7e8a08dcbbb10927c354059916bd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Jan 23 22:18:05 2013 -0500

    fdo#58562: Ensure internal data is always used when pasting to another doc.
    
    Without this, pasting a chart object from one Calc doc to another may
    occasionally incorrectly switch to range references *if* the destination
    document contains the "right" set of sheet names.  With this fix, pasted
    chart objects always switch to internal cached data source when pasting
    to another document, while retaining range references when pasting within
    the same document.
    
    Change-Id: If1dbc854c5faae62f06ece155fad470b229ca0c7
    Reviewed-on: https://gerrit.libreoffice.org/1835
    Tested-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-on: https://gerrit.libreoffice.org/1846
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index ca89837..9ab1856 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -652,6 +652,7 @@
 #define SC_UNONAME_HIDDENVALUES         "HiddenValues"
 #define SC_UNONAME_INCLUDEHIDDENCELLS   "IncludeHiddenCells"
 #define SC_UNONAME_HIDDENVALUES     "HiddenValues"
+#define SC_UNONAME_USE_INTERNAL_DATA_PROVIDER "UseInternalDataProvider"
 
 // Solver
 #define SC_UNONAME_TIMEOUT          "Timeout"
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 53656cb..5ea6f54 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -76,7 +76,8 @@ const SfxItemPropertyMapEntry* lcl_GetDataProviderPropertyMap()
 {
     static SfxItemPropertyMapEntry aDataProviderPropertyMap_Impl[] =
     {
-        {MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0,        &getBooleanCppuType(),                  0, 0 },
+        { MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, &getBooleanCppuType(), 0, 0 },
+        { MAP_CHAR_LEN(SC_UNONAME_USE_INTERNAL_DATA_PROVIDER), 0, &getBooleanCppuType(), 0, 0 },
         {0,0,0,0,0,0}
     };
     return aDataProviderPropertyMap_Impl;
@@ -2327,6 +2328,11 @@ uno::Any SAL_CALL ScChart2DataProvider::getPropertyValue(
     uno::Any aRet;
     if ( rPropertyName == SC_UNONAME_INCLUDEHIDDENCELLS )
         aRet <<= m_bIncludeHiddenCells;
+    else if (rPropertyName == SC_UNONAME_USE_INTERNAL_DATA_PROVIDER)
+    {
+        // This is a read-only property.
+        aRet <<= static_cast<sal_Bool>(m_pDocument->PastingDrawFromOtherDoc());
+    }
     else
         throw beans::UnknownPropertyException();
     return aRet;
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 2c83c3e..e12de82 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -380,14 +380,34 @@ Reference< chart2::data::XDataSequence > CreateDataSequence(
         return xRet;
     }
 
-    try
+    bool bUseInternal = false;
+    uno::Reference<beans::XPropertySet> xPropSet(xDataProvider, uno::UNO_QUERY);
+    if (xPropSet.is())
     {
-        xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
-        SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
+        try
+        {
+            sal_Bool bVal;
+            uno::Any any = xPropSet->getPropertyValue("UseInternalDataProvider");
+            if (any >>= bVal)
+                bUseInternal = static_cast<bool>(bVal);
+        }
+        catch (const beans::UnknownPropertyException&)
+        {
+            // Do nothing
+        }
     }
-    catch( const lang::IllegalArgumentException & )
+
+    if (!bUseInternal)
     {
-        OSL_FAIL( "could not create data sequence" );
+        try
+        {
+            xRet.set( xDataProvider->createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider )));
+            SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange );
+        }
+        catch( const lang::IllegalArgumentException & )
+        {
+            OSL_FAIL( "could not create data sequence" );
+        }
     }
 
     if( !xRet.is() && !xChartDoc->hasInternalDataProvider() && !rRange.isEmpty() )


More information about the Libreoffice-commits mailing list