summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-01-23 22:18:05 -0500
committerNoel Power <noel.power@suse.com>2013-01-24 10:34:38 +0000
commit8a4272347298d8e4eab2fd685a4993709d888762 (patch)
tree0679d346e19d29fad9252d286d3093dd06f25f3b /xmloff
parentbb40a72b5c811189ef783246c94a8ad226f7f347 (diff)
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@suse.com> Reviewed-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 2c83c3e9d208..e12de82cc714 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() )