diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2013-04-02 23:52:27 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-04-05 08:35:33 +0000 |
commit | 55664c9bd2469d3e493e6f1b67fbb2f96500d492 (patch) | |
tree | 43e97768980a42c01a9483f2382d9d7e6c302c7a /unotools | |
parent | aeb7683ae745717fe5e283b6ada065183aa730f4 (diff) |
unotools: remove some unused items
Change-Id: I95bcac6a3ff8cf4644c9d1596c75cac2d9cd94fe
Reviewed-on: https://gerrit.libreoffice.org/3191
Reviewed-by: Miklos Vajna <vmiklos@suse.cz>
Tested-by: Miklos Vajna <vmiklos@suse.cz>
Notes
Notes:
API CHANGE.
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/Library_utl.mk | 2 | ||||
-rw-r--r-- | unotools/Package_inc.mk | 2 | ||||
-rw-r--r-- | unotools/inc/unotools/accelcfg.hxx | 65 | ||||
-rw-r--r-- | unotools/inc/unotools/itemholderbase.hxx | 9 | ||||
-rw-r--r-- | unotools/inc/unotools/workingsetoptions.hxx | 122 | ||||
-rw-r--r-- | unotools/inc/unotools/xmlaccelcfg.hxx | 11 | ||||
-rw-r--r-- | unotools/source/config/accelcfg.cxx | 202 | ||||
-rw-r--r-- | unotools/source/config/itemholder1.cxx | 18 | ||||
-rw-r--r-- | unotools/source/config/workingsetoptions.cxx | 304 |
9 files changed, 11 insertions, 724 deletions
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk index d99c18bc562b..dcef7a82155a 100644 --- a/unotools/Library_utl.mk +++ b/unotools/Library_utl.mk @@ -71,7 +71,6 @@ $(eval $(call gb_Library_use_libraries,utl,\ $(eval $(call gb_Library_add_exception_objects,utl,\ unotools/source/accessibility/accessiblerelationsethelper \ unotools/source/accessibility/accessiblestatesethelper \ - unotools/source/config/accelcfg \ unotools/source/config/bootstrap \ unotools/source/config/cmdoptions \ unotools/source/config/compatibility \ @@ -104,7 +103,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\ unotools/source/config/syslocaleoptions \ unotools/source/config/useroptions \ unotools/source/config/viewoptions \ - unotools/source/config/workingsetoptions \ unotools/source/config/xmlaccelcfg \ unotools/source/i18n/calendarwrapper \ unotools/source/i18n/caserotate \ diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk index 92ec12ea1cd3..1a47ec10f902 100644 --- a/unotools/Package_inc.mk +++ b/unotools/Package_inc.mk @@ -27,7 +27,6 @@ $(eval $(call gb_Package_Package,unotools_inc,$(SRCDIR)/unotools/inc)) -$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accelcfg.hxx,unotools/accelcfg.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accessiblerelationsethelper.hxx,unotools/accessiblerelationsethelper.hxx)) $(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)) @@ -96,7 +95,6 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbstreamhelper.hxx, $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotoolsdllapi.h,unotools/unotoolsdllapi.h)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions.hxx,unotools/useroptions.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/viewoptions.hxx,unotools/viewoptions.hxx)) -$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/workingsetoptions.hxx,unotools/workingsetoptions.hxx)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/xmlaccelcfg.hxx,unotools/xmlaccelcfg.hxx)) # vim: set noet sw=4 ts=4: diff --git a/unotools/inc/unotools/accelcfg.hxx b/unotools/inc/unotools/accelcfg.hxx deleted file mode 100644 index c60a4f09de83..000000000000 --- a/unotools/inc/unotools/accelcfg.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_unotools_ACCELCFG_HXX -#define INCLUDED_unotools_ACCELCFG_HXX - -#include <com/sun/star/awt/KeyEvent.hpp> -#include <unotools/options.hxx> - -#include <rtl/ustring.hxx> -#include <tools/stream.hxx> - -struct SvtAcceleratorConfigItem -{ - sal_uInt16 nCode; - sal_uInt16 nModifier; - OUString aCommand; -}; - -#include <list> -typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList; - -class SvStream; -class KeyEvent; -class String; -class SvtAcceleratorConfig_Impl; - -class SvtAcceleratorConfiguration: public utl::detail::Options -{ - SvtAcceleratorConfig_Impl* pImp; - -private: - -public: - // get the global accelerators - SvtAcceleratorConfiguration(); - - // get special accelerators - static String GetStreamName(); - static SvStream* GetDefaultStream( StreamMode ); - - virtual ~SvtAcceleratorConfiguration(); - - // save the configuration to a stream, f.e. into a document - bool Commit( SvStream& rStream ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/inc/unotools/itemholderbase.hxx b/unotools/inc/unotools/itemholderbase.hxx index 2efc282284f4..831cba4a4a72 100644 --- a/unotools/inc/unotools/itemholderbase.hxx +++ b/unotools/inc/unotools/itemholderbase.hxx @@ -33,7 +33,6 @@ struct ItemHolderMutexBase enum EItem { - E_ACCELCFG , // E_ACCESSIBILITYOPTIONS , // 2 E_ADDXMLTOSTORAGEOPTIONS , // E_APEARCFG , // 2 @@ -57,8 +56,6 @@ enum EItem E_HELPOPTIONS , // 2 E_HISTORYOPTIONS , // - E_JAVAOPTIONS , // - E_LANGUAGEOPTIONS , // 2 E_LINGUCFG , // E_LOCALISATIONOPTIONS , // @@ -87,11 +84,7 @@ enum EItem E_VIEWOPTIONS_DIALOG , // E_VIEWOPTIONS_TABDIALOG , // E_VIEWOPTIONS_TABPAGE , // - E_VIEWOPTIONS_WINDOW , // - - E_WORKINGSETOPTIONS , // - - E_XMLACCELCFG // + E_VIEWOPTIONS_WINDOW // }; struct TItemInfo diff --git a/unotools/inc/unotools/workingsetoptions.hxx b/unotools/inc/unotools/workingsetoptions.hxx deleted file mode 100644 index c351da83f3ec..000000000000 --- a/unotools/inc/unotools/workingsetoptions.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX -#define INCLUDED_unotools_WORKINGSETOPTIONS_HXX - -#include <sal/types.h> -#include <osl/mutex.hxx> -#include <com/sun/star/uno/Sequence.h> -#include <rtl/ustring.hxx> -#include <unotools/options.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 SvtWorkingSetOptions_Impl; - -/*-************************************************************************************************************//** - @short collect information about security features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SAL_WARN_UNUSED SvtWorkingSetOptions : public utl::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // 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 - - *//*-*****************************************************************************************************/ - - SvtWorkingSetOptions(); - virtual ~SvtWorkingSetOptions(); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @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 - - *//*-*****************************************************************************************************/ - - 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 SvtWorkingSetOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtWorkingSetOptions - -#endif // #ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/inc/unotools/xmlaccelcfg.hxx b/unotools/inc/unotools/xmlaccelcfg.hxx index 8e2c6982e705..48417b2a229a 100644 --- a/unotools/inc/unotools/xmlaccelcfg.hxx +++ b/unotools/inc/unotools/xmlaccelcfg.hxx @@ -23,7 +23,16 @@ #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <cppuhelper/weak.hxx> -#include <unotools/accelcfg.hxx> +struct SvtAcceleratorConfigItem +{ + sal_uInt16 nCode; + sal_uInt16 nModifier; + OUString aCommand; +}; + +#include <list> +typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList; + class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler, public ::cppu::OWeakObject diff --git a/unotools/source/config/accelcfg.cxx b/unotools/source/config/accelcfg.cxx deleted file mode 100644 index 9c48b7f5e06e..000000000000 --- a/unotools/source/config/accelcfg.cxx +++ /dev/null @@ -1,202 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "rtl/instance.hxx" -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/xml/sax/Parser.hpp> -#include <com/sun/star/xml/sax/Writer.hpp> -#include <unotools/configmgr.hxx> -#include <unotools/configitem.hxx> - -#include <osl/mutex.hxx> -#include <tools/string.hxx> -#include <tools/urlobj.hxx> -#include <unotools/streamwrap.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <comphelper/processfactory.hxx> - -#include <unotools/accelcfg.hxx> -#include <unotools/xmlaccelcfg.hxx> -#include <unotools/pathoptions.hxx> -#include "itemholder1.hxx" - - -using namespace utl; -using namespace com::sun::star::uno; -using namespace com::sun::star::io; -using namespace com::sun::star::xml::sax; - -using ::rtl::OUString; - - -static SvtAcceleratorConfig_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -class SvtAcceleratorConfig_Impl -{ -public: - - SvtAcceleratorItemList aList; - bool bModified; - - SvtAcceleratorConfig_Impl() - : bModified( sal_False ) - {} - - SvtAcceleratorConfig_Impl( Reference< XInputStream >& xInputStream ); - bool Commit( Reference< XOutputStream >& xOutputStream ); -}; - -// ----------------------------------------------------------------------- - -SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >& rInputStream ) - : bModified( false ) -{ - Reference< XParser > xParser = Parser::create( ::comphelper::getProcessComponentContext() ); - - // connect stream to input stream to the parser - InputSource aInputSource; - aInputSource.aInputStream = rInputStream; - - // get filter - Reference< XDocumentHandler > xFilter( new OReadAccelatorDocumentHandler( aList )); - - // connect parser and filter - xParser->setDocumentHandler( xFilter ); - xParser->parseStream( aInputSource ); -} - -bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStream ) -{ - Reference< XWriter > xWriter = Writer::create( ::comphelper::getProcessComponentContext() ); - - xWriter->setOutputStream( rOutputStream ); - try - { - OWriteAccelatorDocumentHandler aWriteHandler( aList, Reference<XDocumentHandler>(xWriter, UNO_QUERY_THROW) ); - aWriteHandler.WriteAcceleratorDocument(); - rOutputStream->flush(); - return true; - } - catch ( RuntimeException& ) - { - } - catch ( SAXException& ) - { - } - catch ( ::com::sun::star::io::IOException& ) - { - } - - return false; -} - -namespace -{ - class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > - { - }; -} - -SvtAcceleratorConfiguration::SvtAcceleratorConfiguration() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !pOptions ) - { - SvStream* pStream = GetDefaultStream( STREAM_STD_READ ); - ::utl::OInputStreamWrapper aHelper( *pStream ); - com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper ); - - try - { - pOptions = new SvtAcceleratorConfig_Impl( xOut ); - } - catch ( RuntimeException& ) - { - pOptions = new SvtAcceleratorConfig_Impl(); - } - catch( SAXException& ) - { - pOptions = new SvtAcceleratorConfig_Impl(); - } - catch( ::com::sun::star::io::IOException& ) - { - pOptions = new SvtAcceleratorConfig_Impl(); - } - - if (pOptions) - ItemHolder1::holdConfigItem(E_ACCELCFG); - - delete pStream; - } - - ++nRefCount; - pImp = pOptions; -} - -// ----------------------------------------------------------------------- - -SvtAcceleratorConfiguration::~SvtAcceleratorConfiguration() -{ - if ( pImp == pOptions ) - { - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !--nRefCount ) - { - if ( pImp->bModified ) - { - String aUserConfig = SvtPathOptions().GetUserConfigPath(); - INetURLObject aObj( aUserConfig ); - aObj.insertName( rtl::OUString("GlobalKeyBindings.xml") ); - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READWRITE|STREAM_TRUNC ); - com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xOut( new utl::OOutputStreamWrapper( *pStream ) ); - pImp->Commit( xOut ); - delete pStream; - } - - DELETEZ( pOptions ); - } - } - else - { - delete pImp; - } -} - -String SvtAcceleratorConfiguration::GetStreamName() -{ - return rtl::OUString("KeyBindings.xml"); -} - -SvStream* SvtAcceleratorConfiguration::GetDefaultStream( StreamMode nMode ) -{ - String aUserConfig = SvtPathOptions().GetUserConfigPath(); - INetURLObject aObj( aUserConfig ); - aObj.insertName( GetStreamName() ); - return ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), nMode ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index 8d042453a6c0..8220c48ed28e 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -26,7 +26,6 @@ #include <unotools/misccfg.hxx> #include <unotools/useroptions.hxx> -#include <unotools/accelcfg.hxx> #include <unotools/cmdoptions.hxx> #include <unotools/compatibility.hxx> #include <unotools/defaultoptions.hxx> @@ -46,7 +45,6 @@ #include <unotools/searchopt.hxx> #include <unotools/securityoptions.hxx> #include <unotools/viewoptions.hxx> -#include <unotools/workingsetoptions.hxx> #include <unotools/xmlaccelcfg.hxx> #include <unotools/options.hxx> #include <unotools/syslocaleoptions.hxx> @@ -146,10 +144,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) { switch(rItem.eItem) { - case E_ACCELCFG : - rItem.pItem = new SvtAcceleratorConfiguration(); - break; - case E_CMDOPTIONS : rItem.pItem = new SvtCommandOptions(); break; @@ -186,10 +180,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtHistoryOptions(); break; - case E_JAVAOPTIONS : -// no ref count rItem.pItem = new SvtJavaOptions(); - break; - case E_LINGUCFG : rItem.pItem = new SvtLinguConfig(); break; @@ -246,14 +236,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtViewOptions(E_WINDOW, ::rtl::OUString()); break; - case E_WORKINGSETOPTIONS : - rItem.pItem = new SvtWorkingSetOptions(); - break; - - case E_XMLACCELCFG : - // ??? TODO - break; - case E_USEROPTIONS : rItem.pItem = new SvtUserOptions(); break; diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx deleted file mode 100644 index 0ea5c47bbcb5..000000000000 --- a/unotools/source/config/workingsetoptions.cxx +++ /dev/null @@ -1,304 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <unotools/workingsetoptions.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/configitem.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -#include <itemholder1.hxx> - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -#define ROOTNODE_WORKINGSET OUString("Office.Common/WorkingSet") -#define DEFAULT_WINDOWLIST Sequence< OUString >() - -#define PROPERTYNAME_WINDOWLIST OUString("WindowList") - -#define PROPERTYHANDLE_WINDOWLIST 0 - -#define PROPERTYCOUNT 1 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtWorkingSetOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtWorkingSetOptions_Impl(); - ~SvtWorkingSetOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - Sequence< OUString > m_seqWindowList ; -}; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_WORKINGSET ) - // Init member then. - , m_seqWindowList ( DEFAULT_WINDOWLIST ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = GetPropertyNames ( ); - Sequence< Any > seqValues = GetProperties ( seqNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_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(); - for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - // Safe impossible cases. - // Check any for valid value. - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nInvalid property value detected!\n" ); - switch( nProperty ) - { - case PROPERTYHANDLE_WINDOWLIST : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SEQUENCE), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nWho has changed the value type of \"Office.Common\\WorkingSet\\WindowList\"?" ); - seqValues[nProperty] >>= m_seqWindowList; - } - break; - } - } - - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - EnableNotification( seqNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtWorkingSetOptions_Impl::~SvtWorkingSetOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtWorkingSetOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) - { - if( seqPropertyNames[nProperty] == PROPERTYNAME_WINDOWLIST ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SEQUENCE), "SvtWorkingSetOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\WorkingSet\\WindowList\"?" ); - seqValues[nProperty] >>= m_seqWindowList; - } - #if OSL_DEBUG_LEVEL > 1 - else DBG_ASSERT( sal_False, "SvtWorkingSetOptions_Impl::Notify()\nUnknown property detected ... I can't handle these!\n" ); - #endif - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtWorkingSetOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = GetPropertyNames (); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_WINDOWLIST : { - seqValues[nProperty] <<= m_seqWindowList; - } - break; - } - } - // Set properties in configuration. - PutProperties( seqNames, seqValues ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames() -{ - // Build list of configuration key names. - const OUString pProperties[] = - { - PROPERTYNAME_WINDOWLIST , - }; - // 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 -//***************************************************************************************************************** -SvtWorkingSetOptions_Impl* SvtWorkingSetOptions::m_pDataContainer = NULL ; -sal_Int32 SvtWorkingSetOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtWorkingSetOptions::SvtWorkingSetOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtWorkingSetOptions_Impl; - ItemHolder1::holdConfigItem(E_WORKINGSETOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtWorkingSetOptions::~SvtWorkingSetOptions() -{ - // 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; - } -} - -namespace -{ - class theWorkingSetOptionsMutex : public rtl::Static<osl::Mutex, theWorkingSetOptionsMutex>{}; -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtWorkingSetOptions::GetOwnStaticMutex() -{ - return theWorkingSetOptionsMutex::get(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |