summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-27 16:18:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-02-28 10:56:58 +0000
commitf1857d76cb4d770fe6e0055bb14fa16e081e93f4 (patch)
tree226fee0cc0325eae6500ef4b9058a768b10451f7 /svl
parentcb5bd5a1aea6bb26efa664f5757136915a59f254 (diff)
SfxStyleSheet needs a default ctor
due to use of ImplInheritanceHelper2 SfxStyleSheet needs a default ctor, though its never called. rearrange things a little so we can have an empty ctor without pulling in a bunch of code which is never executed
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/svl/style.hxx18
-rw-r--r--svl/source/items/style.cxx55
2 files changed, 30 insertions, 43 deletions
diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx
index 3cc136a12eb3..64f28a5db09e 100644
--- a/svl/inc/svl/style.hxx
+++ b/svl/inc/svl/style.hxx
@@ -87,7 +87,7 @@ private:
SVL_DLLPRIVATE static SfxStyleSheetBasePool& implGetStaticPool();
protected:
- SfxStyleSheetBasePool& rPool; // zugehoeriger Pool
+ SfxStyleSheetBasePool* pPool; // zugehoeriger Pool
SfxStyleFamily nFamily; // Familie
UniString aName, aParent, aFollow;
@@ -100,12 +100,7 @@ protected:
sal_Bool bMySet; // sal_True: Set loeschen im dtor
- SfxStyleSheetBase() // do not use!
- : comphelper::OWeakTypeObject()
- , rPool( implGetStaticPool() )
- {
- }
- SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool&, SfxStyleFamily eFam, sal_uInt16 mask );
+ SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, sal_uInt16 mask );
SfxStyleSheetBase( const SfxStyleSheetBase& );
virtual ~SfxStyleSheetBase();
virtual void Load( SvStream&, sal_uInt16 );
@@ -140,7 +135,7 @@ public:
virtual UniString GetDescription();
virtual UniString GetDescription( SfxMapUnit eMetric );
- SfxStyleSheetBasePool& GetPool() { return rPool; }
+ SfxStyleSheetBasePool& GetPool() { return *pPool; }
SfxStyleFamily GetFamily() const { return nFamily; }
sal_uInt16 GetMask() const { return nMask; }
void SetMask( sal_uInt16 mask) { nMask = mask; }
@@ -289,7 +284,12 @@ public:
virtual sal_Bool SetParent( const UniString& );
protected:
- SfxStyleSheet() {} // do not use! needed by MSVC
+ SfxStyleSheet() // do not use! needed by MSVC at compile time to satisfy ImplInheritanceHelper2
+ : SfxStyleSheetBase(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dummy")),
+ NULL, SFX_STYLE_FAMILY_ALL, 0)
+ {
+ assert(false);
+ }
virtual ~SfxStyleSheet();
};
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 2b3808013217..120a09ae79df 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -109,8 +109,8 @@ class SfxStyleSheetBasePool_Impl
// Konstruktoren
-SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBasePool& r, SfxStyleFamily eFam, sal_uInt16 mask )
- : rPool( r )
+SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBasePool* p, SfxStyleFamily eFam, sal_uInt16 mask )
+ : pPool( p )
, nFamily( eFam )
, aName( rName )
, aParent()
@@ -127,7 +127,7 @@ SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBaseP
SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
: comphelper::OWeakTypeObject()
- , rPool( r.rPool )
+ , pPool( r.pPool )
, nFamily( r.nFamily )
, aName( r.aName )
, aParent( r.aParent )
@@ -146,19 +146,6 @@ SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
pSet = NULL;
}
-SfxStyleSheetBasePool& SfxStyleSheetBase::implGetStaticPool()
-{
- static SfxStyleSheetBasePool* pSheetPool = 0;
- static SfxItemPool* pBasePool = 0;
- if( !pSheetPool )
- {
- UniString aName;
- pBasePool = new SfxItemPool( aName, 0, 0, 0 );
- pSheetPool = new SfxStyleSheetBasePool(*pBasePool);
- }
- return *pSheetPool;
-}
-
SfxStyleSheetBase::~SfxStyleSheetBase()
{
#ifdef DBG_UTIL
@@ -191,22 +178,22 @@ sal_Bool SfxStyleSheetBase::SetName( const XubString& rName )
if( aName != rName )
{
String aOldName = aName;
- SfxStyleSheetBase *pOther = rPool.Find( rName, nFamily ) ;
+ SfxStyleSheetBase *pOther = pPool->Find( rName, nFamily ) ;
if ( pOther && pOther != this )
return sal_False;
- SfxStyleFamily eTmpFam=rPool.GetSearchFamily();
- sal_uInt16 nTmpMask=rPool.GetSearchMask();
+ SfxStyleFamily eTmpFam = pPool->GetSearchFamily();
+ sal_uInt16 nTmpMask = pPool->GetSearchMask();
- rPool.SetSearchMask(nFamily);
+ pPool->SetSearchMask(nFamily);
if ( aName.Len() )
- rPool.ChangeParent( aName, rName, sal_False );
+ pPool->ChangeParent( aName, rName, sal_False );
if ( aFollow.Equals( aName ) )
aFollow = rName;
aName = rName;
- rPool.SetSearchMask(eTmpFam, nTmpMask);
- rPool.Broadcast( SfxStyleSheetHintExtended(
+ pPool->SetSearchMask(eTmpFam, nTmpMask);
+ pPool->Broadcast( SfxStyleSheetHintExtended(
SFX_STYLESHEET_MODIFIED, aOldName, *this ) );
}
return sal_True;
@@ -243,7 +230,7 @@ sal_Bool SfxStyleSheetBase::SetParent( const XubString& rName )
if( aParent != rName )
{
- SfxStyleSheetBase* pIter = rPool.Find(rName, nFamily);
+ SfxStyleSheetBase* pIter = pPool->Find(rName, nFamily);
if( rName.Len() && !pIter )
{
OSL_FAIL( "StyleSheet-Parent nicht gefunden" );
@@ -255,11 +242,11 @@ sal_Bool SfxStyleSheetBase::SetParent( const XubString& rName )
{
if(pIter->GetName() == aName)
return sal_False;
- pIter = rPool.Find(pIter->GetParent(), nFamily);
+ pIter = pPool->Find(pIter->GetParent(), nFamily);
}
aParent = rName;
}
- rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
return sal_True;
}
@@ -274,14 +261,14 @@ sal_Bool SfxStyleSheetBase::SetFollow( const XubString& rName )
{
if( aFollow != rName )
{
- if( !rPool.Find( rName, nFamily ) )
+ if( !pPool->Find( rName, nFamily ) )
{
OSL_FAIL( "StyleSheet-Follow nicht gefunden" );
return sal_False;
}
aFollow = rName;
}
- rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
return sal_True;
}
@@ -291,7 +278,7 @@ SfxItemSet& SfxStyleSheetBase::GetItemSet()
{
if( !pSet )
{
- pSet = new SfxItemSet( rPool.GetPool() );
+ pSet = new SfxItemSet( pPool->GetPool() );
bMySet = sal_True;
}
return *pSet;
@@ -362,7 +349,7 @@ XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric )
XubString aItemPresentation;
if ( !IsInvalidItem( pItem ) &&
- rPool.GetPool().GetPresentation(
+ pPool->GetPool().GetPresentation(
*pItem, SFX_ITEM_PRESENTATION_COMPLETE,
eMetric, aItemPresentation, &aIntlWrapper ) )
{
@@ -647,7 +634,7 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create
sal_uInt16 mask
)
{
- return new SfxStyleSheetBase( rName, *this, eFam, mask );
+ return new SfxStyleSheetBase( rName, this, eFam, mask );
}
SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r )
@@ -869,7 +856,7 @@ SfxStyleSheet::SfxStyleSheet(const XubString &rName,
const SfxStyleSheetBasePool& r_Pool,
SfxStyleFamily eFam,
sal_uInt16 mask ):
- SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool& >( r_Pool ), eFam, mask)
+ SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask)
{}
SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) :
@@ -893,14 +880,14 @@ sal_Bool SfxStyleSheet::SetParent( const XubString& rName )
// aus der Benachrichtigungskette des alten
// Parents gfs. austragen
if(aOldParent.Len()) {
- SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aOldParent, nFamily, 0xffff);
+ SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aOldParent, nFamily, 0xffff);
if(pParent)
EndListening(*pParent);
}
// in die Benachrichtigungskette des neuen
// Parents eintragen
if(aParent.Len()) {
- SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aParent, nFamily, 0xffff);
+ SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aParent, nFamily, 0xffff);
if(pParent)
StartListening(*pParent);
}