View | Details | Raw Unified | Return to issue 119941
Collapse All | Expand All

(-)comphelper/inc/comphelper/embeddedobjectcontainer.hxx (-3 / +5 lines)
Lines 127-136 Link Here
127
127
128
    // move an embedded object from one container to another one
128
    // move an embedded object from one container to another one
129
    sal_Bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, ::rtl::OUString& );
129
    sal_Bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, ::rtl::OUString& );
130
130
 // #i119941, bKeepToTempStorage: use to specify whether store the removed object to temporary storage+    
131
sal_Bool            RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose = sal_True, sal_Bool bKeepToTempStorage = sal_True );
132
sal_Bool            RemoveEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, sal_Bool bClose = sal_True, sal_Bool bKeepToTempStorage = sal_True ); 
131
    // remove an embedded object from the container and from the storage; if object can't be closed
133
    // remove an embedded object from the container and from the storage; if object can't be closed
132
    sal_Bool            RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose=sal_True );
134
    //sal_Bool            RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose=sal_True );
133
    sal_Bool            RemoveEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, sal_Bool bClose=sal_True );
135
   // sal_Bool            RemoveEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, sal_Bool bClose=sal_True );
134
136
135
	// close and remove an embedded object from the container without removing it from the storage
137
	// close and remove an embedded object from the container without removing it from the storage
136
    sal_Bool            CloseEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
138
    sal_Bool            CloseEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
(-)comphelper/source/container/embeddedobjectcontainer.cxx (-5 / +12 lines)
Lines 950-962 Link Here
950
    return bRet;
950
    return bRet;
951
}
951
}
952
952
953
sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose )
953
//sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose )
954
// #i119941, bKeepToTempStorage: use to specify whether store the removed object to temporary storage+
955
sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose, sal_Bool bKeepToTempStorage )
954
{
956
{
955
	RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Name )" );
957
	RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Name )" );
956
958
957
    uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObject( rName );
959
    uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObject( rName );
958
    if ( xObj.is() )
960
    if ( xObj.is() )
959
        return RemoveEmbeddedObject( xObj, bClose );
961
        //return RemoveEmbeddedObject( xObj, bClose );
962
        return RemoveEmbeddedObject( xObj, bClose, bKeepToTempStorage );
960
    else
963
    else
961
        return sal_False;
964
        return sal_False;
962
}
965
}
Lines 1014-1020 Link Here
1014
    return sal_False;
1017
    return sal_False;
1015
}
1018
}
1016
1019
1017
sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, sal_Bool bClose )
1020
//sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, sal_Bool bClose )
1021
// #i119941, bKeepToTempStorage: use to specify whether store the removed object to temporary storage+
1022
sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, sal_Bool bClose, sal_Bool bKeepToTempStorage ) 
1018
{
1023
{
1019
	RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Object )" );
1024
	RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Object )" );
1020
1025
Lines 1051-1057 Link Here
1051
        // somebody still needs the object, so we must assign a temporary persistence
1056
        // somebody still needs the object, so we must assign a temporary persistence
1052
        try
1057
        try
1053
        {
1058
        {
1054
            if ( xPersist.is() )
1059
        //    if ( xPersist.is() )
1060
             if ( xPersist.is() && bKeepToTempStorage )	// #i119941
1055
            {
1061
            {
1056
                /*
1062
                /*
1057
                //TODO/LATER: needs storage handling!  Why not letting the object do it?!
1063
                //TODO/LATER: needs storage handling!  Why not letting the object do it?!
Lines 1131-1137 Link Here
1131
    }
1137
    }
1132
1138
1133
    OSL_ENSURE( bFound, "Object not found for removal!" );
1139
    OSL_ENSURE( bFound, "Object not found for removal!" );
1134
    if ( xPersist.is() )
1140
   // if ( xPersist.is() )
1141
    if ( xPersist.is() && bKeepToTempStorage )	// #i119941
1135
    {
1142
    {
1136
        // remove replacement image (if there is one)
1143
        // remove replacement image (if there is one)
1137
        RemoveGraphicStream( aName );
1144
        RemoveGraphicStream( aName );
(-)sw/source/core/ole/ndole.cxx (-2 / +26 lines)
Lines 33-38 Link Here
33
#include <com/sun/star/util/XCloseable.hpp>
33
#include <com/sun/star/util/XCloseable.hpp>
34
#include <com/sun/star/util/XModifiable.hpp>
34
#include <com/sun/star/util/XModifiable.hpp>
35
#include <com/sun/star/document/XEventBroadcaster.hpp>
35
#include <com/sun/star/document/XEventBroadcaster.hpp>
36
#include <com/sun/star/chart2/XChartDocument.hpp>	// #i119941
36
#include <cppuhelper/implbase1.hxx>
37
#include <cppuhelper/implbase1.hxx>
37
38
38
#include <cppuhelper/implbase2.hxx>
39
#include <cppuhelper/implbase2.hxx>
Lines 357-364 Link Here
357
			if ( xChild.is() )
358
			if ( xChild.is() )
358
				xChild->setParent( 0 );
359
				xChild->setParent( 0 );
359
360
360
            pCnt->RemoveEmbeddedObject( aOLEObj.aName, sal_False );
361
          // pCnt->RemoveEmbeddedObject( aOLEObj.aName, sal_False );
361
362
           /* #i119941: When cut or move the chart, SwUndoFlyBase::DelFly will call SaveSection to store the comtent to strorage. 
363
           In this step, chart filter functions will be called. And chart filter will call chart core functions to create the chart again. 
364
           Then chart core function will call the class ExplicitCategoryProvider to create data source. 
365
           In this step, when SW data source provider create the data source, it will create a new SwFlyFrm. 
366
           But later in SwUndoFlyBase::DelFly, it will clear anchor related attributes of SwFlyFrm. Then finally null pointer occur.
367
           Resolution:
368
           In pCnt->RemoveEmbeddedObject in SaveSection process of table chart, only remove the object from the object container, 
369
           without removing it's storage and graphic stream. The chart already removed from formatter.> */
370
           sal_Bool	bChartWithInternalProvider = sal_False;
371
           sal_Bool	bKeepObjectToTempStorage = sal_True;
372
           uno::Reference < embed::XEmbeddedObject > xIP = GetOLEObj().GetOleRef();
373
           if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
374
           {
375
               uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY );
376
               if ( xChart.is() && xChart->hasInternalDataProvider() )
377
                   bChartWithInternalProvider = sal_True;
378
           }            
379
            
380
           if ( IsChart() && sChartTblName.Len() && !bChartWithInternalProvider )
381
               bKeepObjectToTempStorage = sal_False;
382
           pCnt->RemoveEmbeddedObject( aOLEObj.aName, sal_False, bKeepObjectToTempStorage );
383
           // modify end            
384
            
385
            
362
			// TODO/LATER: aOLEObj.aName has no meaning here, since the undo container contains the object
386
			// TODO/LATER: aOLEObj.aName has no meaning here, since the undo container contains the object
363
			// by different name, in future it might makes sence that the name is transported here.
387
			// by different name, in future it might makes sence that the name is transported here.
364
            aOLEObj.xOLERef.AssignToContainer( 0, aOLEObj.aName );
388
            aOLEObj.xOLERef.AssignToContainer( 0, aOLEObj.aName );

Return to issue 119941