summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-06-12 09:50:11 +0000
committerArmin Le Grand <alg@apache.org>2013-06-12 09:50:11 +0000
commitf3fc172d21f772035e412e3e47f039cad4a80a19 (patch)
tree1f05630d6a74a423e189f4ba78bd4a9c3ffd11db /sc
parent20b5afffafc71d2ad2fef80cd4239d6865625649 (diff)
i118840 Make it possible to identify temporary calc docs and use it to not access inexistent data
Notes
Notes: prefer: 043e30baedb42dbc8799003ea2ae7987a97871ca
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx7
-rw-r--r--sc/source/core/data/documen2.cxx1
-rw-r--r--sc/source/ui/docshell/docsh.cxx7
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx11
4 files changed, 25 insertions, 1 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 3a5b0189eac2..025c322d585d 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -435,6 +435,9 @@ private:
bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters)
bool mbStreamValidLocked;
+ // #118840# Have a flag to know that this ScDocument is used temporary
+ bool mbIsTemporary : 1;
+
sal_Int16 mnNamedRangesLockCount;
public:
@@ -611,6 +614,10 @@ public:
void SetStreamValid( SCTAB nTab, sal_Bool bSet, sal_Bool bIgnoreLock = sal_False );
void LockStreamValid( bool bLock );
bool IsStreamValidLocked() const { return mbStreamValidLocked; }
+
+ // #118840# Have a flag to know that this ScDocument is used temporary
+ bool IsTemporary() const { return mbIsTemporary; }
+
SC_DLLPUBLIC sal_Bool IsPendingRowHeights( SCTAB nTab ) const;
SC_DLLPUBLIC void SetPendingRowHeights( SCTAB nTab, sal_Bool bSet );
SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, sal_Bool bRTL );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 173186022b44..85c9ca658746 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -215,6 +215,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
mbExecuteLinkEnabled( true ),
mbChangeReadOnlyEnabled( false ),
mbStreamValidLocked( false ),
+ mbIsTemporary(false), // #118840#
mnNamedRangesLockCount( 0 )
{
SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index dee921446edf..c81a9b71c32a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2589,6 +2589,13 @@ ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags )
bIsInplace = (GetCreateMode() == SFX_CREATE_MODE_EMBEDDED);
// wird zurueckgesetzt, wenn nicht inplace
+ // #118840# set flag at ScDocument that it is used temporary (e.g. inplace
+ // for transporting a chart over the clipboard)
+ if(bIsInplace)
+ {
+ aDocument.mbIsTemporary = true;
+ }
+
pDocFunc = new ScDocFunc(*this);
// SetBaseModel needs exception handling
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index a4d923bba8a2..105cf9bcbd80 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2176,7 +2176,16 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeFromXML( const rtl::OUS
}
OUString aRet;
- ScRangeStringConverter::GetStringFromXMLRangeString(aRet, sXMLRange, m_pDocument);
+
+ // #118840# Only interpret range string when the ScDocument is not just used
+ // temporary (e.g. for transporting a chart over the clipboard). In that case, the local
+ // cell data would be invalid; despite the fact that a 'Sheet1' exists (just because
+ // it's the default)
+ if(!m_pDocument->IsTemporary())
+ {
+ ScRangeStringConverter::GetStringFromXMLRangeString(aRet, sXMLRange, m_pDocument);
+ }
+
return aRet;
}