diff options
author | Christian Lippka <cl@openoffice.org> | 2001-11-05 13:02:01 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-11-05 13:02:01 +0000 |
commit | e48b0869a8257cea501f19ef2276f0aba72a1991 (patch) | |
tree | 9feaf66ec31049f0d311f5233e37bdc6ebb26fce | |
parent | 04bc41b648d7ae5de35cb209afd4d2bdca8b8b58 (diff) |
#90330# added a cache for outliners that are used by the api
-rw-r--r-- | svx/source/svdraw/makefile.mk | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 47 | ||||
-rw-r--r-- | svx/source/svdraw/svdoutlinercache.cxx | 138 |
3 files changed, 168 insertions, 23 deletions
diff --git a/svx/source/svdraw/makefile.mk b/svx/source/svdraw/makefile.mk index d5012a362d07..74e164070080 100644 --- a/svx/source/svdraw/makefile.mk +++ b/svx/source/svdraw/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: thb $ $Date: 2001-07-11 10:15:22 $ +# last change: $Author: cl $ $Date: 2001-11-05 14:02:01 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -74,6 +74,7 @@ AUTOSEG=true # --- Files -------------------------------------------------------- SLOFILES=\ + $(SLO)$/svdoutlinercache.obj \ $(SLO)$/dialdll.obj \ $(SLO)$/gradtrns.obj \ $(SLO)$/svdattr.obj \ @@ -140,6 +141,7 @@ SLOFILES=\ $(SLO)$/svdxcgv.obj SVXLIGHTOBJFILES=\ + $(OBJ)$/svdoutlinercache.obj \ $(OBJ)$/dialdll.obj \ $(OBJ)$/gradtrns.obj \ $(OBJ)$/svdattr.obj \ diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index fc3d58c3ee7e..d21a1ba3dfe9 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -2,9 +2,9 @@ * * $RCSfile: svdmodel.cxx,v $ * - * $Revision: 1.38 $ + * $Revision: 1.39 $ * - * last change: $Author: dl $ $Date: 2001-10-24 07:07:21 $ + * last change: $Author: cl $ $Date: 2001-11-05 14:02:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,7 @@ #include "svdoole2.hxx" #include "svdglob.hxx" // Stringcache #include "svdstr.hrc" // Objektname +#include "svdoutlinercache.hxx" #include <eeitemid.hxx> @@ -169,32 +170,13 @@ SdrModelInfo::SdrModelInfo(FASTBOOL bInit): aLastReadDate(Date(0),Time(0)), aLastPrintDate(Date(0),Time(0)), eCreationCharSet(RTL_TEXTENCODING_DONTKNOW), - /* old SV-stuff, there is no possibility to determine this informations in another way - eCreationGUI(GUI_DONTKNOW), - eCreationCPU(CPU_DONTKNOW), - eCreationSys(SYSTEM_DONTKNOW), - */ eLastWriteCharSet(RTL_TEXTENCODING_DONTKNOW), - /* old SV-stuff, there is no possibility to determine this informations in another way - eLastWriteGUI(GUI_DONTKNOW), - eLastWriteCPU(CPU_DONTKNOW), - eLastWriteSys(SYSTEM_DONTKNOW), - */ eLastReadCharSet(RTL_TEXTENCODING_DONTKNOW) - /* old SV-stuff, there is no possibility to determine this informations in another way - eLastReadGUI(GUI_DONTKNOW), - eLastReadCPU(CPU_DONTKNOW), - eLastReadSys(SYSTEM_DONTKNOW) - */ { if (bInit) { aCreationDate = DateTime(); eCreationCharSet = gsl_getSystemTextEncoding(); - /* old SV-stuff, there is no possibility to determine this informations in another way - eCreationGUI=System::GetGUIType(); - eCreationSys=System::GetSystemType(); - */ } } @@ -379,6 +361,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, SvPersist* pPers, pModelStorage = NULL; mpForbiddenCharactersTable = NULL; mbModelLocked = FALSE; + mpOutlinerCache = NULL; #ifndef SVX_LIGHT SvxAsianConfig aAsian; @@ -494,6 +477,8 @@ SdrModel::~SdrModel() DBG_DTOR(SdrModel,NULL); Broadcast(SdrHint(HINT_MODELCLEARED)); + delete mpOutlinerCache; + ClearUndoBuffer(); #ifdef DBG_UTIL if(pAktUndoGroup) @@ -2697,6 +2682,26 @@ FASTBOOL SdrModel::HasTransparentObjects( BOOL bCheckForAlphaChannel ) const return bRet; } +SdrOutliner* SdrModel::createOutliner( USHORT nOutlinerMode ) +{ + if( NULL == mpOutlinerCache ) + mpOutlinerCache = new SdrOutlinerCache(this); + + return mpOutlinerCache->createOutliner( nOutlinerMode ); +} + +void SdrModel::disposeOutliner( SdrOutliner* pOutliner ) +{ + if( mpOutlinerCache ) + { + mpOutlinerCache->disposeOutliner( pOutliner ); + } + else + { + delete pOutliner; + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrHint,SfxHint); diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx new file mode 100644 index 000000000000..6d73edc65f0d --- /dev/null +++ b/svx/source/svdraw/svdoutlinercache.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * $RCSfile: svdoutlinercache.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-11-05 14:02:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include "svdoutlinercache.hxx" +#include "svdoutl.hxx" +#include "svdmodel.hxx" + +extern SdrOutliner* SdrMakeOutliner( USHORT nOutlinerMode, SdrModel* pModel ); + +SdrOutlinerCache::SdrOutlinerCache( SdrModel* pModel ) +: mpModel( pModel ), + mpModeOutline( NULL ), + mpModeText( NULL ) +{ +} + +SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode ) +{ + SdrOutliner* pOutliner = NULL; + + if( (OUTLINERMODE_OUTLINEOBJECT == nOutlinerMode) && mpModeOutline ) + { + pOutliner = mpModeOutline; + mpModeOutline = NULL; + } + else if( (OUTLINERMODE_TEXTOBJECT == nOutlinerMode) && mpModeText ) + { + pOutliner = mpModeText; + mpModeText = NULL; + } + else + { + pOutliner = SdrMakeOutliner( nOutlinerMode, mpModel ); + Outliner& aDrawOutliner = mpModel->GetDrawOutliner(); + pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() ); + } + + return pOutliner; +} + +SdrOutlinerCache::~SdrOutlinerCache() +{ + if( mpModeOutline ) + { + delete mpModeOutline; + mpModeOutline = NULL; + } + + if( mpModeText ) + { + delete mpModeText; + mpModeText = NULL; + } +} + +void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner ) +{ + if( pOutliner ) + { + USHORT nOutlMode = pOutliner->GetOutlinerMode(); + + if( (OUTLINERMODE_OUTLINEOBJECT == nOutlMode) && (NULL == mpModeOutline) ) + { + mpModeOutline = pOutliner; + pOutliner->Clear(); + } + else if( (OUTLINERMODE_TEXTOBJECT == nOutlMode) && (NULL == mpModeText) ) + { + mpModeText = pOutliner; + pOutliner->Clear(); + } + else + { + delete pOutliner; + } + } +} + + |