diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-03-04 14:16:02 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-03-04 14:16:02 +0000 |
commit | 85c70f37b56299f6fa02312c0fb73cc55af084ef (patch) | |
tree | f8579d17d7c74faafa06d9ce58f1a0679c3bc0ae /svx/source | |
parent | d76a00738e0cb3c7d7f742f3f834b42fdb165e01 (diff) |
CWS-TOOLING: integrate CWS aw063
2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects
2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects
2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL
2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction
2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction
2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1
2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round
2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round
2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round
2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round
2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round
2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round
2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round
2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition
2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF
2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable
2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable
2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix
2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix
2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers
2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts
2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules
2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include
2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include
2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much
2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from
2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size
2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances
2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage
2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences
2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange
2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle
2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case
2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
Diffstat (limited to 'svx/source')
36 files changed, 450 insertions, 312 deletions
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index cd111db1a654..072d6347f3f4 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -41,6 +41,7 @@ #include <svx/outliner.hxx> #include <svx/svdmodel.hxx> #include <svx/svdobj.hxx> +#include <svx/svdpool.hxx> //------------------------------------------------------------------------ // @@ -112,9 +113,10 @@ namespace accessibility String GetText( const ESelection& /*rSel*/ ) const { return String(); } SfxItemSet GetAttribs( const ESelection& /*rSel*/, BOOL /*bOnlyHardAttrib*/ = 0 ) const { - String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy")); - SfxItemPool aPool(aDummyStr,0,0,NULL); - return SfxItemSet(aPool); + // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using + // a deleted Pool by design. + return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); } SfxItemSet GetParaAttribs( USHORT /*nPara*/ ) const { return GetAttribs(ESelection()); } void SetParaAttribs( USHORT /*nPara*/, const SfxItemSet& /*rSet*/ ) {} diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index 9895f3c6e3b0..fbba42ba8d01 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -177,7 +177,7 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustom // Copy text content OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject(); if( pParaObj ) - pTextObj->NbcSetOutlinerParaObject( pParaObj->Clone() ); + pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) ); // copy all attributes SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() ); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 090d3eb1da53..162d25937c5f 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -141,7 +141,7 @@ IMapWindow::~IMapWindow() for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() ) delete pStr; - delete pIMapPool; + SfxItemPool::Free(pIMapPool); delete[] pItemInfo; } @@ -287,7 +287,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) Point aPoint; Rectangle aClipRect( aPoint, GetGraphicSize() ); SdrObject* pSdrObj = NULL; - IMapObject* pCloneIMapObj = NULL; + IMapObjectPtr pCloneIMapObj; switch( pIMapObj->GetType() ) { @@ -300,7 +300,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) aDrawRect.Intersection( aClipRect ); pSdrObj = (SdrObject*) new SdrRectObj( aDrawRect ); - pCloneIMapObj = (IMapObject*) new IMapRectangleObject( *pIMapRectObj ); + pCloneIMapObj.reset((IMapObject*) new IMapRectangleObject( *pIMapRectObj )); } break; @@ -316,7 +316,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) aCircle.Intersection( aClipRect ); pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 ); - pCloneIMapObj = (IMapObject*) new IMapCircleObject( *pIMapCircleObj ); + pCloneIMapObj.reset((IMapObject*) new IMapCircleObject( *pIMapCircleObj )); } break; @@ -348,7 +348,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) pSdrObj = (SdrObject*)new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon)); } - pCloneIMapObj = (IMapObject*) new IMapPolygonObject( *pIMapPolyObj ); + pCloneIMapObj.reset((IMapObject*) new IMapPolygonObject( *pIMapPolyObj )); } break; @@ -416,9 +416,9 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { SdrRectObj* pRectObj = (SdrRectObj*) &rObj; IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(), - String(), String(), String(), String(), String(), TRUE, FALSE ); + String(), String(), String(), String(), String(), TRUE, FALSE ); - pRectObj->InsertUserData( new IMapUserData( pObj ) ); + pRectObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } break; @@ -431,7 +431,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(), TRUE, FALSE ); pObj->SetExtraEllipse( aPoly.GetBoundRect() ); - pCircObj->InsertUserData( new IMapUserData( pObj ) ); + pCircObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } break; @@ -447,7 +447,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { Polygon aPoly(rXPolyPoly.getB2DPolygon(0L)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(), TRUE, FALSE ); - pPathObj->InsertUserData( new IMapUserData( pObj ) ); + pPathObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } } break; @@ -473,10 +473,10 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) String aAltText; String aDesc; String aTarget; - IMapObject* pIMapObj = pUserData->GetObject(); + IMapObjectPtr pIMapObj = pUserData->GetObject(); BOOL bActive = TRUE; - if ( pIMapObj ) + if ( pIMapObj.get() ) { aURL = pIMapObj->GetURL(); aAltText = pIMapObj->GetAltText(); @@ -489,8 +489,8 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { case( OBJ_RECT ): { - pUserData->ReplaceObject( new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(), - aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ) ); + pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(), + aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ) ) ); } break; @@ -505,7 +505,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) // wurde von uns nur temporaer angelegt delete pPathObj; - pUserData->ReplaceObject( pObj ); + pUserData->ReplaceObject( IMapObjectPtr(pObj) ); } break; @@ -521,7 +521,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0L)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ); - pUserData->ReplaceObject( pObj ); + pUserData->ReplaceObject( IMapObjectPtr(pObj) ); } } break; @@ -606,7 +606,7 @@ IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) const IMapUserData* pUserData = (IMapUserData*) pSdrObj->GetUserData( 0 ); if ( pUserData ) - pIMapObj = pUserData->GetObject(); + pIMapObj = pUserData->GetObject().get(); } return pIMapObj; diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index d1ac67245ce4..0b8ecd942215 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -83,31 +83,34 @@ const UINT32 IMapInventor = UINT32('I') * 0x00000001+ UINT32('P') * 0x01000000; +typedef boost::shared_ptr< IMapObject > IMapObjectPtr; + class IMapUserData : public SdrObjUserData { - IMapObject* pObj; + // #i98386# use boost::shared_ptr here due to cloning possibilities + IMapObjectPtr mpObj; public: IMapUserData() : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( NULL ) {} + mpObj ( ) {} - IMapUserData( IMapObject* pIMapObj ) : + IMapUserData( const IMapObjectPtr& rIMapObj ) : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( pIMapObj ) {} + mpObj ( rIMapObj ) {} IMapUserData( const IMapUserData& rIMapUserData ) : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( rIMapUserData.pObj ) {} + mpObj ( rIMapUserData.mpObj ) {} - ~IMapUserData() { delete pObj; } + ~IMapUserData() { } virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); } - void SetObject( IMapObject* pIMapObj ) { pObj = pIMapObj; } - IMapObject* GetObject() const { return pObj; } - void ReplaceObject( IMapObject* pNewIMapObject ) { delete pObj; pObj = pNewIMapObject; } + void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; } + const IMapObjectPtr GetObject() const { return mpObj; } + void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; } }; diff --git a/svx/source/editeng/editdoc.cxx b/svx/source/editeng/editdoc.cxx index d5f5cbff507f..c90de8eb5ce0 100644 --- a/svx/source/editeng/editdoc.cxx +++ b/svx/source/editeng/editdoc.cxx @@ -1245,7 +1245,7 @@ EditDoc::~EditDoc() { ImplDestroyContents(); if ( bOwnerOfPool ) - delete pItemPool; + SfxItemPool::Free(pItemPool); } void EditDoc::ImplDestroyContents() diff --git a/svx/source/editeng/editdoc.hxx b/svx/source/editeng/editdoc.hxx index 3b4d5cdb5515..dd9662d366e5 100644 --- a/svx/source/editeng/editdoc.hxx +++ b/svx/source/editeng/editdoc.hxx @@ -784,7 +784,9 @@ class EditEngineItemPool : public SfxItemPool { public: EditEngineItemPool( BOOL bPersistenRefCounts ); - ~EditEngineItemPool(); +protected: + virtual ~EditEngineItemPool(); +public: virtual SvStream& Store( SvStream& rStream ) const; }; diff --git a/svx/source/editeng/editobj.cxx b/svx/source/editeng/editobj.cxx index 759c39b79c00..d0170e507060 100644 --- a/svx/source/editeng/editobj.cxx +++ b/svx/source/editeng/editobj.cxx @@ -566,8 +566,42 @@ bool EditTextObject::operator==( const EditTextObject& rCompare ) const return static_cast< const BinTextObject* >( this )->operator==( static_cast< const BinTextObject& >( rCompare ) ); } +// from SfxItemPoolUser +void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) +{ + if(!bOwnerOfPool && pPool && pPool == &rSfxItemPool) + { + // The pool we are based on gets destructed; get owner of pool by creating own one. + // No need to call RemoveSfxItemPoolUser(), this is done from the pool's destructor + // Base new pool on EditEnginePool; it would also be possible to clone the used + // pool if needed, but only text attributes should be used. + SfxItemPool* pNewPool = EditEngine::CreatePool(); + + if(pPool) + { + pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC)); + } + + for(sal_uInt16 n(0); n < aContents.Count(); n++) + { + // clone ContentInfos for new pool + ContentInfo* pOrg = aContents.GetObject(n); + DBG_ASSERT(pOrg, "NULL-Pointer in ContentList!"); + + ContentInfo* pNew = new ContentInfo(*pOrg, *pNewPool); + aContents.Replace(pNew, n); + delete pOrg; + } + + // set local variables + pPool = pNewPool; + bOwnerOfPool = TRUE; + } +} + BinTextObject::BinTextObject( SfxItemPool* pP ) : - EditTextObject( EE_FORMAT_BIN ) + EditTextObject( EE_FORMAT_BIN ), + SfxItemPoolUser() { nVersion = 0; nMetric = 0xFFFF; @@ -584,13 +618,20 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : pPool = EditEngine::CreatePool(); bOwnerOfPool = TRUE; } + + if(!bOwnerOfPool && pPool) + { + pPool->AddSfxItemPoolUser(*this); + } + bVertical = FALSE; bStoreUnicodeStrings = FALSE; nScriptType = 0; } BinTextObject::BinTextObject( const BinTextObject& r ) : - EditTextObject( r ) + EditTextObject( r ), + SfxItemPoolUser() { nVersion = r.nVersion; nMetric = r.nMetric; @@ -613,6 +654,11 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : } + if(!bOwnerOfPool && pPool) + { + pPool->AddSfxItemPoolUser(*this); + } + if ( bOwnerOfPool && pPool && r.pPool ) pPool->SetDefaultMetric( r.pPool->GetMetric( DEF_METRIC ) ); @@ -627,6 +673,11 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : __EXPORT BinTextObject::~BinTextObject() { + if(!bOwnerOfPool && pPool) + { + pPool->RemoveSfxItemPoolUser(*this); + } + ClearPortionInfo(); DeleteContents(); if ( bOwnerOfPool ) @@ -634,7 +685,7 @@ __EXPORT BinTextObject::~BinTextObject() // Nicht mehr, wegen 1xDefItems. // siehe auch ~EditDoc(). // pPool->ReleaseDefaults( TRUE /* bDelete */ ); - delete pPool; + SfxItemPool::Free(pPool); } } diff --git a/svx/source/editeng/editobj2.hxx b/svx/source/editeng/editobj2.hxx index 943e394f7ee7..51a044575dd2 100644 --- a/svx/source/editeng/editobj2.hxx +++ b/svx/source/editeng/editobj2.hxx @@ -195,7 +195,7 @@ SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 ) // MT 05/00: Sollte mal direkt EditTextObjekt werden => keine virtuellen Methoden mehr. -class BinTextObject : public EditTextObject +class BinTextObject : public EditTextObject, public SfxItemPoolUser { using EditTextObject::operator==; @@ -303,6 +303,8 @@ public: bool operator==( const BinTextObject& rCompare ) const; + // from SfxItemPoolUser + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool); }; #endif // _EDITOBJ2_HXX diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 73665766a3a4..08643e025e19 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -670,15 +670,15 @@ namespace svx //------------------------------------------------------------------------ void FmTextControlShell::executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ) { - ::std::auto_ptr< SfxItemPool > pPool( EditEngine::CreatePool() ); - pPool->FreezeIdRanges(); - SfxItemSet aPureItems( *pPool ); - const SvxFontListItem* pFontList = PTR_CAST( SvxFontListItem, m_pViewFrame->GetObjectShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); DBG_ASSERT( pFontList, "FmTextControlShell::executeAttributeDialog: no font list item!" ); if ( !pFontList ) return; + SfxItemPool* pPool = EditEngine::CreatePool(); + pPool->FreezeIdRanges(); + SfxItemSet aPureItems( *pPool ); + // put the current states of the items into the set SfxAllItemSet aCurrentItems( aPureItems ); transferFeatureStatesToItemSet( m_aControlFeatures, aCurrentItems ); @@ -774,6 +774,8 @@ namespace svx } _rReq.Done( rModifiedItems ); } + + SfxItemPool::Free(pPool); } //------------------------------------------------------------------------ diff --git a/svx/source/outliner/makefile.mk b/svx/source/outliner/makefile.mk index 5a1e287d6eff..deef3530499c 100644 --- a/svx/source/outliner/makefile.mk +++ b/svx/source/outliner/makefile.mk @@ -34,6 +34,7 @@ PRJ=..$/.. PRJNAME=svx TARGET=outliner AUTOSEG=true +ENABLE_EXCEPTIONS=TRUE PROJECTPCH4DLL=TRUE PROJECTPCH=outl_pch diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index 2d72442a9e9f..6178f1f3e717 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -378,14 +378,19 @@ OutlinerParaObject* Outliner::CreateParaObject( USHORT nStartPara, USHORT nCount if( !nCount ) return NULL; - OutlinerParaObject* pPObj = new OutlinerParaObject( nCount ); - pPObj->pText = pEditEngine->CreateTextObject( nStartPara, nCount ); - pPObj->SetOutlinerMode( GetMode() ); - pPObj->bIsEditDoc = ( ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) ? TRUE : FALSE; + EditTextObject* pText = pEditEngine->CreateTextObject( nStartPara, nCount ); + const bool bIsEditDoc(OUTLINERMODE_TEXTOBJECT == ImplGetOutlinerMode()); + ParagraphDataVector aParagraphDataVector(nCount); + const sal_uInt16 nLastPara(nStartPara + nCount - 1); - USHORT nLastPara = nStartPara + nCount - 1; - for ( USHORT nPara = nStartPara; nPara <= nLastPara; nPara++ ) - pPObj->pParagraphDataArr[ nPara-nStartPara] = *GetParagraph( nPara ); + for(sal_uInt16 nPara(nStartPara); nPara <= nLastPara; nPara++) + { + aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara); + } + + OutlinerParaObject* pPObj = new OutlinerParaObject(*pText, aParagraphDataVector, bIsEditDoc); + pPObj->SetOutlinerMode(GetMode()); + delete pText; return pPObj; } @@ -573,8 +578,8 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) Init( rPObj.GetOutlinerMode() ); ImplBlockInsertionCallbacks( TRUE ); - pEditEngine->SetText( *(rPObj.pText) ); - if( rPObj.nCount != pEditEngine->GetParagraphCount() ) + pEditEngine->SetText(rPObj.GetTextObject()); + if( rPObj.Count() != pEditEngine->GetParagraphCount() ) { int nop=0;nop++; } @@ -582,9 +587,9 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) bFirstParaIsEmpty = FALSE; pParaList->Clear( TRUE ); - for( USHORT nCurPara = 0; nCurPara < rPObj.nCount; nCurPara++ ) + for( USHORT nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ ) { - Paragraph* pPara = new Paragraph( rPObj.pParagraphDataArr[ nCurPara ] ); + Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara)); ImplCheckDepth( pPara->nDepth ); pParaList->Insert( pPara, LIST_APPEND ); @@ -614,19 +619,19 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) if( bFirstParaIsEmpty ) { pParaList->Clear( TRUE ); - pEditEngine->SetText( *(rPObj.pText) ); + pEditEngine->SetText(rPObj.GetTextObject()); nPara = 0; } else { nPara = pParaList->GetParagraphCount(); - pEditEngine->InsertParagraph( EE_PARA_APPEND, *(rPObj.pText) ); + pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject() ); } bFirstParaIsEmpty = FALSE; - for( USHORT n = 0; n < rPObj.nCount; n++ ) + for( USHORT n = 0; n < rPObj.Count(); n++ ) { - pPara = new Paragraph( rPObj.pParagraphDataArr[ n ] ); + pPara = new Paragraph( rPObj.GetParagraphData(n) ); pParaList->Insert( pPara, LIST_APPEND ); USHORT nP = sal::static_int_cast< USHORT >(nPara+n); DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync"); diff --git a/svx/source/outliner/outlobj.cxx b/svx/source/outliner/outlobj.cxx index ace1dd2c8b73..5aba25caddaa 100644 --- a/svx/source/outliner/outlobj.cxx +++ b/svx/source/outliner/outlobj.cxx @@ -38,234 +38,218 @@ #include <svx/outlobj.hxx> #include <outleeng.hxx> #include <svx/editobj.hxx> +#include <vcl/bitmap.hxx> +#include <tools/stream.hxx> +////////////////////////////////////////////////////////////////////////////// -#include <vcl/bitmap.hxx> +class ImplOutlinerParaObject +{ +public: + // data members + EditTextObject* mpEditTextObject; + ParagraphDataVector maParagraphDataVector; + bool mbIsEditDoc; + // refcounter + sal_uInt32 mnRefCount; -#include <tools/stream.hxx> + // constuctor + ImplOutlinerParaObject(EditTextObject* pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc) + : mpEditTextObject(pEditTextObject), + maParagraphDataVector(rParagraphDataVector), + mbIsEditDoc(bIsEditDoc), + mnRefCount(0) + { + } -DBG_NAME(OutlinerParaObject) + // destructor + ~ImplOutlinerParaObject() + { + delete mpEditTextObject; + } -OutlinerParaObject::OutlinerParaObject( USHORT nParaCount ) -{ - DBG_CTOR(OutlinerParaObject,0); + bool operator==(const ImplOutlinerParaObject& rCandidate) const + { + return (*mpEditTextObject == *rCandidate.mpEditTextObject + && maParagraphDataVector == rCandidate.maParagraphDataVector + && mbIsEditDoc == rCandidate.mbIsEditDoc); + } +}; - bIsEditDoc = TRUE; - pParagraphDataArr = new ParagraphData[ nParaCount ]; - nCount = nParaCount; -} +////////////////////////////////////////////////////////////////////////////// -OutlinerParaObject::OutlinerParaObject( const OutlinerParaObject& rObj ) +void OutlinerParaObject::ImplMakeUnique() { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = rObj.bIsEditDoc; - nCount = rObj.nCount; - pParagraphDataArr = new ParagraphData[ nCount ]; - for( sal_uInt32 i = 0; i < nCount; i++ ) - pParagraphDataArr[i] = rObj.pParagraphDataArr[i]; - pText = rObj.pText->Clone(); + if(mpImplOutlinerParaObject->mnRefCount) + { + ImplOutlinerParaObject* pNew = new ImplOutlinerParaObject( + mpImplOutlinerParaObject->mpEditTextObject->Clone(), + mpImplOutlinerParaObject->maParagraphDataVector, + mpImplOutlinerParaObject->mbIsEditDoc); + mpImplOutlinerParaObject->mnRefCount--; + mpImplOutlinerParaObject = pNew; + } } -OutlinerParaObject::OutlinerParaObject( const EditTextObject& rEditObj ) +OutlinerParaObject::OutlinerParaObject(const EditTextObject& rEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc) +: mpImplOutlinerParaObject(new ImplOutlinerParaObject(rEditTextObject.Clone(), rParagraphDataVector, bIsEditDoc)) { - DBG_CTOR(OutlinerParaObject,0); +} - bIsEditDoc = TRUE; - pText = rEditObj.Clone(); - nCount = pText->GetParagraphCount(); - pParagraphDataArr = new ParagraphData[ nCount ]; +OutlinerParaObject::OutlinerParaObject(const OutlinerParaObject& rCandidate) +: mpImplOutlinerParaObject(rCandidate.mpImplOutlinerParaObject) +{ + mpImplOutlinerParaObject->mnRefCount++; } OutlinerParaObject::~OutlinerParaObject() { - DBG_DTOR(OutlinerParaObject,0); - - delete pText; - delete[] pParagraphDataArr; + if(mpImplOutlinerParaObject->mnRefCount) + { + mpImplOutlinerParaObject->mnRefCount--; + } + else + { + delete mpImplOutlinerParaObject; + } } -sal_Int16 OutlinerParaObject::GetDepth( USHORT nPara ) const +OutlinerParaObject& OutlinerParaObject::operator=(const OutlinerParaObject& rCandidate) { - if( pParagraphDataArr && (nPara < nCount ) ) - return pParagraphDataArr[nPara].nDepth; - else - return -1; + if(rCandidate.mpImplOutlinerParaObject != mpImplOutlinerParaObject) + { + if(mpImplOutlinerParaObject->mnRefCount) + { + mpImplOutlinerParaObject->mnRefCount--; + } + else + { + delete mpImplOutlinerParaObject; + } + + mpImplOutlinerParaObject = rCandidate.mpImplOutlinerParaObject; + mpImplOutlinerParaObject->mnRefCount++; + } + + return *this; } -void OutlinerParaObject::ClearPortionInfo() +bool OutlinerParaObject::operator==(const OutlinerParaObject& rCandidate) const { - DBG_CHKTHIS(OutlinerParaObject,0); - pText->ClearPortionInfo(); + if(rCandidate.mpImplOutlinerParaObject == mpImplOutlinerParaObject) + { + return true; + } + + return (*rCandidate.mpImplOutlinerParaObject == *mpImplOutlinerParaObject); } -OutlinerParaObject* OutlinerParaObject::Clone() const +sal_uInt16 OutlinerParaObject::GetOutlinerMode() const { - DBG_CHKTHIS(OutlinerParaObject,0); - OutlinerParaObject* pObj = new OutlinerParaObject(*this); - return pObj; + return mpImplOutlinerParaObject->mpEditTextObject->GetUserType(); } -void OutlinerParaObject::ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ) +void OutlinerParaObject::SetOutlinerMode(sal_uInt16 nNew) { - DBG_CHKTHIS(OutlinerParaObject,0); - pText->ChangeStyleSheetName( eFamily, rOldName, rNewName ); + if(mpImplOutlinerParaObject->mpEditTextObject->GetUserType() != nNew) + { + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->SetUserType(nNew); + } } -BOOL OutlinerParaObject::ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ) +bool OutlinerParaObject::IsVertical() const { - DBG_CHKTHIS(OutlinerParaObject,0); - return pText->ChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily ); + return mpImplOutlinerParaObject->mpEditTextObject->IsVertical(); } -void OutlinerParaObject::SetStyleSheets( USHORT nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily ) +void OutlinerParaObject::SetVertical(bool bNew) { - for ( USHORT n = sal::static_int_cast< USHORT >( Count() ); n; ) + if((bool)mpImplOutlinerParaObject->mpEditTextObject->IsVertical() != bNew) { - if ( GetDepth( --n ) == nLevel ) - pText->SetStyleSheet( n, rNewName, rNewFamily ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->SetVertical(bNew); } } -void OutlinerParaObject::Store(SvStream& rStream ) const +sal_uInt32 OutlinerParaObject::Count() const { - rStream << nCount; - rStream << static_cast<sal_uInt32>(0x42345678); - pText->Store( rStream ); - - for( USHORT nPos=0; nPos < nCount; nPos++ ) - rStream << pParagraphDataArr[ nPos ].nDepth; - - rStream << bIsEditDoc; + return mpImplOutlinerParaObject->maParagraphDataVector.size(); } -OutlinerParaObject* OutlinerParaObject::Create( SvStream& rStream, SfxItemPool* pTextObjectPool ) +sal_Int16 OutlinerParaObject::GetDepth(sal_uInt16 nPara) const { - OutlinerParaObject* pPObj = NULL; - USHORT nVersion = 0; - - sal_uInt32 nCount; - rStream >> nCount; - - sal_uInt32 nSyncRef; - rStream >> nSyncRef; - if( nSyncRef == 0x12345678 ) - nVersion = 1; - else if( nSyncRef == 0x22345678 ) - nVersion = 2; - else if( nSyncRef == 0x32345678 ) - nVersion = 3; - else if ( nSyncRef == 0x42345678 ) - nVersion = 4; - - if ( nVersion ) + if(nPara < mpImplOutlinerParaObject->maParagraphDataVector.size()) { - pPObj = new OutlinerParaObject( (USHORT)nCount ); - if( nVersion <= 3 ) - { - EditTextObject* pAllText = 0; - USHORT nCurPara = 0; - while ( nCount ) - { - EditTextObject* pText = EditTextObject::Create( rStream, NULL ); - DBG_ASSERT(pText,"CreateEditTextObject failed"); - sal_uInt32 nSync = 0; - rStream >> nSync; - DBG_ASSERT(nSync==nSyncRef,"Stream out of sync"); - USHORT nDepth; - rStream >> nDepth; - Paragraph* pPara = new Paragraph( nDepth ); - if( nVersion == 1 ) - { - // Bullet ueberlesen - USHORT nFlags; - rStream >> nFlags; - - if ( nFlags & 0x0001 ) // Bitmap - { - Bitmap aBmp; - rStream >> aBmp; - } - else - { - Color aColor; - rStream >> aColor; - rStream.SeekRel( 16 ); - String aName; - rStream.ReadByteString(aName); - rStream.SeekRel( 12 ); - } - long nDummy; - rStream >> nDummy; - rStream >> nDummy; - } - pPara->bVisible = TRUE; - if( !pAllText ) - pAllText = pText; - else - { - pAllText->Insert( *pText, 0xffff ); - delete pText; - } - pPObj->pParagraphDataArr[ nCurPara ] = *pPara; - delete pPara; - nCount--; - nCurPara++; - if( nCount ) - { - sal_uInt32 _nSync = 0; - rStream >> _nSync; - DBG_ASSERT(_nSync==nSyncRef,"Stream out of sync"); - } - } - if( nVersion == 3 ) - rStream >> pPObj->bIsEditDoc; - pPObj->pText = pAllText; - } - else // nVersion >= 4 - { - pPObj->pText = EditTextObject::Create( rStream, pTextObjectPool ); - for( USHORT nCur=0; nCur < nCount; nCur++ ) - rStream >> pPObj->pParagraphDataArr[ nCur ].nDepth; - rStream >> pPObj->bIsEditDoc; - } + return mpImplOutlinerParaObject->maParagraphDataVector[nPara].getDepth(); + } + else + { + return -1; } - return pPObj; } -USHORT OutlinerParaObject::GetOutlinerMode() const +const EditTextObject& OutlinerParaObject::GetTextObject() const { - return pText->GetUserType(); + return *mpImplOutlinerParaObject->mpEditTextObject; } -void OutlinerParaObject::SetOutlinerMode( USHORT n ) +bool OutlinerParaObject::IsEditDoc() const { - pText->SetUserType( n ); + return mpImplOutlinerParaObject->mbIsEditDoc; } -BOOL OutlinerParaObject::RemoveCharAttribs( USHORT nWhich ) +const ParagraphData& OutlinerParaObject::GetParagraphData(sal_uInt32 nIndex) const { - return pText->RemoveCharAttribs( nWhich ); + if(nIndex < mpImplOutlinerParaObject->maParagraphDataVector.size()) + { + return mpImplOutlinerParaObject->maParagraphDataVector[nIndex]; + } + else + { + OSL_ENSURE(false, "OutlinerParaObject::GetParagraphData: Access out of range (!)"); + static ParagraphData aEmptyParagraphData; + return aEmptyParagraphData; + } } -BOOL OutlinerParaObject::RemoveParaAttribs( USHORT nWhich ) +void OutlinerParaObject::ClearPortionInfo() { - return pText->RemoveParaAttribs( nWhich ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->ClearPortionInfo(); } -void OutlinerParaObject::MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart, USHORT nEnd ) +bool OutlinerParaObject::ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily) { - pText->MergeParaAttribs( rAttribs, nStart, nEnd ); + ImplMakeUnique(); + return mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily); } -void OutlinerParaObject::SetVertical( BOOL bVertical ) +void OutlinerParaObject::ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName) { - pText->SetVertical( bVertical ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheetName(eFamily, rOldName, rNewName); } -BOOL OutlinerParaObject::IsVertical() const +void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily) { - return pText->IsVertical(); + const sal_uInt32 nCount(mpImplOutlinerParaObject->maParagraphDataVector.size()); + + if(nCount) + { + ImplMakeUnique(); + sal_uInt16 nDecrementer(sal::static_int_cast< sal_uInt16 >(nCount)); + + for(;nDecrementer;) + { + if(GetDepth(--nDecrementer) == nLevel) + { + mpImplOutlinerParaObject->mpEditTextObject->SetStyleSheet(nDecrementer, rNewName, rNewFamily); + } + } + } } +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/outliner/paralist.cxx b/svx/source/outliner/paralist.cxx index 0efd519ac76a..3bc52fd8e460 100644 --- a/svx/source/outliner/paralist.cxx +++ b/svx/source/outliner/paralist.cxx @@ -59,6 +59,13 @@ ParagraphData& ParagraphData::operator=( const ParagraphData& r) return *this; } +bool ParagraphData::operator==(const ParagraphData& rCandidate) const +{ + return (nDepth == rCandidate.nDepth + && mnNumberingStartValue == rCandidate.mnNumberingStartValue + && mbParaIsNumberingRestart == rCandidate.mbParaIsNumberingRestart); +} + Paragraph::Paragraph( sal_Int16 nDDepth ) : aBulSize( -1, -1) { diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 00185c8a88ff..394f68041d7a 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -44,6 +44,7 @@ namespace drawinglayer { SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -53,9 +54,10 @@ namespace drawinglayer bool bFitToSize, bool bHideContour, bool bBlink, - bool bScroll) + bool bScroll, + bool bInEditMode) : mrSdrText(rSdrText), - mpOutlinerParaObject(rSdrText.GetOutlinerParaObject()), + maOutlinerParaObject(rOutlinerParaObject), meFormTextStyle(eFormTextStyle), maTextLeftDistance(aTextLeftDistance), maTextUpperDistance(aTextUpperDistance), @@ -65,15 +67,14 @@ namespace drawinglayer mbFitToSize(bFitToSize), mbHideContour(bHideContour), mbBlink(bBlink), - mbScroll(bScroll) + mbScroll(bScroll), + mbInEditMode(bInEditMode) { } bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const { - const bool bOutlinerParaObjectSameAddress(mpOutlinerParaObject == rCandidate.mpOutlinerParaObject); - - return (bOutlinerParaObjectSameAddress + return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject() && getFormTextStyle() == rCandidate.getFormTextStyle() && getTextLeftDistance() == rCandidate.getTextLeftDistance() && getTextUpperDistance() == rCandidate.getTextUpperDistance() @@ -83,7 +84,8 @@ namespace drawinglayer && isFitToSize() == rCandidate.isFitToSize() && isHideContour() == rCandidate.isHideContour() && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll()); + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode()); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index 5aee1950bd04..0f82674d10a5 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -185,12 +185,24 @@ namespace sdr // update current ViewInformation2D at the ObjectContact const double fCurrentTime(getPrimitiveAnimator().GetTime()); OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice(); - const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile(); - const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); basegfx::B2DRange aViewRange; // create ViewRange - if(!bOutputToRecordingMetaFile) + if(isOutputToRecordingMetaFile()) + { + if(isOutputToPDFFile()) + { + // #i98402# if it's a PDF export, set the ClipRegion as ViewRange. This is + // mainly because SW does not use DrawingLayer Page-Oriented and if not doing this, + // all existing objects will be collected as primitives and processed. + const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect()); + + aViewRange = basegfx::B2DRange( + aLogicClipRectangle.Left(), aLogicClipRectangle.Top(), + aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom()); + } + } + else { // use visible pixels, but transform to world coordinates const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel()); diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index b129aaea137a..c48d110faaf2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -38,6 +38,7 @@ #include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx> #include <svtools/itemset.hxx> +#include <svx/sdr/primitive2d/sdrprimitivetools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -111,6 +112,18 @@ namespace sdr delete pAttribute; } + + if(!xRetval.hasElements()) + { + // #i99123# + // Object is invisible. Create a fallback primitive for HitTest + basegfx::B2DHomMatrix aObjectMatrix; + basegfx::B2DPolyPolygon aObjectPolyPolygon; + GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } return xRetval; diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 0923a223a924..dffd81dab0b9 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -475,7 +475,7 @@ namespace drawinglayer attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText) { - attribute::SdrTextAttribute* pRetval(0L); + attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -492,24 +492,40 @@ namespace drawinglayer bInEditMode = rTextObj.IsInEditMode(); } - if(!bInEditMode) + OutlinerParaObject aOutlinerParaObject(*rText.GetOutlinerParaObject()); + + if(bInEditMode) { - const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); - const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); - - pRetval = new attribute::SdrTextAttribute( - rText, - ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), - rTextObj.GetTextLeftDistance(), - rTextObj.GetTextUpperDistance(), - rTextObj.GetTextRightDistance(), - rTextObj.GetTextLowerDistance(), - ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), - (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), - ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), - SDRTEXTANI_BLINK == eAniKind, - SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind); + OutlinerParaObject* pTempObj = rTextObj.GetEditOutlinerParaObject(); + + if(pTempObj) + { + aOutlinerParaObject = *pTempObj; + delete pTempObj; + } + else + { + bInEditMode = false; + } } + + const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); + const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); + + pRetval = new attribute::SdrTextAttribute( + rText, + aOutlinerParaObject, + ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), + rTextObj.GetTextLeftDistance(), + rTextObj.GetTextUpperDistance(), + rTextObj.GetTextRightDistance(), + rTextObj.GetTextLowerDistance(), + ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), + (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), + ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), + SDRTEXTANI_BLINK == eAniKind, + SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, + bInEditMode); } return pRetval; diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index f203cee5fa79..4a27eb73de8e 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -54,6 +54,7 @@ #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> +#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -205,12 +206,12 @@ namespace drawinglayer aScaledUnitPolyPolygon.transform(aScaleTransform); // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), aScaledUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledUnitPolyPolygon, rObjectTransform); } else { // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), rUnitPolyPolygon, rObjectTransform); } } else if(rText.isFontwork() && !rText.isScroll()) @@ -218,7 +219,7 @@ namespace drawinglayer // text on path, use scaled polygon. Not allowed when text scrolling is used. ::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), aScaledPolyPolygon); + pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon); } else { @@ -266,12 +267,12 @@ namespace drawinglayer if(rText.isFitToSize()) { // streched text in range - pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), aAnchorTransform); + pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform); } else // text in range { // build new primitive - pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); + pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); } } @@ -397,8 +398,22 @@ namespace drawinglayer } else { - // add to decomposition - return Primitive2DReference(pNew); + if(rText.isInEditMode()) + { + // #i97628# + // encapsulate with TextHierarchyEditPrimitive2D to allow renderers + // to suppress actively edited content if needed + const Primitive2DReference xRefA(pNew); + const Primitive2DSequence aContent(&xRefA, 1L); + + // create and add TextHierarchyEditPrimitive2D primitive + return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent)); + } + else + { + // add to decomposition + return Primitive2DReference(pNew); + } } } diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 6726d7671a23..7f9b47afb2d4 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -125,7 +125,8 @@ namespace drawinglayer } // create primitive and get text range - pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), aTextMatrix, pTextAttribute->isScroll(), false, false); + pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), pTextAttribute->getOutlinerParaObject(), + aTextMatrix, pTextAttribute->isScroll(), false, false); aTextRange = pBlockText->getB2DRange(aViewInformation); } diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index e0c0068a7efa..6c665cbef4c9 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -33,6 +33,10 @@ #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> #include <vcl/bmpacc.hxx> #include <osl/mutex.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// // helper methods @@ -175,6 +179,20 @@ namespace drawinglayer return *pRetVal; } + + // #i99123# + Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix) + { + // create PolygonHairlinePrimitive2D + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aUnitOutline.transform(rMatrix); + const basegfx::BColor aBlack(0.0, 0.0, 0.0); + const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack)); + + // create HitTestPrimitive2D with it + const Primitive2DSequence xSequence(&xReference, 1); + return Primitive2DReference(new HitTestPrimitive2D(xSequence)); + } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index a8d8f12b5aff..113cd226d8ba 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -63,33 +63,30 @@ namespace drawinglayer return xRetval; } - SdrTextPrimitive2D::SdrTextPrimitive2D(const SdrText& rSdrText) + SdrTextPrimitive2D::SdrTextPrimitive2D( + const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject) : BasePrimitive2D(), mrSdrText(rSdrText), + maOutlinerParaObject(rOutlinerParaObject), mxLastVisualizingPage(), mbLastSpellCheck(false), mbContainsPageField(false) { - if(mrSdrText.GetOutlinerParaObject()) - { - const EditTextObject& rETO = mrSdrText.GetOutlinerParaObject()->GetTextObject(); - mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) - || rETO.HasField(SvxHeaderField::StaticType()) - || rETO.HasField(SvxFooterField::StaticType()) - || rETO.HasField(SvxDateTimeField::StaticType()); - } + const EditTextObject& rETO = maOutlinerParaObject.GetTextObject(); + mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) + || rETO.HasField(SvxHeaderField::StaticType()) + || rETO.HasField(SvxFooterField::StaticType()) + || rETO.HasField(SvxDateTimeField::StaticType()); } bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(BasePrimitive2D::operator==(rPrimitive)) { - // since OutlinerParaObject has no compare operator, i do not clone it for this class and - // use the address in the SdrText for comparison if it did change const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive; - const bool bOutlinerParaSameAddress(getSdrText().GetOutlinerParaObject() == rCompare.getSdrText().GetOutlinerParaObject()); - return bOutlinerParaSameAddress; + return (getOutlinerParaObject() == rCompare.getOutlinerParaObject()); } return false; @@ -154,9 +151,10 @@ namespace drawinglayer SdrContourTextPrimitive2D::SdrContourTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, const ::basegfx::B2DHomMatrix& rObjectTransform) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maUnitPolyPolygon(rUnitPolyPolygon), maObjectTransform(rObjectTransform) { @@ -177,7 +175,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrContourTextPrimitive2D(getSdrText(), maUnitPolyPolygon, rTransform * maObjectTransform); + return new SdrContourTextPrimitive2D(getSdrText(), getOutlinerParaObject(), maUnitPolyPolygon, rTransform * maObjectTransform); } // provide unique ID @@ -208,8 +206,9 @@ namespace drawinglayer SdrPathTextPrimitive2D::SdrPathTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DPolyPolygon& rPathPolyPolygon) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maPathPolyPolygon(rPathPolyPolygon) { } @@ -230,7 +229,7 @@ namespace drawinglayer { ::basegfx::B2DPolyPolygon aNewPolyPolygon(maPathPolyPolygon); aNewPolyPolygon.transform(rTransform); - return new SdrPathTextPrimitive2D(getSdrText(), aNewPolyPolygon); + return new SdrPathTextPrimitive2D(getSdrText(), getOutlinerParaObject(), aNewPolyPolygon); } // provide unique ID @@ -261,11 +260,12 @@ namespace drawinglayer SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, bool bWordWrap) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform), mbUnlimitedPage(bUnlimitedPage), mbCellText(bCellText), @@ -290,7 +290,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrBlockTextPrimitive2D(getSdrText(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); + return new SdrBlockTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); } // provide unique ID @@ -321,8 +321,9 @@ namespace drawinglayer SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DHomMatrix& rTextRangeTransform) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform) { } @@ -341,7 +342,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrStretchTextPrimitive2D(getSdrText(), rTransform * maTextRangeTransform); + return new SdrStretchTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * maTextRangeTransform); } // provide unique ID diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 86ce2fa9205c..68b1679dff49 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1430,7 +1430,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, if(pLast && pSrcPath->GetOutlinerParaObject()) { - pLast->SetOutlinerParaObject(pSrcPath->GetOutlinerParaObject()->Clone()); + pLast->SetOutlinerParaObject(new OutlinerParaObject(*pSrcPath->GetOutlinerParaObject())); } } else if(pCustomShape) @@ -1469,7 +1469,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, OutlinerParaObject* pParaObj = pCustomShape->GetOutlinerParaObject(); if(pParaObj) { - pTextObj->NbcSetOutlinerParaObject(pParaObj->Clone()); + pTextObj->NbcSetOutlinerParaObject(new OutlinerParaObject(*pParaObj)); } // copy all attributes diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index 32bc5ecca46f..86d6093c8b15 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -7551,7 +7551,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab { SdrText* pSdrText = pTable->getText( nTableIndex ); if ( pSdrText ) - pSdrText->SetOutlinerParaObject( pParaObject->Clone() ); + pSdrText->SetOutlinerParaObject(new OutlinerParaObject(*pParaObject) ); } } } diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 194949474336..60761a2d3557 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -93,6 +93,8 @@ // #95114# #include <vcl/svapp.hxx> #include <svx/sdr/properties/properties.hxx> +#include <svx/eeitem.hxx> +#include <svtools/itemset.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -346,11 +348,11 @@ SdrModel::~SdrModel() { // Pools loeschen, falls es meine sind SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool(); - delete pItemPool; + SfxItemPool::Free(pItemPool); // Der OutlinerPool muss nach dem ItemPool plattgemacht werden, da der // ItemPool SetItems enthaelt die ihrerseits Items des OutlinerPools // referenzieren (Joe) - delete pOutlPool; + SfxItemPool::Free(pOutlPool); } if( mpForbiddenCharactersTable ) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 3f748e53ff47..70dda490a540 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2461,7 +2461,7 @@ void SdrObjCustomShape::SetVerticalWriting( sal_Bool bVertical ) if( pOutlinerParaObject ) { - if(pOutlinerParaObject->IsVertical() != bVertical) + if(pOutlinerParaObject->IsVertical() != (bool)bVertical) { // get item settings const SfxItemSet& rSet = GetObjectItemSet(); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 475ffbb8ea98..6ec9c607188b 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -613,8 +613,8 @@ void SdrObject::FreeGlobalDrawObjectItemPool() if(mpGlobalItemPool) { SfxItemPool* pGlobalOutlPool = mpGlobalItemPool->GetSecondaryPool(); - delete mpGlobalItemPool; - delete pGlobalOutlPool; + SfxItemPool::Free(mpGlobalItemPool); + SfxItemPool::Free(pGlobalOutlPool); } } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 9e38a0994bad..9abf3950d694 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1341,7 +1341,7 @@ void SdrTextObj::operator=(const SdrObject& rObj) } else { - pNewOutlinerParaObject = pTextObj->getActiveText()->GetOutlinerParaObject()->Clone(); + pNewOutlinerParaObject = new OutlinerParaObject(*pTextObj->getActiveText()->GetOutlinerParaObject()); } } @@ -1717,7 +1717,7 @@ void SdrTextObj::SetVerticalWriting(sal_Bool bVertical) pOutlinerParaObject = GetOutlinerParaObject(); } - if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != bVertical) ) + if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != (bool)bVertical) ) { // get item settings const SfxItemSet& rSet = GetObjectItemSet(); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index be1d19f96f4e..316cec90337f 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -662,7 +662,7 @@ bool SdrTextObj::impDecomposeContourTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetPolygon(aPolyPolygon); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*rSdrContourTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrContourTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); @@ -729,9 +729,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( // add one to rage sizes to get back to the old Rectangle and outliner measurements const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L)); const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L)); - const OutlinerParaObject* pOutlinerParaObject = rSdrBlockTextPrimitive.getSdrText().GetOutlinerParaObject(); - OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)"); - const bool bVerticalWritintg(pOutlinerParaObject->IsVertical()); + const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical()); const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight)); if(bIsCell) @@ -743,7 +741,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aAnchorTextSize); rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); rOutliner.SetUpdateMode(TRUE); - rOutliner.SetText(*pOutlinerParaObject); + rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); rOutliner.SetUpdateMode(TRUE); rOutliner.SetControlWord(nOriginalControlWord); } @@ -766,7 +764,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*pOutlinerParaObject); + rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); rOutliner.SetControlWord(nOriginalControlWord); } @@ -894,7 +892,7 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*rSdrStretchTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrStretchTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index dd30d6ec5dba..cbf80e23c91d 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -39,6 +39,8 @@ #include "svx/svdoutl.hxx" #include "svx/svdmodel.hxx" #include "svx/fhgtitem.hxx" +#include <svx/eeitem.hxx> +#include <svtools/itemset.hxx> SdrText::SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject /* = 0 */ ) : mpOutlinerParaObject( pOutlinerParaObject ) diff --git a/svx/source/svdraw/svdtxhdl.cxx b/svx/source/svdraw/svdtxhdl.cxx index 8446b3dd6ea6..e78b85ff10d0 100644 --- a/svx/source/svdraw/svdtxhdl.cxx +++ b/svx/source/svdraw/svdtxhdl.cxx @@ -57,6 +57,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svtools/itemset.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 976f48c82194..eb52bfb62c9e 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -348,7 +348,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBO { pTextUndo = pObj->GetOutlinerParaObject(); if(pTextUndo) - pTextUndo = pTextUndo->Clone(); + pTextUndo = new OutlinerParaObject(*pTextUndo); } } } @@ -409,7 +409,7 @@ void SdrUndoAttrObj::Undo() pTextRedo = pObj->GetOutlinerParaObject(); if(pTextRedo) - pTextRedo = pTextRedo->Clone(); + pTextRedo = new OutlinerParaObject(*pTextRedo); } } @@ -470,7 +470,7 @@ void SdrUndoAttrObj::Undo() if(pTextUndo) { - pObj->SetOutlinerParaObject(pTextUndo->Clone()); + pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextUndo)); } } @@ -540,7 +540,7 @@ void SdrUndoAttrObj::Redo() // #i8508# if(pTextRedo) { - pObj->SetOutlinerParaObject(pTextRedo->Clone()); + pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextRedo)); } } @@ -1096,7 +1096,7 @@ SdrUndoObjSetText::SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText) { SdrText* pText = static_cast< SdrTextObj*>( &rNewObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pOldText = pText->GetOutlinerParaObject()->Clone(); + pOldText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); bEmptyPresObj = rNewObj.IsEmptyPresObj(); } @@ -1115,7 +1115,7 @@ void SdrUndoObjSetText::AfterSetText() { SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pNewText = pText->GetOutlinerParaObject()->Clone(); + pNewText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); bNewTextAvailable=TRUE; } } @@ -1132,7 +1132,7 @@ void SdrUndoObjSetText::Undo() // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung OutlinerParaObject* pText1 = pOldText; if(pText1) - pText1 = pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText ) @@ -1148,7 +1148,7 @@ void SdrUndoObjSetText::Redo() OutlinerParaObject* pText1 = pNewText; if(pText1) - pText1 = pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText ) @@ -1192,7 +1192,7 @@ void SdrUndoObjSetText::SdrRepeat(SdrView& rView) rView.AddUndo(new SdrUndoObjSetText(*pTextObj,0)); OutlinerParaObject* pText1=pNewText; if (pText1!=NULL) - pText1=pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); pTextObj->SetOutlinerParaObject(pText1); } } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 3063f782ae64..e7096dcc2df0 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -409,7 +409,7 @@ void Cell::replaceContentAndFormating( const CellRef& xSourceCell ) if( xSourceCell.is() && mpProperties ) { mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() ); - SetOutlinerParaObject( xSourceCell->GetOutlinerParaObject()->Clone() ); + SetOutlinerParaObject( new OutlinerParaObject(*xSourceCell->GetOutlinerParaObject()) ); SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() ); SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() ); @@ -509,10 +509,7 @@ const SfxItemSet& Cell::GetObjectItemSet() else { DBG_ERROR("Cell::GetObjectItemSet(), called without properties!"); - static UniString aEmptyStr; - static SfxItemPool aEmptyPool(aEmptyStr,0,0,0); - static SfxItemSet aSet(aEmptyPool); - return aSet; + return GetObject().GetObjectItemSet(); } } diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx index 9f872fded787..f72ca2fd8927 100644 --- a/svx/source/table/tableundo.cxx +++ b/svx/source/table/tableundo.cxx @@ -132,7 +132,7 @@ void CellUndo::setDataToCell( const Data& rData ) mxCell->mpProperties = 0; if( rData.mpOutlinerParaObject ) - mxCell->SetOutlinerParaObject( rData.mpOutlinerParaObject->Clone() ); + mxCell->SetOutlinerParaObject( new OutlinerParaObject(*rData.mpOutlinerParaObject) ); else mxCell->RemoveOutlinerParaObject(); @@ -155,7 +155,7 @@ void CellUndo::getDataFromCell( Data& rData ) rData.mpProperties = mxCell->CloneProperties( *mxObjRef.get(), *mxCell.get()); if( mxCell->GetOutlinerParaObject() ) - rData.mpOutlinerParaObject = mxCell->GetOutlinerParaObject()->Clone(); + rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject()); else rData.mpOutlinerParaObject = 0; diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index f7a2134c520e..1abf930eb3ed 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -73,7 +73,7 @@ SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel ) throw() SvxUnoDrawPool::~SvxUnoDrawPool() throw() { - delete mpDefaultsPool; + SfxItemPool::Free(mpDefaultsPool); } void SvxUnoDrawPool::init() diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index 797d266b4e44..777e75d89b4a 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -2496,9 +2496,10 @@ String SvxDummyTextSource::GetText( const ESelection& ) const SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, BOOL ) const { - String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy")); - SfxItemPool aPool(aDummyStr,0,0,NULL); - return SfxItemSet(aPool); + // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using + // a deleted Pool by design. + return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); } SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_uInt16 ) const diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 7b28349cac43..b304ea9a62a1 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -120,7 +120,7 @@ XPropertyTable::~XPropertyTable() // Eigener Pool wird geloescht if( bOwnPool && pXPool ) { - delete pXPool; + SfxItemPool::Free(pXPool); } } @@ -352,7 +352,7 @@ XPropertyList::~XPropertyList() if( bOwnPool && pXPool ) { - delete pXPool; + SfxItemPool::Free(pXPool); } } |