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

(-)svx/source/svdraw/svdundo.cxx (-9 / +38 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
        rStyleSheetPool.Insert(&rSheet);
300
    }
301
}
302
293
SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBOOL bSaveText)
303
SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBOOL bSaveText)
294
:	SdrUndoObj(rNewObj),
304
:	SdrUndoObj(rNewObj),
295
	pUndoSet(NULL),
305
	pUndoSet(NULL),
296
	pRedoSet(NULL),
306
	pRedoSet(NULL),
297
	pRepeatSet(NULL),
307
	pRepeatSet(NULL),
298
	pUndoStyleSheet(NULL),
308
    mxUndoStyleSheet(),
299
	pRedoStyleSheet(NULL),
309
    mxRedoStyleSheet(),
300
	pRepeatStyleSheet(NULL),
301
	bHaveToTakeRedoSet(sal_True),
310
	bHaveToTakeRedoSet(sal_True),
302
	pTextUndo(NULL),
311
	pTextUndo(NULL),
303
312
Lines 335-341 Link Here
335
		pUndoSet = new SfxItemSet(pObj->GetMergedItemSet());
344
		pUndoSet = new SfxItemSet(pObj->GetMergedItemSet());
336
345
337
		if(bStyleSheet)
346
		if(bStyleSheet)
338
			pUndoStyleSheet = pObj->GetStyleSheet();
347
            mxUndoStyleSheet = pObj->GetStyleSheet();
339
348
340
		if(bSaveText)
349
		if(bSaveText)
341
		{
350
		{
Lines 394-400 Link Here
394
			pRedoSet = new SfxItemSet(pObj->GetMergedItemSet());
403
			pRedoSet = new SfxItemSet(pObj->GetMergedItemSet());
395
404
396
			if(bStyleSheet)
405
			if(bStyleSheet)
397
				pRedoStyleSheet=pObj->GetStyleSheet();
406
				mxRedoStyleSheet = pObj->GetStyleSheet();
398
407
399
			if(pTextUndo)
408
			if(pTextUndo)
400
			{
409
			{
Lines 408-415 Link Here
408
417
409
		if(bStyleSheet)
418
		if(bStyleSheet)
410
		{
419
		{
411
			pRedoStyleSheet = pObj->GetStyleSheet();
420
			mxRedoStyleSheet = pObj->GetStyleSheet();
412
			pObj->SetStyleSheet(pUndoStyleSheet, sal_True);
421
            SfxStyleSheet* pSheet = dynamic_cast< SfxStyleSheet* >(mxUndoStyleSheet.get());
422
423
            if(pSheet && pObj->GetModel() && pObj->GetModel()->GetStyleSheetPool())
424
            {
425
                ensureStyleSheetInStyleSheetPool(*pObj->GetModel()->GetStyleSheetPool(), *pSheet);
426
    			pObj->SetStyleSheet(pSheet, sal_True);
427
            }
428
            else
429
            {
430
                OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
431
            }
413
		}
432
		}
414
433
415
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
434
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
Lines 482-489 Link Here
482
	{
501
	{
483
		if(bStyleSheet)
502
		if(bStyleSheet)
484
		{
503
		{
485
			pUndoStyleSheet = pObj->GetStyleSheet();
504
            mxUndoStyleSheet = pObj->GetStyleSheet();
486
			pObj->SetStyleSheet(pRedoStyleSheet, sal_True);
505
            SfxStyleSheet* pSheet = dynamic_cast< SfxStyleSheet* >(mxRedoStyleSheet.get());
506
507
            if(pSheet && pObj->GetModel() && pObj->GetModel()->GetStyleSheetPool())
508
            {
509
                ensureStyleSheetInStyleSheetPool(*pObj->GetModel()->GetStyleSheetPool(), *pSheet);
510
			    pObj->SetStyleSheet(pSheet, sal_True);
511
            }
512
            else
513
            {
514
                OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
515
            }
487
		}
516
		}
488
517
489
		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
518
		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