[Libreoffice-commits] .: cui/source svtools/source svx/source unotools/inc unotools/Library_utl.mk unotools/Package_inc.mk unotools/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Thu Jan 26 11:58:44 PST 2012


 cui/source/options/optgdlg.cxx          |    1 
 cui/source/options/optmemory.cxx        |   76 +++-
 cui/source/options/optmemory.hxx        |    2 
 svtools/source/graphic/grfmgr.cxx       |   17 -
 svx/source/svdraw/svdetc.cxx            |    9 
 unotools/Library_utl.mk                 |    1 
 unotools/Package_inc.mk                 |    1 
 unotools/inc/unotools/cacheoptions.hxx  |  176 -----------
 unotools/source/config/cacheoptions.cxx |  493 --------------------------------
 unotools/source/config/itemholder1.cxx  |    1 
 10 files changed, 71 insertions(+), 706 deletions(-)

New commits:
commit d3e30409530a94470a3c19612663b26a9eafa683
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 26 20:56:06 2012 +0100

    Replace SvtCacheOptions with (simplified) direct configuration access.

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 25a45c6..fc1b0ad 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -41,7 +41,6 @@
 #include <i18npool/mslangid.hxx>
 #include <unotools/compatibility.hxx>
 #include <unotools/useroptions.hxx>
-#include <unotools/cacheoptions.hxx>
 #include <unotools/fontoptions.hxx>
 #include <svtools/menuoptions.hxx>
 #include <unotools/startoptions.hxx>
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index 9c5ed51..6146620 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -26,6 +26,12 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
+
+#include <algorithm>
+
+#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svtools/langtab.hxx>
 #include <svl/zforlist.hxx>
 #include <svtools/grfmgr.hxx>
@@ -39,7 +45,6 @@
 #include <rtl/math.hxx>
 #include <unotools/undoopt.hxx>
 #include <unotools/useroptions.hxx>
-#include <unotools/cacheoptions.hxx>
 #include <unotools/fontoptions.hxx>
 #include <svtools/menuoptions.hxx>
 #include <unotools/startoptions.hxx>
@@ -80,9 +85,9 @@ using namespace ::sfx2;
 #define BYTES2NF        (1.0/NF2BYTES)                  // 10/2^20
 
 
-inline long OfaMemoryOptionsPage::GetNfGraphicCacheVal( void ) const
+sal_Int32 OfaMemoryOptionsPage::GetNfGraphicCacheVal() const
 {
-    return static_cast<long>(aNfGraphicCache.GetValue() << 20);
+    return aNfGraphicCache.GetValue() << 20;
 }
 
 inline void OfaMemoryOptionsPage::SetNfGraphicCacheVal( long nSizeInBytes )
@@ -180,30 +185,45 @@ sal_Bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
 {
     sal_Bool bModified = sal_False;
 
-    SvtCacheOptions aCacheOptions;
-
     // Undo-Schritte
     if ( aUndoEdit.GetText() != aUndoEdit.GetSavedValue() )
         SvtUndoOptions().SetUndoCount((sal_uInt16)aUndoEdit.GetValue());
 
-    // GraphicCache
-    aCacheOptions.SetGraphicManagerTotalCacheSize( GetNfGraphicCacheVal() );
-    aCacheOptions.SetGraphicManagerObjectCacheSize( GetNfGraphicObjectCacheVal() );
+    boost::shared_ptr< unotools::ConfigurationChanges > batch(
+        unotools::ConfigurationChanges::create(
+            comphelper::getProcessComponentContext()));
 
-       const Time aTime( aTfGraphicObjectTime.GetTime() );
-    aCacheOptions.SetGraphicManagerObjectReleaseTime( aTime.GetSec() + aTime.GetMin() * 60 + aTime.GetHour() * 3600 );
+    // GraphicCache
+    sal_Int32 totalCacheSize = GetNfGraphicCacheVal();
+    officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(
+        comphelper::getProcessComponentContext(), batch, totalCacheSize);
+    sal_Int32 objectCacheSize = GetNfGraphicObjectCacheVal();
+    officecfg::Office::Common::Cache::GraphicManager::ObjectCacheSize::set(
+        comphelper::getProcessComponentContext(), batch, objectCacheSize);
+
+    const Time aTime( aTfGraphicObjectTime.GetTime() );
+    sal_Int32 objectReleaseTime =
+        aTime.GetSec() + aTime.GetMin() * 60 + aTime.GetHour() * 3600;
+    officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::set(
+        comphelper::getProcessComponentContext(), batch, objectReleaseTime);
 
     // create a dummy graphic object to get access to the common GraphicManager
     GraphicObject       aDummyObject;
     GraphicManager&     rGrfMgr = aDummyObject.GetGraphicManager();
 
-    rGrfMgr.SetMaxCacheSize( aCacheOptions.GetGraphicManagerTotalCacheSize() );
-    rGrfMgr.SetMaxObjCacheSize( aCacheOptions.GetGraphicManagerObjectCacheSize(), sal_True );
-    rGrfMgr.SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() );
+    rGrfMgr.SetMaxCacheSize(totalCacheSize);
+    rGrfMgr.SetMaxObjCacheSize(objectCacheSize, true);
+    rGrfMgr.SetCacheTimeout(objectReleaseTime);
 
     // OLECache
-    aCacheOptions.SetWriterOLE_Objects( static_cast<long>(aNfOLECache.GetValue()) );
-    aCacheOptions.SetDrawingEngineOLE_Objects( static_cast<long>(aNfOLECache.GetValue()) );
+    officecfg::Office::Common::Cache::Writer::OLE_Objects::set(
+        comphelper::getProcessComponentContext(), batch,
+        aNfOLECache.GetValue());
+    officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::set(
+        comphelper::getProcessComponentContext(), batch,
+        aNfOLECache.GetValue());
+
+    batch->commit();
 
     if( aQuickLaunchCB.IsChecked() != aQuickLaunchCB.GetSavedValue())
     {
@@ -218,7 +238,6 @@ sal_Bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
 
 void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet )
 {
-    SvtCacheOptions     aCacheOptions;
     const SfxPoolItem*  pItem;
 
     // Undo-Schritte
@@ -226,18 +245,31 @@ void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet )
     aUndoEdit.SaveValue();
 
     // GraphicCache
-    long    n = aCacheOptions.GetGraphicManagerTotalCacheSize();
+    long n =
+        officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::get(
+            comphelper::getProcessComponentContext());
     SetNfGraphicCacheVal( n );
-    SetNfGraphicObjectCacheVal( Min( static_cast<sal_Int32>(GetNfGraphicCacheVal()), aCacheOptions.GetGraphicManagerObjectCacheSize() ) );
-
-    sal_Int32 nTime = aCacheOptions.GetGraphicManagerObjectReleaseTime();
+    SetNfGraphicObjectCacheVal(
+        std::min(
+            GetNfGraphicCacheVal(),
+            officecfg::Office::Common::Cache::GraphicManager::ObjectCacheSize::get(
+                comphelper::getProcessComponentContext())));
+
+    sal_Int32 nTime =
+        officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::get(
+            comphelper::getProcessComponentContext());
     Time aTime( (sal_uInt16)( nTime / 3600 ), (sal_uInt16)( ( nTime % 3600 ) / 60 ), (sal_uInt16)( ( nTime % 3600 ) % 60 ) );
     aTfGraphicObjectTime.SetTime( aTime );
 
     GraphicCacheConfigHdl( &aNfGraphicCache );
 
     // OLECache
-    aNfOLECache.SetValue( Max( aCacheOptions.GetWriterOLE_Objects(), aCacheOptions.GetDrawingEngineOLE_Objects() ) );
+    aNfOLECache.SetValue(
+        std::max(
+            officecfg::Office::Common::Cache::Writer::OLE_Objects::get(
+                comphelper::getProcessComponentContext()),
+            officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get(
+                comphelper::getProcessComponentContext())));
 
     SfxItemState eState = rSet.GetItemState( SID_ATTR_QUICKLAUNCHER, sal_False, &pItem );
     if ( SFX_ITEM_SET == eState )
@@ -256,7 +288,7 @@ void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet )
 
 IMPL_LINK( OfaMemoryOptionsPage, GraphicCacheConfigHdl, NumericField*, EMPTYARG )
 {
-    long    n = GetNfGraphicCacheVal();
+    sal_Int32 n = GetNfGraphicCacheVal();
     SetNfGraphicObjectCacheMax( n );
     SetNfGraphicObjectCacheLast( n );
 
diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx
index 6b9c110..1724b5e 100644
--- a/cui/source/options/optmemory.hxx
+++ b/cui/source/options/optmemory.hxx
@@ -66,7 +66,7 @@ private:
 
     DECL_LINK( GraphicCacheConfigHdl, NumericField* );
 
-    inline long         GetNfGraphicCacheVal( void ) const;                 // returns # of Bytes
+    sal_Int32 GetNfGraphicCacheVal() const; // returns # of Bytes
     inline void         SetNfGraphicCacheVal( long nSizeInBytes );
 
     long                GetNfGraphicObjectCacheVal( void ) const;           // returns # of Bytes
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 2c49975..8098e77 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -26,9 +26,12 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
 
 #include <algorithm>
 
+#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <tools/vcompat.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/localfilehelper.hxx>
@@ -38,7 +41,6 @@
 #include <vcl/metaact.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/salbtype.hxx>
-#include <unotools/cacheoptions.hxx>
 #include <svtools/grfmgr.hxx>
 
 #include <vcl/pdfextoutdevdata.hxx>
@@ -176,11 +178,14 @@ void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const rtl
             {
                 if( !mpGlobalMgr )
                 {
-                    SvtCacheOptions aCacheOptions;
-
-                    mpGlobalMgr = new GraphicManager( aCacheOptions.GetGraphicManagerTotalCacheSize(),
-                                                      aCacheOptions.GetGraphicManagerObjectCacheSize() );
-                    mpGlobalMgr->SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() );
+                    mpGlobalMgr = new GraphicManager(
+                        officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::get(
+                            comphelper::getProcessComponentContext()),
+                        officecfg::Office::Common::Cache::GraphicManager::ObjectCacheSize::get(
+                            comphelper::getProcessComponentContext()));
+                    mpGlobalMgr->SetCacheTimeout(
+                        officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::get(
+                            comphelper::getProcessComponentContext()));
                 }
 
                 mpMgr = mpGlobalMgr;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 0cc8aad..68406f6 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -26,9 +26,12 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
+
 #include "editeng/forbiddencharacterstable.hxx"
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
 #include <com/sun/star/embed/EmbedStates.hpp>
+#include "officecfg/Office/Common.hxx"
 #include <svx/svdetc.hxx>
 #include "svx/svditext.hxx"
 #include <svx/svdmodel.hxx>
@@ -41,7 +44,6 @@
 #include <vcl/bmpacc.hxx>
 #include <editeng/eeitem.hxx>
 #include <svl/itemset.hxx>
-#include <unotools/cacheoptions.hxx>
 #include <svl/whiter.hxx>
 #include "editeng/fontitem.hxx"
 #include <editeng/colritem.hxx>
@@ -106,9 +108,8 @@ const LocaleDataWrapper*    SdrGlobalData::GetLocaleData()
 OLEObjCache::OLEObjCache()
 :   Container( 0 )
 {
-    SvtCacheOptions aCacheOptions;
-
-    nSize = aCacheOptions.GetDrawingEngineOLE_Objects();
+    nSize = officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get(
+        comphelper::getProcessComponentContext());
     pTimer = new AutoTimer();
     Link aLink = LINK(this, OLEObjCache, UnloadCheckHdl);
 
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index 724acd3..687c8d3 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -74,7 +74,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
     unotools/source/accessibility/accessiblestatesethelper \
     unotools/source/config/accelcfg \
     unotools/source/config/bootstrap \
-    unotools/source/config/cacheoptions \
     unotools/source/config/cmdoptions \
     unotools/source/config/compatibility \
     unotools/source/config/configitem \
diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk
index 1a4abc7..1e54854 100644
--- a/unotools/Package_inc.mk
+++ b/unotools/Package_inc.mk
@@ -32,7 +32,6 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accessiblerelationse
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accessiblestatesethelper.hxx,unotools/accessiblestatesethelper.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/atom.hxx,unotools/atom.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/bootstrap.hxx,unotools/bootstrap.hxx))
-$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/cacheoptions.hxx,unotools/cacheoptions.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/calendarwrapper.hxx,unotools/calendarwrapper.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/caserotate.hxx,unotools/caserotate.hxx))
 $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/charclass.hxx,unotools/charclass.hxx))
diff --git a/unotools/inc/unotools/cacheoptions.hxx b/unotools/inc/unotools/cacheoptions.hxx
deleted file mode 100644
index 698a297..0000000
--- a/unotools/inc/unotools/cacheoptions.hxx
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_unotools_CACHEOPTIONS_HXX
-#define INCLUDED_unotools_CACHEOPTIONS_HXX
-
-//_________________________________________________________________________________________________________________
-//  includes
-//_________________________________________________________________________________________________________________
-
-#include "unotools/unotoolsdllapi.h"
-#include <sal/types.h>
-#include <osl/mutex.hxx>
-#include <rtl/ustring.hxx>
-
-//_________________________________________________________________________________________________________________
-//  forward declarations
-//_________________________________________________________________________________________________________________
-
-/*-************************************************************************************************************//**
-    @short          forward declaration to our private date container implementation
-    @descr          We use these class as internal member to support small memory requirements.
-                    You can create the container if it is neccessary. The class which use these mechanism
-                    is faster and smaller then a complete implementation!
-*//*-*************************************************************************************************************/
-
-class SvtCacheOptions_Impl;
-
-//_________________________________________________________________________________________________________________
-//  declarations
-//_________________________________________________________________________________________________________________
-
-/*-************************************************************************************************************//**
-    @short          collect informations about startup features
-    @descr          -
-
-    @implements     -
-    @base           -
-
-    @devstatus      ready to use
-*//*-*************************************************************************************************************/
-
-class UNOTOOLS_DLLPUBLIC SvtCacheOptions
-{
-    //-------------------------------------------------------------------------------------------------------------
-    //  public methods
-    //-------------------------------------------------------------------------------------------------------------
-
-    public:
-
-        //---------------------------------------------------------------------------------------------------------
-        //  constructor / destructor
-        //---------------------------------------------------------------------------------------------------------
-
-        /*-****************************************************************************************************//**
-            @short      standard constructor and destructor
-            @descr      This will initialize an instance with default values.
-                        We implement these class with a refcount mechanism! Every instance of this class increase it
-                        at create and decrease it at delete time - but all instances use the same data container!
-                        He is implemented as a static member ...
-
-            @seealso    member m_nRefCount
-            @seealso    member m_pDataContainer
-
-            @param      -
-            @return     -
-
-            @onerror    -
-        *//*-*****************************************************************************************************/
-
-         SvtCacheOptions();
-        ~SvtCacheOptions();
-
-        //---------------------------------------------------------------------------------------------------------
-        //  interface
-        //---------------------------------------------------------------------------------------------------------
-
-        /*-****************************************************************************************************//**
-            @short      interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..."
-            @descr      These options describe internal states to enable/disable features of installed office.
-
-                        GetWriterOLE_Objects()
-                        SetWriterOLE_Objects()              =>  set the number of Writer OLE objects to be cached
-
-                        GetDrawingEngineOLE_Objects()
-                        SetDrawingEngineOLE_Objects()       =>  set the number of DrawingEngine OLE objects to be cached
-
-                        GetGraphicManagerTotalCacheSize()
-                        SetGraphicManagerTotalCacheSize()   =>  set the maximum cache size used by GraphicManager to cache graphic objects
-
-                        GetGraphicManagerObjectCacheSize()
-                        SetGraphicManagerObjectCacheSize()  =>  set the maximum cache size for one GraphicObject to be cached by GraphicManager
-
-            @seealso    configuration package "org.openoffice.Office.Common/_3D-Engine"
-        *//*-*****************************************************************************************************/
-
-        sal_Int32   GetWriterOLE_Objects() const;
-        sal_Int32   GetDrawingEngineOLE_Objects() const;
-        sal_Int32   GetGraphicManagerTotalCacheSize() const;
-        sal_Int32   GetGraphicManagerObjectCacheSize() const;
-        sal_Int32   GetGraphicManagerObjectReleaseTime() const;
-
-        void        SetWriterOLE_Objects( sal_Int32 nObjects );
-        void        SetDrawingEngineOLE_Objects( sal_Int32 nObjects );
-        void        SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize );
-        void        SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize );
-        void        SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds );
-
-    //-------------------------------------------------------------------------------------------------------------
-    //  private methods
-    //-------------------------------------------------------------------------------------------------------------
-
-    private:
-
-        /*-****************************************************************************************************//**
-            @short      return a reference to a static mutex
-            @descr      These class use his own static mutex to be threadsafe.
-                        We create a static mutex only for one ime and use at different times.
-
-            @seealso    -
-
-            @param      -
-            @return     A reference to a static mutex member.
-
-            @onerror    -
-        *//*-*****************************************************************************************************/
-
-        UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
-
-    //-------------------------------------------------------------------------------------------------------------
-    //  private member
-    //-------------------------------------------------------------------------------------------------------------
-
-    private:
-
-        /*Attention
-
-            Don't initialize these static member in these header!
-            a) Double dfined symbols will be detected ...
-            b) and unresolved externals exist at linking time.
-            Do it in your source only.
-         */
-
-        static SvtCacheOptions_Impl*    m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
-        static sal_Int32                m_nRefCount         ;   /// internal ref count mechanism
-
-};
-
-#endif // #ifndef INCLUDED_unotools_CACHEOPTIONS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx
deleted file mode 100644
index 365bb24..0000000
--- a/unotools/source/config/cacheoptions.cxx
+++ /dev/null
@@ -1,493 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include <unotools/cacheoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <rtl/instance.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-//_________________________________________________________________________________________________________________
-//  namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl;
-using namespace ::rtl;
-using namespace ::osl;
-using namespace ::com::sun::star::uno;
-
-//_________________________________________________________________________________________________________________
-//  const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_START                      OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Cache"  ))
-#define DEFAULT_WRITEROLE                   20
-#define DEFAULT_DRAWINGOLE                  20
-#define DEFAULT_GRFMGR_TOTALSIZE            10000000
-#define DEFAULT_GRFMGR_OBJECTSIZE           2400000
-#define DEFAULT_GRFMGR_OBJECTRELEASE        600
-
-#define PROPERTYNAME_WRITEROLE              OUString(RTL_CONSTASCII_USTRINGPARAM("Writer/OLE_Objects"))
-#define PROPERTYNAME_DRAWINGOLE             OUString(RTL_CONSTASCII_USTRINGPARAM("DrawingEngine/OLE_Objects"))
-#define PROPERTYNAME_GRFMGR_TOTALSIZE       OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/TotalCacheSize"))
-#define PROPERTYNAME_GRFMGR_OBJECTSIZE      OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectCacheSize"))
-#define PROPERTYNAME_GRFMGR_OBJECTRELEASE   OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectReleaseTime"))
-
-#define PROPERTYHANDLE_WRITEROLE            0
-#define PROPERTYHANDLE_DRAWINGOLE           1
-#define PROPERTYHANDLE_GRFMGR_TOTALSIZE     2
-#define PROPERTYHANDLE_GRFMGR_OBJECTSIZE    3
-#define PROPERTYHANDLE_GRFMGR_OBJECTRELEASE 4
-
-#define PROPERTYCOUNT                       5
-
-class SvtCacheOptions_Impl : public ConfigItem
-{
-public:
-
-//---------------------------------------------------------------------------------------------------------
-//  constructor / destructor
-//---------------------------------------------------------------------------------------------------------
-
-     SvtCacheOptions_Impl();
-    ~SvtCacheOptions_Impl();
-
-//---------------------------------------------------------------------------------------------------------
-//  overloaded methods of baseclass
-//---------------------------------------------------------------------------------------------------------
-
-    virtual void    Commit();
-    virtual void    Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
-
-//---------------------------------------------------------------------------------------------------------
-//  public interface
-//---------------------------------------------------------------------------------------------------------
-
-    sal_Int32       GetWriterOLE_Objects() const;
-    sal_Int32       GetDrawingEngineOLE_Objects() const;
-    sal_Int32       GetGraphicManagerTotalCacheSize() const;
-    sal_Int32       GetGraphicManagerObjectCacheSize() const;
-    sal_Int32       GetGraphicManagerObjectReleaseTime() const;
-
-    void            SetWriterOLE_Objects( sal_Int32 nObjects );
-    void            SetDrawingEngineOLE_Objects( sal_Int32 nObjects );
-    void            SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize );
-    void            SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize );
-    void            SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds );
-
-//-------------------------------------------------------------------------------------------------------------
-//  private methods
-//-------------------------------------------------------------------------------------------------------------
-
-private:
-
-    static Sequence< OUString > impl_GetPropertyNames();
-
-//-------------------------------------------------------------------------------------------------------------
-//  private member
-//-------------------------------------------------------------------------------------------------------------
-
-private:
-
-        sal_Int32   mnWriterOLE;
-        sal_Int32   mnDrawingOLE;
-        sal_Int32   mnGrfMgrTotalSize;
-        sal_Int32   mnGrfMgrObjectSize;
-        sal_Int32   mnGrfMgrObjectRelease;
-};
-
-//_________________________________________________________________________________________________________________
-//  definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-//  constructor
-//*****************************************************************************************************************
-SvtCacheOptions_Impl::SvtCacheOptions_Impl() :
-    ConfigItem( ROOTNODE_START  ),
-    mnWriterOLE( DEFAULT_WRITEROLE ),
-    mnDrawingOLE( DEFAULT_DRAWINGOLE ),
-    mnGrfMgrTotalSize( DEFAULT_GRFMGR_TOTALSIZE ),
-    mnGrfMgrObjectSize( DEFAULT_GRFMGR_OBJECTSIZE ),
-    mnGrfMgrObjectRelease( DEFAULT_GRFMGR_OBJECTRELEASE )
-{
-    Sequence< OUString >    seqNames( impl_GetPropertyNames() );
-    Sequence< Any >         seqValues   = GetProperties( seqNames ) ;
-
-    DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtCacheOptions_Impl::SvtCacheOptions_Impl()\nI miss some values of configuration keys!\n" );
-
-    // Copy values from list in right order to ouer internal member.
-    sal_Int32 nPropertyCount = seqValues.getLength();
-    sal_Int32 nProperty = 0;
-
-    for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
-    {
-        if( seqValues[ nProperty ].hasValue() )
-        {
-            switch( nProperty )
-            {
-                case PROPERTYHANDLE_WRITEROLE:
-                {
-                    if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
-                        seqValues[nProperty] >>= mnWriterOLE;
-                }
-                break;
-
-                case PROPERTYHANDLE_DRAWINGOLE:
-                {
-                    if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
-                        seqValues[nProperty] >>= mnDrawingOLE;
-                }
-                break;
-
-                case PROPERTYHANDLE_GRFMGR_TOTALSIZE:
-                {
-                    if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
-                        seqValues[nProperty] >>= mnGrfMgrTotalSize;
-                }
-                break;
-
-                case PROPERTYHANDLE_GRFMGR_OBJECTSIZE:
-                {
-                    if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
-                        seqValues[nProperty] >>= mnGrfMgrObjectSize;
-                }
-                break;
-
-                case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE:
-                {
-                    if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
-                        seqValues[nProperty] >>= mnGrfMgrObjectRelease;
-                }
-                break;
-            }
-        }
-    }
-}
-
-//*****************************************************************************************************************
-//  destructor
-//*****************************************************************************************************************
-SvtCacheOptions_Impl::~SvtCacheOptions_Impl()
-{
-    if( IsModified() )
-        Commit();
-}
-
-//*****************************************************************************************************************
-//  Commit
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::Commit()
-{
-    Sequence< OUString >    aSeqNames( impl_GetPropertyNames() );
-    Sequence< Any >         aSeqValues( aSeqNames.getLength() );
-
-    for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
-    {
-        switch( nProperty )
-        {
-            case PROPERTYHANDLE_WRITEROLE:
-                aSeqValues[nProperty] <<= mnWriterOLE;
-            break;
-
-            case PROPERTYHANDLE_DRAWINGOLE:
-                aSeqValues[nProperty] <<= mnDrawingOLE;
-            break;
-
-            case PROPERTYHANDLE_GRFMGR_TOTALSIZE:
-                aSeqValues[nProperty] <<= mnGrfMgrTotalSize;
-            break;
-
-            case PROPERTYHANDLE_GRFMGR_OBJECTSIZE:
-                aSeqValues[nProperty] <<= mnGrfMgrObjectSize;
-            break;
-
-            case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE:
-                aSeqValues[nProperty] <<= mnGrfMgrObjectRelease;
-            break;
-        }
-    }
-
-    PutProperties( aSeqNames, aSeqValues );
-}
-
-void SvtCacheOptions_Impl::Notify( const Sequence< rtl::OUString >&  )
-{
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetWriterOLE_Objects() const
-{
-    return mnWriterOLE;
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetDrawingEngineOLE_Objects() const
-{
-    return mnDrawingOLE;
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerTotalCacheSize() const
-{
-    return mnGrfMgrTotalSize;
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectCacheSize() const
-{
-    return mnGrfMgrObjectSize;
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectReleaseTime() const
-{
-    return mnGrfMgrObjectRelease;
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetWriterOLE_Objects( sal_Int32 nWriterOLE )
-{
-    mnWriterOLE = nWriterOLE;
-    SetModified();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE )
-{
-    mnDrawingOLE = nDrawingOLE;
-    SetModified();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize )
-{
-    mnGrfMgrTotalSize = nGrfMgrTotalSize;
-    SetModified();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize )
-{
-    mnGrfMgrObjectSize = nGrfMgrObjectSize;
-    SetModified();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime )
-{
-    mnGrfMgrObjectRelease = nGrfMgrObjectReleaseTime;
-    SetModified();
-}
-
-Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames()
-{
-    // Build list of configuration key names.
-    const OUString pProperties[] =
-    {
-        PROPERTYNAME_WRITEROLE,
-        PROPERTYNAME_DRAWINGOLE,
-        PROPERTYNAME_GRFMGR_TOTALSIZE,
-        PROPERTYNAME_GRFMGR_OBJECTSIZE,
-        PROPERTYNAME_GRFMGR_OBJECTRELEASE
-    };
-    // Initialize return sequence with these list ...
-    const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
-    // ... and return it.
-    return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-//  initialize static member
-//  DON'T DO IT IN YOUR HEADER!
-//  see definition for further informations
-//*****************************************************************************************************************
-SvtCacheOptions_Impl*   SvtCacheOptions::m_pDataContainer = NULL;
-sal_Int32               SvtCacheOptions::m_nRefCount = 0;
-
-//*****************************************************************************************************************
-//  constructor
-//*****************************************************************************************************************
-SvtCacheOptions::SvtCacheOptions()
-{
-    // Global access, must be guarded (multithreading!).
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    // Increase ouer refcount ...
-    ++m_nRefCount;
-    // ... and initialize ouer data container only if it not already!
-    if( m_pDataContainer == NULL )
-    {
-        m_pDataContainer = new SvtCacheOptions_Impl();
-    }
-}
-
-//*****************************************************************************************************************
-//  destructor
-//*****************************************************************************************************************
-SvtCacheOptions::~SvtCacheOptions()
-{
-    // Global access, must be guarded (multithreading!)
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    // Decrease ouer refcount.
-    --m_nRefCount;
-    // If last instance was deleted ...
-    // we must destroy ouer static data container!
-    if( m_nRefCount <= 0 )
-    {
-        delete m_pDataContainer;
-        m_pDataContainer = NULL;
-    }
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetWriterOLE_Objects() const
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    return m_pDataContainer->GetWriterOLE_Objects();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetDrawingEngineOLE_Objects() const
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    return m_pDataContainer->GetDrawingEngineOLE_Objects();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetGraphicManagerTotalCacheSize() const
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    return m_pDataContainer->GetGraphicManagerTotalCacheSize();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetGraphicManagerObjectCacheSize() const
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    return m_pDataContainer->GetGraphicManagerObjectCacheSize();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetGraphicManagerObjectReleaseTime() const
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    return m_pDataContainer->GetGraphicManagerObjectReleaseTime();
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetWriterOLE_Objects( sal_Int32 nWriterOLE )
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    m_pDataContainer->SetWriterOLE_Objects( nWriterOLE );
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE )
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    m_pDataContainer->SetDrawingEngineOLE_Objects( nDrawingOLE );
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize )
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    m_pDataContainer->SetGraphicManagerTotalCacheSize( nGrfMgrTotalSize );
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize )
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    m_pDataContainer->SetGraphicManagerObjectCacheSize( nGrfMgrObjectSize );
-}
-
-//*****************************************************************************************************************
-//  public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime )
-{
-    MutexGuard aGuard( GetOwnStaticMutex() );
-    m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime );
-}
-
-namespace
-{
-    class theCacheOptionsMutex : public rtl::Static<osl::Mutex, theCacheOptionsMutex>{};
-}
-
-//*****************************************************************************************************************
-//  private method
-//*****************************************************************************************************************
-Mutex& SvtCacheOptions::GetOwnStaticMutex()
-{
-    return theCacheOptionsMutex::get();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index fcc803e..5df8afc 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -38,7 +38,6 @@
 #include <unotools/undoopt.hxx>
 #include <unotools/useroptions.hxx>
 #include <unotools/accelcfg.hxx>
-#include <unotools/cacheoptions.hxx>
 #include <unotools/cmdoptions.hxx>
 #include <unotools/compatibility.hxx>
 #include <unotools/defaultoptions.hxx>


More information about the Libreoffice-commits mailing list