diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/itempool.hxx | 21 | ||||
-rw-r--r-- | svtools/inc/svtools/optionsdrawinglayer.hxx | 6 | ||||
-rw-r--r-- | svtools/source/config/optionsdrawinglayer.cxx | 144 | ||||
-rw-r--r-- | svtools/source/items/style.cxx | 5 | ||||
-rw-r--r-- | svtools/source/items1/itempool.cxx | 44 |
5 files changed, 212 insertions, 8 deletions
diff --git a/svtools/inc/svtools/itempool.hxx b/svtools/inc/svtools/itempool.hxx index 3b08b44aece5..81407cee2d0c 100644 --- a/svtools/inc/svtools/itempool.hxx +++ b/svtools/inc/svtools/itempool.hxx @@ -41,6 +41,7 @@ #include <tools/string.hxx> #include <svtools/svarray.hxx> #include <svtools/poolitem.hxx> +#include <vector> class SvStream; class SfxBroadcaster; @@ -80,6 +81,15 @@ struct SfxItemInfo class SfxStyleSheetIterator; struct SfxPoolItemArray_Impl; +class SfxItemPool; + +class SVL_DLLPUBLIC SfxItemPoolUser +{ +public: + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool) = 0; +}; + +typedef ::std::vector< SfxItemPoolUser* > SfxItemPoolUserVector; class SVL_DLLPUBLIC SfxItemPool @@ -116,6 +126,14 @@ class SVL_DLLPUBLIC SfxItemPool USHORT* _pPoolRanges; FASTBOOL bPersistentRefCounts; +private: + // ObjectUser section + SfxItemPoolUserVector maSfxItemPoolUsers; + +public: + void AddSfxItemPoolUser(SfxItemPoolUser& rNewUser); + void RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser); + //--------------------------------------------------------------------- #ifndef _SFXITEMS_HXX @@ -156,7 +174,10 @@ public: USHORT *pSlotIds = 0, #endif FASTBOOL bLoadRefCounts = TRUE ); +protected: virtual ~SfxItemPool(); +public: + static void Free(SfxItemPool* pPool); SfxBroadcaster& BC(); diff --git a/svtools/inc/svtools/optionsdrawinglayer.hxx b/svtools/inc/svtools/optionsdrawinglayer.hxx index 4e97de7d6792..e0b287002f34 100644 --- a/svtools/inc/svtools/optionsdrawinglayer.hxx +++ b/svtools/inc/svtools/optionsdrawinglayer.hxx @@ -175,12 +175,18 @@ class SVL_DLLPUBLIC SvtOptionsDrawinglayer // primitives sal_Bool IsAntiAliasing() const; + sal_Bool IsSnapHorVerLinesToDiscrete() const; sal_Bool IsSolidDragCreate() const; + sal_Bool IsRenderDecoratedTextDirect() const; + sal_Bool IsRenderSimpleTextDirect() const; sal_uInt32 GetQuadratic3DRenderLimit() const; sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); + void SetSnapHorVerLinesToDiscrete( sal_Bool bState ); void SetSolidDragCreate( sal_Bool bState ); + void SetRenderDecoratedTextDirect( sal_Bool bState ); + void SetRenderSimpleTextDirect( sal_Bool bState ); void SetQuadratic3DRenderLimit(sal_uInt32 nNew); void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index c63dc2154c55..125827d17faf 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -85,7 +85,10 @@ using namespace ::com::sun::star::uno ; // primitives #define DEFAULT_ANTIALIASING sal_True +#define DEFAULT_SNAPHORVERLINESTODISCRETE sal_True #define DEFAULT_SOLIDDRAGCREATE sal_True +#define DEFAULT_RENDERDECORATEDTEXTDIRECT sal_True +#define DEFAULT_RENDERSIMPLETEXTDIRECT sal_True #define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000 #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000 @@ -115,7 +118,10 @@ using namespace ::com::sun::star::uno ; // primitives #define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing")) +#define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString(RTL_CONSTASCII_USTRINGPARAM("SnapHorVerLinesToDiscrete")) #define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate")) +#define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderDecoratedTextDirect")) +#define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderSimpleTextDirect")) #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit")) #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit")) @@ -145,11 +151,14 @@ using namespace ::com::sun::star::uno ; // primitives #define PROPERTYHANDLE_ANTIALIASING 17 -#define PROPERTYHANDLE_SOLIDDRAGCREATE 18 -#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 19 -#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 20 +#define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE 18 +#define PROPERTYHANDLE_SOLIDDRAGCREATE 19 +#define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT 20 +#define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT 21 +#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 22 +#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 23 -#define PROPERTYCOUNT 21 +#define PROPERTYCOUNT 24 class SvtOptionsDrawinglayer_Impl : public ConfigItem { @@ -224,12 +233,18 @@ public: // primitives sal_Bool IsAntiAliasing() const; + sal_Bool IsSnapHorVerLinesToDiscrete() const; sal_Bool IsSolidDragCreate() const; + sal_Bool IsRenderDecoratedTextDirect() const; + sal_Bool IsRenderSimpleTextDirect() const; sal_uInt32 GetQuadratic3DRenderLimit() const; sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); + void SetSnapHorVerLinesToDiscrete( sal_Bool bState ); void SetSolidDragCreate( sal_Bool bState ); + void SetRenderDecoratedTextDirect( sal_Bool bState ); + void SetRenderSimpleTextDirect( sal_Bool bState ); void SetQuadratic3DRenderLimit(sal_uInt32 nNew); void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); @@ -273,7 +288,10 @@ private: // primitives sal_Bool m_bAntiAliasing; + sal_Bool m_bSnapHorVerLinesToDiscrete; sal_Bool m_bSolidDragCreate; + sal_Bool m_bRenderDecoratedTextDirect; + sal_Bool m_bRenderSimpleTextDirect; sal_uInt32 m_nQuadratic3DRenderLimit; sal_uInt32 m_nQuadraticFormControlRenderLimit; @@ -317,7 +335,10 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : // primitives m_bAntiAliasing(DEFAULT_ANTIALIASING), + m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE), m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE), + m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT), + m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT), m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT), m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT), @@ -474,6 +495,14 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : } break; + // primitives + case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" ); + seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete; + } + break; + case PROPERTYHANDLE_SOLIDDRAGCREATE: { DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" ); @@ -481,6 +510,20 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : } break; + case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" ); + seqValues[nProperty] >>= m_bRenderDecoratedTextDirect; + } + break; + + case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" ); + seqValues[nProperty] >>= m_bRenderSimpleTextDirect; + } + break; + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: { DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" ); @@ -595,10 +638,22 @@ void SvtOptionsDrawinglayer_Impl::Commit() aSeqValues[nProperty] <<= m_bAntiAliasing; break; + case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: + aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete; + break; + case PROPERTYHANDLE_SOLIDDRAGCREATE: aSeqValues[nProperty] <<= m_bSolidDragCreate; break; + case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: + aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect; + break; + + case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: + aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect; + break; + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit; break; @@ -917,11 +972,26 @@ sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const return m_bAntiAliasing; } +sal_Bool SvtOptionsDrawinglayer_Impl::IsSnapHorVerLinesToDiscrete() const +{ + return m_bSnapHorVerLinesToDiscrete; +} + sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const { return m_bSolidDragCreate; } +sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const +{ + return m_bRenderDecoratedTextDirect; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const +{ + return m_bRenderSimpleTextDirect; +} + sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const { return m_nQuadratic3DRenderLimit; @@ -941,6 +1011,15 @@ void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState ) } } +void SvtOptionsDrawinglayer_Impl::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) +{ + if(m_bSnapHorVerLinesToDiscrete != bState) + { + m_bSnapHorVerLinesToDiscrete = bState; + SetModified(); + } +} + void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) { if(m_bSolidDragCreate != bState) @@ -950,6 +1029,24 @@ void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) } } +void SvtOptionsDrawinglayer_Impl::SetRenderDecoratedTextDirect( sal_Bool bState ) +{ + if(m_bRenderDecoratedTextDirect != bState) + { + m_bRenderDecoratedTextDirect = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetRenderSimpleTextDirect( sal_Bool bState ) +{ + if(m_bRenderSimpleTextDirect != bState) + { + m_bRenderSimpleTextDirect = bState; + SetModified(); + } +} + void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew) { if(m_nQuadratic3DRenderLimit != nNew) @@ -1002,7 +1099,10 @@ Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() // primitives PROPERTYNAME_ANTIALIASING, + PROPERTYNAME_SNAPHORVERLINESTODISCRETE, PROPERTYNAME_SOLIDDRAGCREATE, + PROPERTYNAME_RENDERDECORATEDTEXTDIRECT, + PROPERTYNAME_RENDERSIMPLETEXTDIRECT, PROPERTYNAME_QUADRATIC3DRENDERLIMIT, PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT }; @@ -1308,12 +1408,30 @@ sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem(); } +sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete(); +} + sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const { MutexGuard aGuard( GetOwnStaticMutex() ); return m_pDataContainer->IsSolidDragCreate(); } +sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRenderDecoratedTextDirect(); +} + +sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRenderSimpleTextDirect(); +} + sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const { MutexGuard aGuard( GetOwnStaticMutex() ); @@ -1332,12 +1450,30 @@ void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) m_pDataContainer->SetAntiAliasing( bState ); } +void SvtOptionsDrawinglayer::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSnapHorVerLinesToDiscrete( bState ); +} + void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) { MutexGuard aGuard( GetOwnStaticMutex() ); m_pDataContainer->SetSolidDragCreate( bState ); } +void SvtOptionsDrawinglayer::SetRenderDecoratedTextDirect( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetRenderDecoratedTextDirect( bState ); +} + +void SvtOptionsDrawinglayer::SetRenderSimpleTextDirect( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetRenderSimpleTextDirect( bState ); +} + void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) { MutexGuard aGuard( GetOwnStaticMutex() ); diff --git a/svtools/source/items/style.cxx b/svtools/source/items/style.cxx index 26ef160ffb93..ad11f1527ce7 100644 --- a/svtools/source/items/style.cxx +++ b/svtools/source/items/style.cxx @@ -180,11 +180,12 @@ SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r ) static SfxStyleSheetBasePool& implGetStaticPool() { static SfxStyleSheetBasePool* pSheetPool = 0; + static SfxItemPool* pBasePool = 0; if( !pSheetPool ) { UniString aName; - static SfxItemPool aPool( aName, 0, 0, 0 ); - pSheetPool = new SfxStyleSheetBasePool( aPool ); + pBasePool = new SfxItemPool( aName, 0, 0, 0 ); + pSheetPool = new SfxStyleSheetBasePool(*pBasePool); } return *pSheetPool; } diff --git a/svtools/source/items1/itempool.cxx b/svtools/source/items1/itempool.cxx index f6a48b51019f..e54bca8d3c19 100644 --- a/svtools/source/items1/itempool.cxx +++ b/svtools/source/items1/itempool.cxx @@ -41,6 +41,7 @@ #include <svtools/brdcst.hxx> #include <svtools/smplhint.hxx> #include "poolio.hxx" +#include <algorithm> // STATIC DATA ----------------------------------------------------------- @@ -52,6 +53,20 @@ SV_IMPL_PTRARR( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl* ); //======================================================================== +void SfxItemPool::AddSfxItemPoolUser(SfxItemPoolUser& rNewUser) +{ + maSfxItemPoolUsers.push_back(&rNewUser); +} + +void SfxItemPool::RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser) +{ + const SfxItemPoolUserVector::iterator aFindResult = ::std::find(maSfxItemPoolUsers.begin(), maSfxItemPoolUsers.end(), &rOldUser); + if(aFindResult != maSfxItemPoolUsers.end()) + { + maSfxItemPoolUsers.erase(aFindResult); + } +} + const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( USHORT nWhich ) const { DBG_CHKTHIS(SfxItemPool, 0); @@ -162,7 +177,8 @@ SfxItemPool::SfxItemPool pSecondary(0), pMaster(this), _pPoolRanges( 0 ), - bPersistentRefCounts(bLoadRefCounts) + bPersistentRefCounts(bLoadRefCounts), + maSfxItemPoolUsers() { DBG_CTOR(SfxItemPool, 0); DBG_ASSERT(nStart, "Start-Which-Id must be greater 0" ); @@ -222,7 +238,8 @@ SfxItemPool::SfxItemPool pSecondary(0), pMaster(this), _pPoolRanges( 0 ), - bPersistentRefCounts(rPool.bPersistentRefCounts ) + bPersistentRefCounts(rPool.bPersistentRefCounts ), + maSfxItemPoolUsers() { DBG_CTOR(SfxItemPool, 0); pImp->eDefMetric = rPool.pImp->eDefMetric; @@ -387,6 +404,29 @@ SfxItemPool::~SfxItemPool() delete[] _pPoolRanges; delete pImp; } + +void SfxItemPool::Free(SfxItemPool* pPool) +{ + if(pPool) + { + // tell all the registered SfxItemPoolUsers that the pool is in destruction + SfxItemPoolUserVector aListCopy(pPool->maSfxItemPoolUsers.begin(), pPool->maSfxItemPoolUsers.end()); + for(SfxItemPoolUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++) + { + SfxItemPoolUser* pSfxItemPoolUser = *aIterator; + DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)"); + pSfxItemPoolUser->ObjectInDestruction(*pPool); + } + + // Clear the vector. This means that user do not need to call RemoveSfxItemPoolUser() + // when they get called from ObjectInDestruction(). + pPool->maSfxItemPoolUsers.clear(); + + // delete pool + delete pPool; + } +} + // ----------------------------------------------------------------------- |