summaryrefslogtreecommitdiff
path: root/sw/source/core/ole/ndole.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/ole/ndole.cxx')
-rw-r--r--sw/source/core/ole/ndole.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 46f7dd7754d8..1f74ff5aed50 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp> // #i119941
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -339,7 +340,30 @@ sal_Bool SwOLENode::SavePersistentData()
if ( xChild.is() )
xChild->setParent( 0 );
- pCnt->RemoveEmbeddedObject( aOLEObj.aName, sal_False );
+ // pCnt->RemoveEmbeddedObject( aOLEObj.aName, sal_False );
+ /* #i119941: When cut or move the chart, SwUndoFlyBase::DelFly will call SaveSection to store the comtent to strorage.
+ In this step, chart filter functions will be called. And chart filter will call chart core functions to create the chart again.
+ Then chart core function will call the class ExplicitCategoryProvider to create data source.
+ In this step, when SW data source provider create the data source, it will create a new SwFlyFrm.
+ But later in SwUndoFlyBase::DelFly, it will clear anchor related attributes of SwFlyFrm. Then finally null pointer occur.
+ Resolution:
+ In pCnt->RemoveEmbeddedObject in SaveSection process of table chart, only remove the object from the object container,
+ without removing it's storage and graphic stream. The chart already removed from formatter.> */
+ sal_Bool bChartWithInternalProvider = sal_False;
+ sal_Bool bKeepObjectToTempStorage = sal_True;
+ uno::Reference < embed::XEmbeddedObject > xIP = GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+ {
+ uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY );
+ if ( xChart.is() && xChart->hasInternalDataProvider() )
+ bChartWithInternalProvider = sal_True;
+ }
+
+ if ( IsChart() && sChartTblName.Len() && !bChartWithInternalProvider )
+ bKeepObjectToTempStorage = sal_False;
+ pCnt->RemoveEmbeddedObject( aOLEObj.aName, sal_False, bKeepObjectToTempStorage );
+ // modify end
+
// TODO/LATER: aOLEObj.aName has no meaning here, since the undo container contains the object
// by different name, in future it might makes sence that the name is transported here.