summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/docfac.cxx
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2002-07-09 13:54:44 +0000
committerMathias Bauer <mba@openoffice.org>2002-07-09 13:54:44 +0000
commita020d5d99745bf2d44e7760b8466ce70ce98a665 (patch)
treebee4d2a182cb4f22dc74068c518c7e63cc99fb73 /sfx2/source/doc/docfac.cxx
parentb0c0658dcc16fab2ade3c112e684cc363d8ec5df (diff)
#96723#: delete ViewFactories on exit
Diffstat (limited to 'sfx2/source/doc/docfac.cxx')
-rw-r--r--sfx2/source/doc/docfac.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index 7d2f919e75f4..f2513a0aa183 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docfac.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: mba $ $Date: 2001-12-03 17:44:08 $
+ * last change: $Author: mba $ $Date: 2002-07-09 14:54:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,15 +97,18 @@
#include "doc.hrc"
//========================================================================
-
DECL_PTRARRAY( SfxViewFactoryArr_Impl, SfxViewFactory*, 2, 2 );
+typedef SfxViewFactory* SfxViewFactoryPtr;
+SV_DECL_PTRARR_DEL(SfxGlobalViewFactoryArr_Impl, SfxViewFactoryPtr, 2, 2);
+SV_IMPL_PTRARR(SfxGlobalViewFactoryArr_Impl, SfxViewFactoryPtr);
//========================================================================
DBG_NAME(SfxObjectFactory);
TYPEINIT1(SfxObjectFactory,SvFactory);
static SfxObjectFactoryArr_Impl* pObjFac = 0;
+static SfxGlobalViewFactoryArr_Impl* pViewFac = 0;
//========================================================================
@@ -339,12 +342,15 @@ SfxObjectFactory::~SfxObjectFactory()
void SfxObjectFactory::RemoveAll_Impl()
{
+ GetObjFacArray_Impl();
for( USHORT n=0; n<pObjFac->Count(); )
{
SfxObjectFactoryPtr pFac = pObjFac->GetObject(n);
pObjFac->Remove( n );
delete pFac;
}
+
+ DELETEZ( pViewFac );
}
//--------------------------------------------------------------------
@@ -360,7 +366,14 @@ void SfxObjectFactory::RegisterViewFactory
pImpl->aViewFactoryArr[nPos]->GetOrdinal() <= rFactory.GetOrdinal();
++nPos )
/* empty loop */;
- pImpl->aViewFactoryArr.Insert(nPos, &rFactory);
+ SfxViewFactoryPtr pFact = &rFactory;
+ pImpl->aViewFactoryArr.Insert( nPos, pFact );
+
+ if ( !pViewFac )
+ pViewFac = new SfxGlobalViewFactoryArr_Impl;
+
+ if ( !pViewFac->GetPos( pFact ) )
+ pViewFac->Insert( pFact, nPos );
}
//--------------------------------------------------------------------
@@ -638,7 +651,7 @@ sal_Bool SfxObjectFactory::HasObjectFactories()
return ( GetObjFacArray_Impl().Count() != 0 );
}
-SfxObjectFactoryArr_Impl& SfxObjectFactory::GetObjFacArray_Impl()
+SfxObjectFactoryArr_Impl& SfxObjectFactory::GetObjFacArray_Impl()
{
if ( !pObjFac )
pObjFac = new SfxObjectFactoryArr_Impl;