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

(-)sc/inc/document.hxx (+4 lines)
Lines 232-237 Link Here
232
232
233
233
234
// -----------------------------------------------------------------------
234
// -----------------------------------------------------------------------
235
enum { E_MEDIUM_FLAG_NONE = 0, E_MEDIUM_FLAG_EXCEL = 1, E_MEDIUM_FLAG_MSXML = 2 };
235
236
236
class ScDocument
237
class ScDocument
237
{
238
{
Lines 390-395 Link Here
390
	sal_Bool				bInsertingFromOtherDoc;
391
	sal_Bool				bInsertingFromOtherDoc;
391
    bool                bLoadingMedium;
392
    bool                bLoadingMedium;
392
    bool                bImportingXML;      // special handling of formula text
393
    bool                bImportingXML;      // special handling of formula text
394
    bool                mbImportingMSXML;
393
    sal_Bool                bXMLFromWrapper;    // distinguish ScXMLImportWrapper from external component
395
    sal_Bool                bXMLFromWrapper;    // distinguish ScXMLImportWrapper from external component
394
	sal_Bool				bCalcingAfterLoad;				// in CalcAfterLoad TRUE
396
	sal_Bool				bCalcingAfterLoad;				// in CalcAfterLoad TRUE
395
	// wenn temporaer keine Listener auf/abgebaut werden sollen
397
	// wenn temporaer keine Listener auf/abgebaut werden sollen
Lines 1570-1575 Link Here
1570
    void            SetLoadingMedium( bool bVal );
1572
    void            SetLoadingMedium( bool bVal );
1571
    void            SetImportingXML( bool bVal );
1573
    void            SetImportingXML( bool bVal );
1572
    bool            IsImportingXML() const { return bImportingXML; }
1574
    bool            IsImportingXML() const { return bImportingXML; }
1575
	void			SetImportingMSXML( bool bVal );
1576
	bool			IsImportingMSXML() const { return mbImportingMSXML; }
1573
	void			SetXMLFromWrapper( sal_Bool bVal );
1577
	void			SetXMLFromWrapper( sal_Bool bVal );
1574
	sal_Bool			IsXMLFromWrapper() const { return bXMLFromWrapper; }
1578
	sal_Bool			IsXMLFromWrapper() const { return bXMLFromWrapper; }
1575
	void			SetCalcingAfterLoad( sal_Bool bVal ) { bCalcingAfterLoad = bVal; }
1579
	void			SetCalcingAfterLoad( sal_Bool bVal ) { bCalcingAfterLoad = bVal; }
(-)sc/inc/drwlayer.hxx (+19 lines)
Lines 101-106 Link Here
101
	sal_Bool			bRecording;
101
	sal_Bool			bRecording;
102
	sal_Bool			bAdjustEnabled;
102
	sal_Bool			bAdjustEnabled;
103
	sal_Bool			bHyphenatorSet;
103
	sal_Bool			bHyphenatorSet;
104
    bool            mbUndoAllowed;
104
105
105
private:
106
private:
106
	void			MoveAreaTwips( SCTAB nTab, const Rectangle& rArea, const Point& rMove,
107
	void			MoveAreaTwips( SCTAB nTab, const Rectangle& rArea, const Point& rMove,
Lines 150-155 Link Here
150
	sal_Bool			IsRecording() const			{ return bRecording; }
151
	sal_Bool			IsRecording() const			{ return bRecording; }
151
	void			AddCalcUndo( SdrUndoAction* pUndo );
152
	void			AddCalcUndo( SdrUndoAction* pUndo );
152
153
154
    template< typename TUndoAction, typename TArg >
155
    inline void			AddCalcUndo( const TArg & rArg )    {   if( this->IsUndoAllowed() )  this->AddCalcUndo( new TUndoAction( rArg ) ); }
156
157
    template< typename TUndoAction, typename TArg >
158
    inline void			AddCalcUndo( TArg & rArg )    {   if( this->IsUndoAllowed() )  this->AddCalcUndo( new TUndoAction( rArg ) ); }
159
	
160
    template< typename TUndoAction, typename TArg1, typename TArg2 >
161
    inline void			AddCalcUndo( TArg1 & rArg1, TArg2 & rArg2 ) {   if( this->IsUndoAllowed() )  this->AddCalcUndo( new TUndoAction( rArg1, rArg2 ) ); }
162
163
    template< typename TUndoAction, typename TArg1, typename TArg2 >
164
    inline void			AddCalcUndo( const TArg1 & rArg1, const TArg2 & rArg2 ) {   if( this->IsUndoAllowed() )  this->AddCalcUndo( new TUndoAction( rArg1, rArg2 ) ); }
165
166
    template< typename TUndoAction, typename TArg1, typename TArg2, typename TArg3, typename TArg4, typename TArg5 >
167
    inline void			AddCalcUndo( const TArg1 & rArg1, const TArg2 & rArg2, const TArg3 & rArg3, const TArg4 & rArg4, const TArg5 & rArg5 )    {   if( this->IsUndoAllowed() )  this->AddCalcUndo( new TUndoAction( rArg1, rArg2, rArg3, rArg4, rArg5 ) ); }
168
153
	void			MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
169
	void			MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
154
								SCsCOL nDx,SCsROW nDy, sal_Bool bInsDel, bool bUpdateNoteCaptionPos = true );
170
								SCsCOL nDx,SCsROW nDy, sal_Bool bInsDel, bool bUpdateNoteCaptionPos = true );
155
	void			WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips );
171
	void			WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips );
Lines 221-226 Link Here
221
	static void		SetGlobalDrawPersist(SfxObjectShell* pPersist);
237
	static void		SetGlobalDrawPersist(SfxObjectShell* pPersist);
222
protected:
238
protected:
223
	virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
239
	virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
240
public:
241
    inline void SetUndoAllowed( bool bUndoAllowed ){ mbUndoAllowed = bUndoAllowed; }
242
    inline bool IsUndoAllowed() const{ return mbUndoAllowed; }
224
};
243
};
225
244
226
245
(-)sc/source/core/data/documen2.cxx (+1 lines)
Lines 188-193 Link Here
188
		bInsertingFromOtherDoc( sal_False ),
188
		bInsertingFromOtherDoc( sal_False ),
189
        bLoadingMedium( false ),
189
        bLoadingMedium( false ),
190
		bImportingXML( false ),
190
		bImportingXML( false ),
191
        mbImportingMSXML( false ),
191
        bXMLFromWrapper( sal_False ),
192
        bXMLFromWrapper( sal_False ),
192
		bCalcingAfterLoad( sal_False ),
193
		bCalcingAfterLoad( sal_False ),
193
		bNoListening( sal_False ),
194
		bNoListening( sal_False ),
(-)sc/source/core/data/documen9.cxx (-1 / +12 lines)
Lines 131-137 Link Here
131
                    pNewPage->InsertObject( pNewObject );
131
                    pNewPage->InsertObject( pNewObject );
132
132
133
                    if (pDrawLayer->IsRecording())
133
                    if (pDrawLayer->IsRecording())
134
                        pDrawLayer->AddCalcUndo( new SdrUndoInsertObj( *pNewObject ) );
134
			pDrawLayer->AddCalcUndo< SdrUndoInsertObj >( *pNewObject );
135
                }
135
                }
136
136
137
				pOldObject = aIter.Next();
137
				pOldObject = aIter.Next();
Lines 197-202 Link Here
197
		if (bImportingXML)
197
		if (bImportingXML)
198
			pDrawLayer->EnableAdjust(sal_False);
198
			pDrawLayer->EnableAdjust(sal_False);
199
199
200
		if( IsImportingMSXML( ) )
201
			pDrawLayer->SetUndoAllowed( false );
202
200
		pDrawLayer->SetForbiddenCharsTable( xForbiddenCharacters );
203
		pDrawLayer->SetForbiddenCharsTable( xForbiddenCharacters );
201
		pDrawLayer->SetCharCompressType( GetAsianCompression() );
204
		pDrawLayer->SetCharCompressType( GetAsianCompression() );
202
		pDrawLayer->SetKernAsianPunctuation( GetAsianKerning() );
205
		pDrawLayer->SetKernAsianPunctuation( GetAsianKerning() );
Lines 768-773 Link Here
768
    SetLoadingMedium(bVal);
771
    SetLoadingMedium(bVal);
769
}
772
}
770
773
774
void ScDocument::SetImportingMSXML( bool bVal )
775
{
776
    mbImportingMSXML = bVal;
777
778
    if (pDrawLayer)
779
        pDrawLayer->SetUndoAllowed( !mbImportingMSXML );
780
}
781
771
void ScDocument::SetXMLFromWrapper( sal_Bool bVal )
782
void ScDocument::SetXMLFromWrapper( sal_Bool bVal )
772
{
783
{
773
    bXMLFromWrapper = bVal;
784
    bXMLFromWrapper = bVal;
(-)sc/source/core/data/drwlayer.cxx (-21 / +22 lines)
Lines 213-219 Link Here
213
	pUndoGroup( NULL ),
213
	pUndoGroup( NULL ),
214
	bRecording( sal_False ),
214
	bRecording( sal_False ),
215
	bAdjustEnabled( sal_True ),
215
	bAdjustEnabled( sal_True ),
216
	bHyphenatorSet( sal_False )
216
	bHyphenatorSet( sal_False ),
217
        mbUndoAllowed( sal_True )
217
{
218
{
218
	pGlobalDrawPersist = NULL;			// nur einmal benutzen
219
	pGlobalDrawPersist = NULL;			// nur einmal benutzen
219
220
Lines 379-385 Link Here
379
	ScDrawPage* pPage = (ScDrawPage*)AllocPage( sal_False );
380
	ScDrawPage* pPage = (ScDrawPage*)AllocPage( sal_False );
380
	InsertPage(pPage, static_cast<sal_uInt16>(nTab));
381
	InsertPage(pPage, static_cast<sal_uInt16>(nTab));
381
	if (bRecording)
382
	if (bRecording)
382
		AddCalcUndo(new SdrUndoNewPage(*pPage));
383
	        AddCalcUndo< SdrUndoNewPage >(*pPage);
383
384
384
    return sal_True;        // inserted
385
    return sal_True;        // inserted
385
}
386
}
Lines 393-399 Link Here
393
	if (bRecording)
394
	if (bRecording)
394
	{
395
	{
395
		SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
396
		SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
396
		AddCalcUndo(new SdrUndoDelPage(*pPage));		// Undo-Action wird Owner der Page
397
        AddCalcUndo< SdrUndoDelPage >(*pPage);		// Undo-Action wird Owner der Page
397
		RemovePage( static_cast<sal_uInt16>(nTab) );							// nur austragen, nicht loeschen
398
		RemovePage( static_cast<sal_uInt16>(nTab) );							// nur austragen, nicht loeschen
398
	}
399
	}
399
	else
400
	else
Lines 442-448 Link Here
442
                pNewObject->NbcMove(Size(0,0));
443
                pNewObject->NbcMove(Size(0,0));
443
                pNewPage->InsertObject( pNewObject );
444
                pNewPage->InsertObject( pNewObject );
444
                if (bRecording)
445
                if (bRecording)
445
                    AddCalcUndo( new SdrUndoInsertObj( *pNewObject ) );
446
	                AddCalcUndo< SdrUndoInsertObj >( *pNewObject );
446
            }
447
            }
447
448
448
			pOldObject = aIter.Next();
449
			pOldObject = aIter.Next();
Lines 495-501 Link Here
495
			{
496
			{
496
				if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() )
497
				if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() )
497
                    pData->maStart.PutInOrder( pData->maEnd );
498
                    pData->maStart.PutInOrder( pData->maEnd );
498
				AddCalcUndo( new ScUndoObjData( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd ) );
499
                AddCalcUndo< ScUndoObjData >( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd );				
499
                RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos );
500
                RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos );
500
			}
501
			}
501
		}
502
		}
Lines 588-594 Link Here
588
		if ( pObj->GetLogicRect() != aRect )
589
		if ( pObj->GetLogicRect() != aRect )
589
		{
590
		{
590
			if (bRecording)
591
			if (bRecording)
591
				AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
592
		                AddCalcUndo<SdrUndoGeoObj>( *pObj );
592
			pObj->SetLogicRect(aRect);
593
			pObj->SetLogicRect(aRect);
593
		}
594
		}
594
	}
595
	}
Lines 613-619 Link Here
613
			if ( pObj->GetPoint( 0 ) != aStartPos )
614
			if ( pObj->GetPoint( 0 ) != aStartPos )
614
			{
615
			{
615
				if (bRecording)
616
				if (bRecording)
616
					AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
617
		                    AddCalcUndo< SdrUndoGeoObj> ( *pObj );
617
				pObj->SetPoint( aStartPos, 0 );
618
				pObj->SetPoint( aStartPos, 0 );
618
			}
619
			}
619
620
Lines 627-633 Link Here
627
				if ( pObj->GetPoint( 1 ) != aEndPos )
628
				if ( pObj->GetPoint( 1 ) != aEndPos )
628
				{
629
				{
629
					if (bRecording)
630
					if (bRecording)
630
						AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
631
		                        AddCalcUndo< SdrUndoGeoObj >( *pObj );
631
					pObj->SetPoint( aEndPos, 1 );
632
					pObj->SetPoint( aEndPos, 1 );
632
				}
633
				}
633
			}
634
			}
Lines 647-653 Link Here
647
			if ( pObj->GetPoint( 1 ) != aEndPos )
648
			if ( pObj->GetPoint( 1 ) != aEndPos )
648
			{
649
			{
649
				if (bRecording)
650
				if (bRecording)
650
					AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
651
		                    AddCalcUndo< SdrUndoGeoObj> ( *pObj  );
651
				pObj->SetPoint( aEndPos, 1 );
652
				pObj->SetPoint( aEndPos, 1 );
652
			}
653
			}
653
654
Lines 663-669 Link Here
663
				if ( pObj->GetPoint( 0 ) != aStartPos )
664
				if ( pObj->GetPoint( 0 ) != aStartPos )
664
				{
665
				{
665
					if (bRecording)
666
					if (bRecording)
666
						AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
667
			                        AddCalcUndo< SdrUndoGeoObj >( *pObj );
667
					pObj->SetPoint( aStartPos, 0 );
668
					pObj->SetPoint( aStartPos, 0 );
668
				}
669
				}
669
			}
670
			}
Lines 688-694 Link Here
688
			if ( pObj->GetLogicRect() != aNew )
689
			if ( pObj->GetLogicRect() != aNew )
689
			{
690
			{
690
				if (bRecording)
691
				if (bRecording)
691
					AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
692
		                    AddCalcUndo< SdrUndoGeoObj >( *pObj );
692
				pObj->SetLogicRect(aNew);
693
				pObj->SetLogicRect(aNew);
693
			}
694
			}
694
		}
695
		}
Lines 699-705 Link Here
699
			if ( pObj->GetRelativePos() != aPos )
700
			if ( pObj->GetRelativePos() != aPos )
700
			{
701
			{
701
				if (bRecording)
702
				if (bRecording)
702
					AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
703
		                    AddCalcUndo< SdrUndoGeoObj >( *pObj );
703
				pObj->SetRelativePos( aPos );
704
				pObj->SetRelativePos( aPos );
704
			}
705
			}
705
		}
706
		}
Lines 948-954 Link Here
948
					}
949
					}
949
					if( bMoved )
950
					if( bMoved )
950
					{
951
					{
951
						AddCalcUndo( new SdrUndoGeoObj( *pObject ) );
952
			                        AddCalcUndo< SdrUndoGeoObj >( *pObject );						
952
						lcl_TwipsToMM( aPoint );
953
						lcl_TwipsToMM( aPoint );
953
						pObject->SetPoint( aPoint, i );
954
						pObject->SetPoint( aPoint, i );
954
					}
955
					}
Lines 1002-1008 Link Here
1002
					lcl_TwipsToMM( aNewPos );
1003
					lcl_TwipsToMM( aNewPos );
1003
					aMoveSize = Size( aNewPos.X() - aOldMMPos.X(), aNewPos.Y() - aOldMMPos.Y() );	// millimeters
1004
					aMoveSize = Size( aNewPos.X() - aOldMMPos.X(), aNewPos.Y() - aOldMMPos.Y() );	// millimeters
1004
1005
1005
					AddCalcUndo( new SdrUndoMoveObj( *pObject, aMoveSize ) );
1006
			                    AddCalcUndo< SdrUndoMoveObj >( *pObject, aMoveSize );
1006
					pObject->Move( aMoveSize );
1007
					pObject->Move( aMoveSize );
1007
				}
1008
				}
1008
				else if ( rArea.IsInside( bNegativePage ? aObjRect.BottomLeft() : aObjRect.BottomRight() ) &&
1009
				else if ( rArea.IsInside( bNegativePage ? aObjRect.BottomLeft() : aObjRect.BottomRight() ) &&
Lines 1010-1016 Link Here
1010
				{
1011
				{
1011
					//	geschuetzte Groessen werden nicht veraendert
1012
					//	geschuetzte Groessen werden nicht veraendert
1012
					//	(Positionen schon, weil sie ja an der Zelle "verankert" sind)
1013
					//	(Positionen schon, weil sie ja an der Zelle "verankert" sind)
1013
					AddCalcUndo( new SdrUndoGeoObj( *pObject ) );
1014
		                    AddCalcUndo< SdrUndoGeoObj >( *pObject );
1014
					long nOldSizeX = aObjRect.Right() - aObjRect.Left() + 1;
1015
					long nOldSizeX = aObjRect.Right() - aObjRect.Left() + 1;
1015
					long nOldSizeY = aObjRect.Bottom() - aObjRect.Top() + 1;
1016
					long nOldSizeY = aObjRect.Bottom() - aObjRect.Top() + 1;
1016
					long nLogMoveX = rMove.X() * ( bNegativePage ? -1 : 1 );	// logical direction
1017
					long nLogMoveX = rMove.X() * ( bNegativePage ? -1 : 1 );	// logical direction
Lines 1235-1241 Link Here
1235
		long i;
1236
		long i;
1236
		if (bRecording)
1237
		if (bRecording)
1237
			for (i=1; i<=nDelCount; i++)
1238
			for (i=1; i<=nDelCount; i++)
1238
				AddCalcUndo( new SdrUndoRemoveObj( *ppObj[nDelCount-i] ) );
1239
		                AddCalcUndo< SdrUndoRemoveObj >( *ppObj[nDelCount-i] );
1239
1240
1240
		for (i=1; i<=nDelCount; i++)
1241
		for (i=1; i<=nDelCount; i++)
1241
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
1242
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
Lines 1286-1292 Link Here
1286
		long i;
1287
		long i;
1287
		if (bRecording)
1288
		if (bRecording)
1288
			for (i=1; i<=nDelCount; i++)
1289
			for (i=1; i<=nDelCount; i++)
1289
				AddCalcUndo( new SdrUndoRemoveObj( *ppObj[nDelCount-i] ) );
1290
		                AddCalcUndo< SdrUndoRemoveObj >( *ppObj[nDelCount-i] );
1290
1291
1291
		for (i=1; i<=nDelCount; i++)
1292
		for (i=1; i<=nDelCount; i++)
1292
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
1293
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
Lines 1351-1357 Link Here
1351
					long i;
1352
					long i;
1352
					if (bRecording)
1353
					if (bRecording)
1353
						for (i=1; i<=nDelCount; i++)
1354
						for (i=1; i<=nDelCount; i++)
1354
							AddCalcUndo( new SdrUndoRemoveObj( *ppObj[nDelCount-i] ) );
1355
			                            AddCalcUndo< SdrUndoRemoveObj >( *ppObj[nDelCount-i] );
1355
1356
1356
					for (i=1; i<=nDelCount; i++)
1357
					for (i=1; i<=nDelCount; i++)
1357
						pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
1358
						pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
Lines 1582-1588 Link Here
1582
1583
1583
			pDestPage->InsertObject( pNewObject );
1584
			pDestPage->InsertObject( pNewObject );
1584
			if (bRecording)
1585
			if (bRecording)
1585
				AddCalcUndo( new SdrUndoInsertObj( *pNewObject ) );
1586
		                AddCalcUndo< SdrUndoInsertObj >( *pNewObject );
1586
1587
1587
			//#i110034#	handle chart data references (after InsertObject)
1588
			//#i110034#	handle chart data references (after InsertObject)
1588
1589
Lines 1692-1698 Link Here
1692
		Point aRef1( 0, 0 );
1693
		Point aRef1( 0, 0 );
1693
		Point aRef2( 0, 1 );
1694
		Point aRef2( 0, 1 );
1694
		if (bRecording)
1695
		if (bRecording)
1695
			AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
1696
		            AddCalcUndo< SdrUndoGeoObj >( *pObj );
1696
		pObj->Mirror( aRef1, aRef2 );
1697
		pObj->Mirror( aRef1, aRef2 );
1697
	}
1698
	}
1698
	else
1699
	else
Lines 1703-1709 Link Here
1703
		Rectangle aObjRect = pObj->GetLogicRect();
1704
		Rectangle aObjRect = pObj->GetLogicRect();
1704
		Size aMoveSize( -(aObjRect.Left() + aObjRect.Right()), 0 );
1705
		Size aMoveSize( -(aObjRect.Left() + aObjRect.Right()), 0 );
1705
		if (bRecording)
1706
		if (bRecording)
1706
			AddCalcUndo( new SdrUndoMoveObj( *pObj, aMoveSize ) );
1707
		            AddCalcUndo< SdrUndoMoveObj >( *pObj, aMoveSize );
1707
		pObj->Move( aMoveSize );
1708
		pObj->Move( aMoveSize );
1708
	}
1709
	}
1709
}
1710
}
(-)sc/source/core/data/postit.cxx (-6 / +10 lines)
Lines 347-354 Link Here
347
    if( rOldTailPos != aTailPos )
347
    if( rOldTailPos != aTailPos )
348
    {
348
    {
349
        // create drawing undo action
349
        // create drawing undo action
350
        if( pDrawLayer && pDrawLayer->IsRecording() )
350
        if( pDrawLayer )
351
            pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoGeoObject( *mpCaption ) );
351
            if( pDrawLayer->IsUndoAllowed() )
352
                if( pDrawLayer->IsRecording() )
353
                    pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoGeoObject( *mpCaption ) );
354
352
        // calculate new caption rectangle (#i98141# handle LTR<->RTL switch correctly)
355
        // calculate new caption rectangle (#i98141# handle LTR<->RTL switch correctly)
353
        Rectangle aCaptRect = mpCaption->GetLogicRect();
356
        Rectangle aCaptRect = mpCaption->GetLogicRect();
354
        long nDiffX = (rOldTailPos.X() >= 0) ? (aCaptRect.Left() - rOldTailPos.X()) : (rOldTailPos.X() - aCaptRect.Right());
357
        long nDiffX = (rOldTailPos.X() >= 0) ? (aCaptRect.Left() - rOldTailPos.X()) : (rOldTailPos.X() - aCaptRect.Right());
Lines 368-374 Link Here
368
    {
371
    {
369
        // create drawing undo action
372
        // create drawing undo action
370
        if( pDrawLayer && pDrawLayer->IsRecording() )
373
        if( pDrawLayer && pDrawLayer->IsRecording() )
371
            pDrawLayer->AddCalcUndo( new ScUndoObjData( mpCaption, pCaptData->maStart, pCaptData->maEnd, maPos, pCaptData->maEnd ) );
374
            pDrawLayer->AddCalcUndo< ScUndoObjData >(mpCaption, pCaptData->maStart, pCaptData->maEnd, maPos, pCaptData->maEnd );
372
        // set new position
375
        // set new position
373
        pCaptData->maStart = maPos;
376
        pCaptData->maStart = maPos;
374
    }
377
    }
Lines 737-744 Link Here
737
740
738
        // create undo action
741
        // create undo action
739
        if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
742
        if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
740
            if( pDrawLayer->IsRecording() )
743
                if( pDrawLayer->IsUndoAllowed() )
741
                pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoNewObject( *maNoteData.mpCaption ) );
744
                    if( pDrawLayer->IsRecording() )
745
                        pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoNewObject( *maNoteData.mpCaption ) );
742
    }
746
    }
743
}
747
}
744
748
Lines 758-764 Link Here
758
        {
762
        {
759
            pDrawPage->RecalcObjOrdNums();
763
            pDrawPage->RecalcObjOrdNums();
760
            // create drawing undo action (before removing the object to have valid draw page in undo action)
764
            // create drawing undo action (before removing the object to have valid draw page in undo action)
761
            bool bRecording = ( pDrawLayer && pDrawLayer->IsRecording() );
765
            bool bRecording = ( pDrawLayer && pDrawLayer->IsUndoAllowed() && pDrawLayer->IsRecording() );
762
            if( bRecording )
766
            if( bRecording )
763
                pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoDeleteObject( *maNoteData.mpCaption ) );
767
                pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoDeleteObject( *maNoteData.mpCaption ) );
764
            // remove the object from the drawing page, delete if undo is disabled
768
            // remove the object from the drawing page, delete if undo is disabled
(-)sc/source/core/tool/detfunc.cxx (-8 / +8 lines)
Lines 494-500 Link Here
494
		ScDrawLayer::SetAnchor( pBox, SCA_CELL );
494
		ScDrawLayer::SetAnchor( pBox, SCA_CELL );
495
		pBox->SetLayer( SC_LAYER_INTERN );
495
		pBox->SetLayer( SC_LAYER_INTERN );
496
		pPage->InsertObject( pBox );
496
		pPage->InsertObject( pBox );
497
		pModel->AddCalcUndo( new SdrUndoInsertObj( *pBox ) );
497
	        pModel->AddCalcUndo< SdrUndoInsertObj >( *pBox );
498
498
499
		ScDrawObjData* pData = ScDrawLayer::GetObjData( pBox, sal_True );
499
		ScDrawObjData* pData = ScDrawLayer::GetObjData( pBox, sal_True );
500
		pData->maStart.Set( nRefStartCol, nRefStartRow, nTab);
500
		pData->maStart.Set( nRefStartCol, nRefStartRow, nTab);
Lines 536-542 Link Here
536
	ScDrawLayer::SetAnchor( pArrow, SCA_CELL );
536
	ScDrawLayer::SetAnchor( pArrow, SCA_CELL );
537
	pArrow->SetLayer( SC_LAYER_INTERN );
537
	pArrow->SetLayer( SC_LAYER_INTERN );
538
	pPage->InsertObject( pArrow );
538
	pPage->InsertObject( pArrow );
539
	pModel->AddCalcUndo( new SdrUndoInsertObj( *pArrow ) );
539
	    pModel->AddCalcUndo< SdrUndoInsertObj >( *pArrow );
540
540
541
	ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, sal_True );
541
	ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, sal_True );
542
	if (bFromOtherTab)
542
	if (bFromOtherTab)
Lines 568-574 Link Here
568
		ScDrawLayer::SetAnchor( pBox, SCA_CELL );
568
		ScDrawLayer::SetAnchor( pBox, SCA_CELL );
569
		pBox->SetLayer( SC_LAYER_INTERN );
569
		pBox->SetLayer( SC_LAYER_INTERN );
570
		pPage->InsertObject( pBox );
570
		pPage->InsertObject( pBox );
571
		pModel->AddCalcUndo( new SdrUndoInsertObj( *pBox ) );
571
	        pModel->AddCalcUndo< SdrUndoInsertObj >( *pBox );
572
572
573
		ScDrawObjData* pData = ScDrawLayer::GetObjData( pBox, sal_True );
573
		ScDrawObjData* pData = ScDrawLayer::GetObjData( pBox, sal_True );
574
		pData->maStart.Set( nStartCol, nStartRow, nTab);
574
		pData->maStart.Set( nStartCol, nStartRow, nTab);
Lines 603-609 Link Here
603
	ScDrawLayer::SetAnchor( pArrow, SCA_CELL );
603
	ScDrawLayer::SetAnchor( pArrow, SCA_CELL );
604
	pArrow->SetLayer( SC_LAYER_INTERN );
604
	pArrow->SetLayer( SC_LAYER_INTERN );
605
	pPage->InsertObject( pArrow );
605
	pPage->InsertObject( pArrow );
606
	pModel->AddCalcUndo( new SdrUndoInsertObj( *pArrow ) );
606
	    pModel->AddCalcUndo< SdrUndoInsertObj >( *pArrow );
607
607
608
	ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, sal_True );
608
	ScDrawObjData* pData = ScDrawLayer::GetObjData( pArrow, sal_True );
609
	pData->maStart.Set( nStartCol, nStartRow, nTab);
609
	pData->maStart.Set( nStartCol, nStartRow, nTab);
Lines 672-678 Link Here
672
	ScDrawLayer::SetAnchor( pCircle, SCA_CELL );
672
	ScDrawLayer::SetAnchor( pCircle, SCA_CELL );
673
	pCircle->SetLayer( SC_LAYER_INTERN );
673
	pCircle->SetLayer( SC_LAYER_INTERN );
674
	pPage->InsertObject( pCircle );
674
	pPage->InsertObject( pCircle );
675
	pModel->AddCalcUndo( new SdrUndoInsertObj( *pCircle ) );
675
	    pModel->AddCalcUndo< SdrUndoInsertObj >( *pCircle );
676
676
677
	ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, sal_True );
677
	ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, sal_True );
678
	pData->maStart.Set( nCol, nRow, nTab);
678
	pData->maStart.Set( nCol, nRow, nTab);
Lines 713-719 Link Here
713
713
714
		long i;
714
		long i;
715
		for (i=1; i<=nDelCount; i++)
715
		for (i=1; i<=nDelCount; i++)
716
			pModel->AddCalcUndo( new SdrUndoRemoveObj( *ppObj[nDelCount-i] ) );
716
            pModel->AddCalcUndo< SdrUndoRemoveObj >( *ppObj[nDelCount-i] );
717
717
718
		for (i=1; i<=nDelCount; i++)
718
		for (i=1; i<=nDelCount; i++)
719
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
719
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
Lines 790-796 Link Here
790
790
791
		long i;
791
		long i;
792
		for (i=1; i<=nDelCount; i++)
792
		for (i=1; i<=nDelCount; i++)
793
			pModel->AddCalcUndo( new SdrUndoRemoveObj( *ppObj[nDelCount-i] ) );
793
	            pModel->AddCalcUndo< SdrUndoRemoveObj >( *ppObj[nDelCount-i] );
794
794
795
		for (i=1; i<=nDelCount; i++)
795
		for (i=1; i<=nDelCount; i++)
796
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
796
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
Lines 1334-1340 Link Here
1334
1334
1335
		long i;
1335
		long i;
1336
		for (i=1; i<=nDelCount; i++)
1336
		for (i=1; i<=nDelCount; i++)
1337
			pModel->AddCalcUndo( new SdrUndoRemoveObj( *ppObj[nDelCount-i] ) );
1337
	            pModel->AddCalcUndo< SdrUndoRemoveObj >( *ppObj[nDelCount-i] );
1338
1338
1339
		for (i=1; i<=nDelCount; i++)
1339
		for (i=1; i<=nDelCount; i++)
1340
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
1340
			pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
(-)sc/source/ui/docshell/docfunc.cxx (-1 / +1 lines)
Lines 111-117 Link Here
111
{
111
{
112
    // #i101118# if drawing layer collects the undo actions, add it there
112
    // #i101118# if drawing layer collects the undo actions, add it there
113
    ScDrawLayer* pDrawLayer = rDocShell.GetDocument()->GetDrawLayer();
113
    ScDrawLayer* pDrawLayer = rDocShell.GetDocument()->GetDrawLayer();
114
    if( pDrawLayer && pDrawLayer->IsRecording() )
114
    if( pDrawLayer && pDrawLayer->IsUndoAllowed() && pDrawLayer->IsRecording() )
115
        pDrawLayer->AddCalcUndo( pUndoAction );
115
        pDrawLayer->AddCalcUndo( pUndoAction );
116
    else
116
    else
117
        rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
117
        rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
(-)sc/source/ui/docshell/docsh.cxx (+141 lines)
Lines 66-71 Link Here
66
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
66
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
67
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
67
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
68
#include <com/sun/star/task/XJob.hpp>
68
#include <com/sun/star/task/XJob.hpp>
69
#include <com/sun/star/embed/EmbedStates.hpp>
69
#include <basic/sbstar.hxx>
70
#include <basic/sbstar.hxx>
70
#include <basic/basmgr.hxx>
71
#include <basic/basmgr.hxx>
71
72
Lines 171-177 Link Here
171
#define ScDocShell
172
#define ScDocShell
172
#include "scslots.hxx"
173
#include "scslots.hxx"
173
174
175
namespace
176
{
177
    template< bool bByName >
178
    inline sal_uInt8 GetMediumFlag( const String & rName )
179
    {
180
        sal_uInt8 bResult = E_MEDIUM_FLAG_NONE;
174
181
182
#define SFX2_FILTER_ENTRY( entry ) { #entry, (sizeof #entry)/sizeof((#entry)[0]) - 1 },
183
        static const struct
184
        {
185
            const char * mpFilterTypeName;
186
            unsigned mnFilterTypeLen;
187
        } szMSFilterTypes [] = 
188
        {
189
            SFX2_FILTER_ENTRY(calc_MS_Excel_40)
190
            SFX2_FILTER_ENTRY(calc_MS_Excel_40_VorlageTemplate)
191
            SFX2_FILTER_ENTRY(calc_MS_Excel_5095)
192
            SFX2_FILTER_ENTRY(calc_MS_Excel_5095_VorlageTemplate)
193
            SFX2_FILTER_ENTRY(calc_MS_Excel_95)
194
            SFX2_FILTER_ENTRY(calc_MS_Excel_95_VorlageTemplate)
195
            SFX2_FILTER_ENTRY(calc_MS_Excel_97)
196
            SFX2_FILTER_ENTRY(calc_MS_Excel_97_VorlageTemplate)
197
            SFX2_FILTER_ENTRY(calc_MS_Excel_2003_XML)
198
            SFX2_FILTER_ENTRY(MS Excel 2007 XML)
199
            SFX2_FILTER_ENTRY(MS Excel 2007 XML Template)
200
            SFX2_FILTER_ENTRY(MS Excel 2007 Binary)
201
        };
202
203
        static const struct
204
        {
205
            const char * mpFilterName;
206
            unsigned mnFilterNameLen;
207
        } szMSFilterNames [] = 
208
        {
209
            { pFilterExcel4, strlen( pFilterExcel4 ) },
210
            { pFilterEx4Temp, strlen( pFilterEx4Temp ) },
211
            { pFilterExcel95, strlen( pFilterExcel95 ) },
212
            { pFilterEx95Temp, strlen( pFilterEx95Temp ) },
213
            { pFilterExcel5, strlen( pFilterExcel5 ) },
214
            { pFilterEx5Temp, strlen( pFilterEx5Temp ) },
215
            { pFilterExcel97, strlen( pFilterExcel97 ) },
216
            { pFilterEx97Temp, strlen( pFilterEx97Temp ) },
217
            SFX2_FILTER_ENTRY(Microsoft Excel 2003 XML)
218
            { pFilterEx07Xml, strlen( pFilterEx07Xml ) },
219
            SFX2_FILTER_ENTRY(Microsoft Excel 2007 XML Template)
220
            SFX2_FILTER_ENTRY(Microsoft Excel 2007 Binary)
221
        };
222
223
        enum{
224
            e_calc_MS_Excel_40,
225
            e_calc_MS_Excel_40_VorlageTemplate,
226
            e_calc_MS_Excel_5095,
227
            e_calc_MS_Excel_5095_VorlageTemplate,
228
            e_calc_MS_Excel_95,
229
            Se_calc_MS_Excel_95_VorlageTemplate,
230
            e_calc_MS_Excel_97,
231
            e_calc_MS_Excel_97_VorlageTemplate,
232
            e_calc_MS_Excel_2003_XML,
233
            e_MS_Excel_2007_XML,
234
            e_MS_Excel_2007_XML_Template,
235
            e_MS_Excel_2007_Binary
236
        };
237
238
#undef SFX2_FILTER_ENTRY
239
240
        if( bByName )
241
        {
242
            for( unsigned i = 0; i < (sizeof szMSFilterNames)/sizeof(szMSFilterNames[0] ); i++ )
243
                if( rName.Len() == szMSFilterNames[i].mnFilterNameLen 
244
                    && std::equal( szMSFilterNames[i].mpFilterName, szMSFilterNames[i].mpFilterName + szMSFilterNames[i].mnFilterNameLen, rName.GetBuffer() ) )
245
                    bResult |= ( E_MEDIUM_FLAG_EXCEL | ( ( i == e_MS_Excel_2007_XML ) * E_MEDIUM_FLAG_MSXML ) );
246
        }
247
        else
248
        {
249
            for( unsigned i = 0; i < (sizeof szMSFilterTypes)/sizeof(szMSFilterTypes[0] ); i++ )
250
                if( rName.Len() == szMSFilterTypes[i].mnFilterTypeLen 
251
                    && std::equal( szMSFilterTypes[i].mpFilterTypeName, szMSFilterTypes[i].mpFilterTypeName + szMSFilterTypes[i].mnFilterTypeLen, rName.GetBuffer() ) )
252
                    bResult |= ( E_MEDIUM_FLAG_EXCEL | ( ( i == e_MS_Excel_2007_XML ) * E_MEDIUM_FLAG_MSXML ) );
253
        }
254
255
        return bResult;
256
    }
257
258
    inline sal_uInt8 GetMediumFlag( const SfxMedium * pMedium )
259
    {
260
        if( const SfxFilter * pFilter = pMedium ? pMedium->GetFilter() : NULL )
261
            return GetMediumFlag<false>( pFilter->GetTypeName() );
262
263
        return E_MEDIUM_FLAG_NONE;
264
    }
265
}
266
175
SFX_IMPL_INTERFACE(ScDocShell,SfxObjectShell, ScResId(SCSTR_DOCSHELL))
267
SFX_IMPL_INTERFACE(ScDocShell,SfxObjectShell, ScResId(SCSTR_DOCSHELL))
176
{
268
{
177
	SFX_CHILDWINDOW_REGISTRATION( SID_HYPERLINK_INSERT );
269
	SFX_CHILDWINDOW_REGISTRATION( SID_HYPERLINK_INSERT );
Lines 2907-2910 Link Here
2907
    return bRes;
2999
    return bRes;
2908
}    
3000
}    
2909
3001
3002
void ScDocShell::BeforeLoading( SfxMedium& rMedium, const ::rtl::OUString & rstrTypeName, const ::rtl::OUString & rstrFilterName )
3003
{
3004
    const sal_uInt8 nMediumFlag = GetMediumFlag<false>( rstrTypeName );
3005
3006
    if( nMediumFlag & E_MEDIUM_FLAG_MSXML )
3007
    {
3008
        aDocument.SetImportingMSXML( true );
3009
3010
        if ( GetCreateMode() != SFX_CREATE_MODE_ORGANIZER )
3011
            ScColumn::bDoubleAlloc = sal_True;
3012
    }
3013
}
3014
3015
void ScDocShell::AfterLoading( SfxMedium& rMedium, const ::rtl::OUString & rstrTypeName, const ::rtl::OUString & rstrFilterName )
3016
{
3017
    const sal_uInt8 nMediumFlag = GetMediumFlag<false>( rstrTypeName );
3018
3019
	if( nMediumFlag & E_MEDIUM_FLAG_MSXML )
3020
	{
3021
        aDocument.SetImportingMSXML( false );
3022
3023
        if ( GetCreateMode() != SFX_CREATE_MODE_ORGANIZER )
3024
            ScColumn::bDoubleAlloc = sal_False;
3025
    
3026
		// After loading, the XEmbeddedObject was probably set modified flag, so reset the flag to false.
3027
		uno::Sequence < ::rtl::OUString > aNames = GetEmbeddedObjectContainer().GetObjectNames();
3028
		for ( sal_Int32 n = 0; n < aNames.getLength(); n++ )
3029
		{
3030
			::rtl::OUString	aName = aNames[n];
3031
			uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObjectContainer().GetEmbeddedObject( aName );
3032
			OSL_ENSURE( xObj.is(), "An empty entry in the embedded objects list!\n" );
3033
			if ( xObj.is() )
3034
			{
3035
				try
3036
				{
3037
					sal_Int32 nState = xObj->getCurrentState();
3038
					if ( nState != embed::EmbedStates::LOADED )
3039
					{
3040
						uno::Reference< util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY );
3041
						if ( xModifiable.is() )
3042
							xModifiable->setModified(sal_False);
3043
					}
3044
				}
3045
				catch( uno::Exception& )
3046
				{}
3047
			}
3048
		}
3049
	}
3050
}
2910
        
3051
        
(-)sc/source/ui/inc/docsh.hxx (+2 lines)
Lines 420-425 Link Here
420
    virtual void    SetChangeRecording( bool bActivate );
420
    virtual void    SetChangeRecording( bool bActivate );
421
    virtual bool    SetProtectionPassword( const String &rPassword );
421
    virtual bool    SetProtectionPassword( const String &rPassword );
422
    virtual bool    GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
422
    virtual bool    GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
423
    void BeforeLoading( SfxMedium&, const ::rtl::OUString &, const ::rtl::OUString & );
424
    void AfterLoading( SfxMedium&, const ::rtl::OUString &, const ::rtl::OUString & );
423
};
425
};
424
426
425
427
(-)sfx2/inc/sfx2/objsh.hxx (+2 lines)
Lines 204-209 Link Here
204
	sal_Bool					bHasName :1,		// sal_True := bestehendes Objekt, sal_False := es ist ein neues Objekt
204
	sal_Bool					bHasName :1,		// sal_True := bestehendes Objekt, sal_False := es ist ein neues Objekt
205
                                bIsTmp :1;          // temp. Storage
205
                                bIsTmp :1;          // temp. Storage
206
        sal_Bool 		bIsInGenerateThumbnail;	//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
206
        sal_Bool 		bIsInGenerateThumbnail;	//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
207
    virtual void BeforeLoading( SfxMedium&, const ::rtl::OUString &, const ::rtl::OUString & ){};
208
    virtual void AfterLoading( SfxMedium&, const ::rtl::OUString &, const ::rtl::OUString & ){};
207
209
208
private:
210
private:
209
//#if 0 // _SOLAR__PRIVATE
211
//#if 0 // _SOLAR__PRIVATE
(-)sfx2/source/doc/objstor.cxx (+3 lines)
Lines 2364-2369 Link Here
2364
    ::rtl::OUString aTypeName( rMedium.GetFilter()->GetTypeName() );
2364
    ::rtl::OUString aTypeName( rMedium.GetFilter()->GetTypeName() );
2365
    ::rtl::OUString aFilterName( rMedium.GetFilter()->GetFilterName() );
2365
    ::rtl::OUString aFilterName( rMedium.GetFilter()->GetFilterName() );
2366
2366
2367
        BeforeLoading( rMedium, aTypeName, aFilterName );
2367
    uno::Reference< lang::XMultiServiceFactory >  xMan = ::comphelper::getProcessServiceFactory();
2368
    uno::Reference< lang::XMultiServiceFactory >  xMan = ::comphelper::getProcessServiceFactory();
2368
    uno::Reference < lang::XMultiServiceFactory > xFilterFact (
2369
    uno::Reference < lang::XMultiServiceFactory > xFilterFact (
2369
                xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY );
2370
                xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY );
Lines 2463-2468 Link Here
2463
                }
2464
                }
2464
            }
2465
            }
2465
        }
2466
        }
2467
        AfterLoading( rMedium, aTypeName, aFilterName );
2468
2466
        return bRtn;
2469
        return bRtn;
2467
//<- #i119492
2470
//<- #i119492
2468
        }catch(const uno::Exception&)
2471
        }catch(const uno::Exception&)

Return to issue 121136