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
This commit is contained in:
Caolán McNamara
2012-02-27 16:18:34 +00:00
parent cb5bd5a1ae
commit f1857d76cb
6 changed files with 52 additions and 65 deletions

View File

@@ -119,10 +119,10 @@ sal_Bool ScStyleSheet::SetParent( const String& rParentName )
{
sal_Bool bResult = false;
String aEffName = rParentName;
SfxStyleSheetBase* pStyle = rPool.Find( aEffName, nFamily );
SfxStyleSheetBase* pStyle = pPool->Find( aEffName, nFamily );
if (!pStyle)
{
SfxStyleSheetIterator* pIter = rPool.CreateIterator( nFamily, SFXSTYLEBIT_ALL );
SfxStyleSheetIterator* pIter = pPool->CreateIterator( nFamily, SFXSTYLEBIT_ALL );
pStyle = pIter->First();
if (pStyle)
aEffName = pStyle->GetName();
@@ -275,7 +275,7 @@ sal_Bool ScStyleSheet::IsUsed() const
{
// Always query the document to let it decide if a rescan is necessary,
// and store the state.
ScDocument* pDoc = ((ScStyleSheetPool&)rPool).GetDocument();
ScDocument* pDoc = ((ScStyleSheetPool*)pPool)->GetDocument();
if ( pDoc && pDoc->IsStyleSheetUsed( *this, sal_True ) )
eUsage = USED;
else
@@ -303,7 +303,7 @@ void ScStyleSheet::Notify( SfxBroadcaster&, const SfxHint& rHint )
const String& ScStyleSheet::GetName() const
{
const String& rBase = SfxStyleSheet::GetName();
const String* pForceStdName = ((ScStyleSheetPool&)rPool).GetForceStdName();
const String* pForceStdName = ((ScStyleSheetPool*)pPool)->GetForceStdName();
if ( pForceStdName && rBase == ScGlobal::GetRscString(STR_STYLENAME_STANDARD) )
return *pForceStdName;
else
@@ -313,7 +313,7 @@ const String& ScStyleSheet::GetName() const
const String& ScStyleSheet::GetParent() const
{
const String& rBase = SfxStyleSheet::GetParent();
const String* pForceStdName = ((ScStyleSheetPool&)rPool).GetForceStdName();
const String* pForceStdName = ((ScStyleSheetPool*)pPool)->GetForceStdName();
if ( pForceStdName && rBase == ScGlobal::GetRscString(STR_STYLENAME_STANDARD) )
return *pForceStdName;
else
@@ -323,7 +323,7 @@ const String& ScStyleSheet::GetParent() const
const String& ScStyleSheet::GetFollow() const
{
const String& rBase = SfxStyleSheet::GetFollow();
const String* pForceStdName = ((ScStyleSheetPool&)rPool).GetForceStdName();
const String* pForceStdName = ((ScStyleSheetPool*)pPool)->GetForceStdName();
if ( pForceStdName && rBase == ScGlobal::GetRscString(STR_STYLENAME_STANDARD) )
return *pForceStdName;
else

View File

@@ -209,7 +209,7 @@ sal_Bool SdStyleSheet::SetParent(const String& rParentName)
{
if( rParentName.Len() )
{
SfxStyleSheetBase* pStyle = rPool.Find(rParentName, nFamily);
SfxStyleSheetBase* pStyle = pPool->Find(rParentName, nFamily);
if (pStyle)
{
bResult = sal_True;
@@ -402,7 +402,7 @@ SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
String aRealStyle;
String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
SdStyleSheet* pRealStyle = NULL;
SdDrawDocument* pDoc = ((SdStyleSheetPool&) rPool).GetDoc();
SdDrawDocument* pDoc = ((SdStyleSheetPool*)pPool)->GetDoc();
::sd::DrawViewShell* pDrawViewShell = 0;
@@ -433,7 +433,7 @@ SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
{
// Noch keine Seite vorhanden
// Dieses kann beim Aktualisieren vonDokumentvorlagen vorkommen
SfxStyleSheetIterator aIter(&rPool, SD_STYLE_FAMILY_MASTERPAGE);
SfxStyleSheetIterator aIter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
SfxStyleSheetBase* pSheet = aIter.First();
if( pSheet )
aRealStyle = pSheet->GetName();
@@ -479,12 +479,12 @@ SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
}
aRealStyle += aInternalName;
pRealStyle = static_cast< SdStyleSheet* >( rPool.Find(aRealStyle, SD_STYLE_FAMILY_MASTERPAGE) );
pRealStyle = static_cast< SdStyleSheet* >( pPool->Find(aRealStyle, SD_STYLE_FAMILY_MASTERPAGE) );
#ifdef DBG_UTIL
if( !pRealStyle )
{
SfxStyleSheetIterator aIter(&rPool, SD_STYLE_FAMILY_MASTERPAGE);
SfxStyleSheetIterator aIter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
if( aIter.Count() > 0 )
// StyleSheet not found, but pool already loaded
DBG_ASSERT(pRealStyle, "Internal StyleSheet not found");
@@ -540,7 +540,7 @@ SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const
}
}
pPseudoStyle = static_cast<SdStyleSheet*>(rPool.Find(aStyleName, SD_STYLE_FAMILY_PSEUDO));
pPseudoStyle = static_cast<SdStyleSheet*>(pPool->Find(aStyleName, SD_STYLE_FAMILY_PSEUDO));
DBG_ASSERT(pPseudoStyle, "PseudoStyleSheet nicht gefunden");
return pPseudoStyle;

View File

@@ -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();
};

View File

@@ -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);
}

View File

@@ -93,7 +93,7 @@ protected:
public:
SwDocStyleSheet( SwDoc& rDoc,
const String& rName,
SwDocStyleSheetPool& rPool,
SwDocStyleSheetPool* pPool,
SfxStyleFamily eFam,
sal_uInt16 nMask);

View File

@@ -386,7 +386,7 @@ void SwPoolFmtList::Erase()
SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument,
const String& rName,
SwDocStyleSheetPool& _rPool,
SwDocStyleSheetPool* _rPool,
SfxStyleFamily eFam,
sal_uInt16 _nMask) :
@@ -612,7 +612,7 @@ String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
{
String aItemPresentation;
if ( !IsInvalidItem( pItem ) &&
rPool.GetPool().GetPresentation(
pPool->GetPool().GetPresentation(
*pItem, SFX_ITEM_PRESENTATION_COMPLETE,
eUnit, aItemPresentation, &aIntlWrapper ) )
{
@@ -660,7 +660,7 @@ String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
{
String aItemPresentation;
if ( !IsInvalidItem( pItem ) &&
rPool.GetPool().GetPresentation(
pPool->GetPool().GetPresentation(
*pItem, SFX_ITEM_PRESENTATION_COMPLETE,
eUnit, aItemPresentation, &aIntlWrapper ) )
{
@@ -868,8 +868,8 @@ sal_Bool SwDocStyleSheet::SetName( const String& rStr)
if( bChg )
{
rPool.First(); // internal list has to be updated
rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
pPool->First(); // internal list has to be updated
pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
SwEditShell* pSh = rDoc.GetEditShell();
if( pSh )
pSh->CallChgLnk();
@@ -924,7 +924,7 @@ sal_Bool SwDocStyleSheet::SetParent( const String& rStr)
if( bRet )
{
aParent = rStr;
rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
*this ) );
}
}
@@ -2019,7 +2019,7 @@ void SwDocStyleSheet::SetHelpId( const String& r, sal_uLong nId )
SwDocStyleSheetPool::SwDocStyleSheetPool( SwDoc& rDocument, sal_Bool bOrg )
: SfxStyleSheetBasePool( rDocument.GetAttrPool() )
, mxStyleSheet( new SwDocStyleSheet( rDocument, aEmptyStr, *this, SFX_STYLE_FAMILY_CHAR, 0 ) )
, mxStyleSheet( new SwDocStyleSheet( rDocument, aEmptyStr, this, SFX_STYLE_FAMILY_CHAR, 0 ) )
, rDoc( rDocument )
{
bOrganizer = bOrg;
@@ -2378,8 +2378,8 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
SfxStyleFamily eFam, sal_uInt16 n )
: SfxStyleSheetIterator( pBase, eFam, n ),
mxIterSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) ),
mxStyleSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) )
mxIterSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, pBase, SFX_STYLE_FAMILY_CHAR, 0 ) ),
mxStyleSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, pBase, SFX_STYLE_FAMILY_CHAR, 0 ) )
{
bFirstCalled = sal_False;
nLastPos = 0;