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

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

Return to issue 119941