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

(-)svl/source/items/style.cxx (-8 / +13 lines)
Lines 806-819 Link Here
806
			// Alle Styles umsetzen, deren Parent dieser hier ist
806
			// Alle Styles umsetzen, deren Parent dieser hier ist
807
			ChangeParent( p->GetName(), p->GetParent() );
807
			ChangeParent( p->GetName(), p->GetParent() );
808
808
809
			com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY );
809
            // #120015# Do not dispose, the removed StyleSheet may still be used in
810
			if( xComp.is() ) try
810
            // existing SdrUndoAttrObj incarnations. Rely on refcounting for disposal,
811
			{
811
            // this works well under normal conditions (checked breaking and counting
812
				xComp->dispose();
812
            // on SfxStyleSheetBase constructors and destructors)
813
			}
813
            //
814
			catch( com::sun::star::uno::Exception& )
814
			// com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY );
815
			{
815
			// if( xComp.is() ) try
816
			}
816
			// {
817
			// 	xComp->dispose();
818
			// }
819
			// catch( com::sun::star::uno::Exception& )
820
			// {
821
			// }
817
822
818
			aStyles.erase(aIter);
823
			aStyles.erase(aIter);
819
			Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
824
			Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
(-)svx/source/svdraw/svdundo.cxx (-9 / +44 lines)
Lines 290-303 Link Here
290
290
291
////////////////////////////////////////////////////////////////////////////////////////////////////
291
////////////////////////////////////////////////////////////////////////////////////////////////////
292
292
293
void SdrUndoAttrObj::ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rStyleSheetPool, SfxStyleSheet& rSheet)
294
{
295
    SfxStyleSheetBase* pThere = rStyleSheetPool.Find(rSheet.GetName(), rSheet.GetFamily());
296
297
    if(!pThere)
298
    {
299
        // re-insert remembered style which was removed in the meantime. To do this
300
        // without assertion, do it without parent and set parent after insertion
301
        const UniString aParent(rSheet.GetParent());
302
        
303
        rSheet.SetParent(UniString());
304
        rStyleSheetPool.Insert(&rSheet);
305
        rSheet.SetParent(aParent);
306
    }
307
}
308
293
SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBOOL bSaveText)
309
SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBOOL bSaveText)
294
:	SdrUndoObj(rNewObj),
310
:	SdrUndoObj(rNewObj),
295
	pUndoSet(NULL),
311
	pUndoSet(NULL),
296
	pRedoSet(NULL),
312
	pRedoSet(NULL),
297
	pRepeatSet(NULL),
313
	pRepeatSet(NULL),
298
	pUndoStyleSheet(NULL),
314
    mxUndoStyleSheet(),
299
	pRedoStyleSheet(NULL),
315
    mxRedoStyleSheet(),
300
	pRepeatStyleSheet(NULL),
301
	bHaveToTakeRedoSet(sal_True),
316
	bHaveToTakeRedoSet(sal_True),
302
	pTextUndo(NULL),
317
	pTextUndo(NULL),
303
318
Lines 335-341 Link Here
335
		pUndoSet = new SfxItemSet(pObj->GetMergedItemSet());
350
		pUndoSet = new SfxItemSet(pObj->GetMergedItemSet());
336
351
337
		if(bStyleSheet)
352
		if(bStyleSheet)
338
			pUndoStyleSheet = pObj->GetStyleSheet();
353
            mxUndoStyleSheet = pObj->GetStyleSheet();
339
354
340
		if(bSaveText)
355
		if(bSaveText)
341
		{
356
		{
Lines 394-400 Link Here
394
			pRedoSet = new SfxItemSet(pObj->GetMergedItemSet());
409
			pRedoSet = new SfxItemSet(pObj->GetMergedItemSet());
395
410
396
			if(bStyleSheet)
411
			if(bStyleSheet)
397
				pRedoStyleSheet=pObj->GetStyleSheet();
412
				mxRedoStyleSheet = pObj->GetStyleSheet();
398
413
399
			if(pTextUndo)
414
			if(pTextUndo)
400
			{
415
			{
Lines 408-415 Link Here
408
423
409
		if(bStyleSheet)
424
		if(bStyleSheet)
410
		{
425
		{
411
			pRedoStyleSheet = pObj->GetStyleSheet();
426
			mxRedoStyleSheet = pObj->GetStyleSheet();
412
			pObj->SetStyleSheet(pUndoStyleSheet, sal_True);
427
            SfxStyleSheet* pSheet = dynamic_cast< SfxStyleSheet* >(mxUndoStyleSheet.get());
428
429
            if(pSheet && pObj->GetModel() && pObj->GetModel()->GetStyleSheetPool())
430
            {
431
                ensureStyleSheetInStyleSheetPool(*pObj->GetModel()->GetStyleSheetPool(), *pSheet);
432
    			pObj->SetStyleSheet(pSheet, sal_True);
433
            }
434
            else
435
            {
436
                OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
437
            }
413
		}
438
		}
414
439
415
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
440
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
Lines 482-489 Link Here
482
	{
507
	{
483
		if(bStyleSheet)
508
		if(bStyleSheet)
484
		{
509
		{
485
			pUndoStyleSheet = pObj->GetStyleSheet();
510
            mxUndoStyleSheet = pObj->GetStyleSheet();
486
			pObj->SetStyleSheet(pRedoStyleSheet, sal_True);
511
            SfxStyleSheet* pSheet = dynamic_cast< SfxStyleSheet* >(mxRedoStyleSheet.get());
512
513
            if(pSheet && pObj->GetModel() && pObj->GetModel()->GetStyleSheetPool())
514
            {
515
                ensureStyleSheetInStyleSheetPool(*pObj->GetModel()->GetStyleSheetPool(), *pSheet);
516
			    pObj->SetStyleSheet(pSheet, sal_True);
517
            }
518
            else
519
            {
520
                OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
521
            }
487
		}
522
		}
488
523
489
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
524
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
(-)svx/inc/svx/svdundo.hxx (-3 / +6 lines)
Lines 33-38 Link Here
33
#include <svx/svdtypes.hxx> // fuer enum RepeatFuncts
33
#include <svx/svdtypes.hxx> // fuer enum RepeatFuncts
34
#include <svx/svdsob.hxx>
34
#include <svx/svdsob.hxx>
35
#include "svx/svxdllapi.h"
35
#include "svx/svxdllapi.h"
36
#include <svl/style.hxx>
36
37
37
//************************************************************
38
//************************************************************
38
//   Vorausdeklarationen
39
//   Vorausdeklarationen
Lines 166-174 Link Here
166
	SfxItemSet*					pRepeatSet;
167
	SfxItemSet*					pRepeatSet;
167
168
168
	// oder besser den StyleSheetNamen merken?
169
	// oder besser den StyleSheetNamen merken?
169
	SfxStyleSheet*				pUndoStyleSheet;
170
    rtl::Reference< SfxStyleSheetBase > mxUndoStyleSheet;
170
	SfxStyleSheet*				pRedoStyleSheet;
171
    rtl::Reference< SfxStyleSheetBase > mxRedoStyleSheet;
171
	SfxStyleSheet*				pRepeatStyleSheet;
172
	FASTBOOL					bStyleSheet;
172
	FASTBOOL					bStyleSheet;
173
	FASTBOOL					bHaveToTakeRedoSet;
173
	FASTBOOL					bHaveToTakeRedoSet;
174
174
Lines 181-186 Link Here
181
	// Wenn sich um ein Gruppenobjekt handelt:
181
	// Wenn sich um ein Gruppenobjekt handelt:
182
	SdrUndoGroup*				pUndoGroup;
182
	SdrUndoGroup*				pUndoGroup;
183
183
184
    // helper to ensure StyleSheet is in pool (provided by SdrModel from SdrObject)
185
    void ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rStyleSheetPool, SfxStyleSheet& rSheet);
186
184
public:
187
public:
185
	SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1=sal_False, FASTBOOL bSaveText=sal_False);
188
	SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1=sal_False, FASTBOOL bSaveText=sal_False);
186
	virtual ~SdrUndoAttrObj();
189
	virtual ~SdrUndoAttrObj();

Return to issue 120015