Kaydet (Commit) 55664c9b authored tarafından Thomas Arnhold's avatar Thomas Arnhold Kaydeden (comit) Miklos Vajna

unotools: remove some unused items

Change-Id: I95bcac6a3ff8cf4644c9d1596c75cac2d9cd94fe
Reviewed-on: https://gerrit.libreoffice.org/3191Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst aeb7683a
...@@ -3694,21 +3694,6 @@ ...@@ -3694,21 +3694,6 @@
</group> </group>
</group> </group>
</group> </group>
<group oor:name="WorkingSet">
<info>
<deprecated/>
<desc>Lists open documents or windows.</desc>
</info>
<prop oor:name="WindowList" oor:type="oor:string-list">
<!-- OldPath: SavedWorkingSet -->
<!-- OldLocation: soffice.ini -->
<!-- UIHints: Tools Options - General Save -->
<info>
<deprecated/>
<desc>Lists open documents or windows.</desc>
</info>
</prop>
</group>
<group oor:name="AddXMLToStorage"> <group oor:name="AddXMLToStorage">
<info> <info>
<desc>Contains settings specifying if a XML package is added to the <desc>Contains settings specifying if a XML package is added to the
......
...@@ -113,7 +113,6 @@ ...@@ -113,7 +113,6 @@
#include <unotools/securityoptions.hxx> #include <unotools/securityoptions.hxx>
#include <unotools/localisationoptions.hxx> #include <unotools/localisationoptions.hxx>
#include <unotools/fontoptions.hxx> #include <unotools/fontoptions.hxx>
#include <unotools/workingsetoptions.hxx>
#include <unotools/syslocaleoptions.hxx> #include <unotools/syslocaleoptions.hxx>
#include <unotools/syslocale.hxx> #include <unotools/syslocale.hxx>
#include <framework/addonsoptions.hxx> #include <framework/addonsoptions.hxx>
......
...@@ -71,7 +71,6 @@ $(eval $(call gb_Library_use_libraries,utl,\ ...@@ -71,7 +71,6 @@ $(eval $(call gb_Library_use_libraries,utl,\
$(eval $(call gb_Library_add_exception_objects,utl,\ $(eval $(call gb_Library_add_exception_objects,utl,\
unotools/source/accessibility/accessiblerelationsethelper \ unotools/source/accessibility/accessiblerelationsethelper \
unotools/source/accessibility/accessiblestatesethelper \ unotools/source/accessibility/accessiblestatesethelper \
unotools/source/config/accelcfg \
unotools/source/config/bootstrap \ unotools/source/config/bootstrap \
unotools/source/config/cmdoptions \ unotools/source/config/cmdoptions \
unotools/source/config/compatibility \ unotools/source/config/compatibility \
...@@ -104,7 +103,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\ ...@@ -104,7 +103,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
unotools/source/config/syslocaleoptions \ unotools/source/config/syslocaleoptions \
unotools/source/config/useroptions \ unotools/source/config/useroptions \
unotools/source/config/viewoptions \ unotools/source/config/viewoptions \
unotools/source/config/workingsetoptions \
unotools/source/config/xmlaccelcfg \ unotools/source/config/xmlaccelcfg \
unotools/source/i18n/calendarwrapper \ unotools/source/i18n/calendarwrapper \
unotools/source/i18n/caserotate \ unotools/source/i18n/caserotate \
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
$(eval $(call gb_Package_Package,unotools_inc,$(SRCDIR)/unotools/inc)) $(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/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/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/atom.hxx,unotools/atom.hxx))
...@@ -96,7 +95,6 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbstreamhelper.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/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/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/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)) $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/xmlaccelcfg.hxx,unotools/xmlaccelcfg.hxx))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
/* -*- 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: */
...@@ -33,7 +33,6 @@ struct ItemHolderMutexBase ...@@ -33,7 +33,6 @@ struct ItemHolderMutexBase
enum EItem enum EItem
{ {
E_ACCELCFG , //
E_ACCESSIBILITYOPTIONS , // 2 E_ACCESSIBILITYOPTIONS , // 2
E_ADDXMLTOSTORAGEOPTIONS , // E_ADDXMLTOSTORAGEOPTIONS , //
E_APEARCFG , // 2 E_APEARCFG , // 2
...@@ -57,8 +56,6 @@ enum EItem ...@@ -57,8 +56,6 @@ enum EItem
E_HELPOPTIONS , // 2 E_HELPOPTIONS , // 2
E_HISTORYOPTIONS , // E_HISTORYOPTIONS , //
E_JAVAOPTIONS , //
E_LANGUAGEOPTIONS , // 2 E_LANGUAGEOPTIONS , // 2
E_LINGUCFG , // E_LINGUCFG , //
E_LOCALISATIONOPTIONS , // E_LOCALISATIONOPTIONS , //
...@@ -87,11 +84,7 @@ enum EItem ...@@ -87,11 +84,7 @@ enum EItem
E_VIEWOPTIONS_DIALOG , // E_VIEWOPTIONS_DIALOG , //
E_VIEWOPTIONS_TABDIALOG , // E_VIEWOPTIONS_TABDIALOG , //
E_VIEWOPTIONS_TABPAGE , // E_VIEWOPTIONS_TABPAGE , //
E_VIEWOPTIONS_WINDOW , // E_VIEWOPTIONS_WINDOW //
E_WORKINGSETOPTIONS , //
E_XMLACCELCFG //
}; };
struct TItemInfo struct TItemInfo
......
/* -*- 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: */
...@@ -23,7 +23,16 @@ ...@@ -23,7 +23,16 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <cppuhelper/weak.hxx> #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, class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
public ::cppu::OWeakObject public ::cppu::OWeakObject
......
/* -*- 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: */
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <unotools/misccfg.hxx> #include <unotools/misccfg.hxx>
#include <unotools/useroptions.hxx> #include <unotools/useroptions.hxx>
#include <unotools/accelcfg.hxx>
#include <unotools/cmdoptions.hxx> #include <unotools/cmdoptions.hxx>
#include <unotools/compatibility.hxx> #include <unotools/compatibility.hxx>
#include <unotools/defaultoptions.hxx> #include <unotools/defaultoptions.hxx>
...@@ -46,7 +45,6 @@ ...@@ -46,7 +45,6 @@
#include <unotools/searchopt.hxx> #include <unotools/searchopt.hxx>
#include <unotools/securityoptions.hxx> #include <unotools/securityoptions.hxx>
#include <unotools/viewoptions.hxx> #include <unotools/viewoptions.hxx>
#include <unotools/workingsetoptions.hxx>
#include <unotools/xmlaccelcfg.hxx> #include <unotools/xmlaccelcfg.hxx>
#include <unotools/options.hxx> #include <unotools/options.hxx>
#include <unotools/syslocaleoptions.hxx> #include <unotools/syslocaleoptions.hxx>
...@@ -146,10 +144,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) ...@@ -146,10 +144,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
{ {
switch(rItem.eItem) switch(rItem.eItem)
{ {
case E_ACCELCFG :
rItem.pItem = new SvtAcceleratorConfiguration();
break;
case E_CMDOPTIONS : case E_CMDOPTIONS :
rItem.pItem = new SvtCommandOptions(); rItem.pItem = new SvtCommandOptions();
break; break;
...@@ -186,10 +180,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) ...@@ -186,10 +180,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
rItem.pItem = new SvtHistoryOptions(); rItem.pItem = new SvtHistoryOptions();
break; break;
case E_JAVAOPTIONS :
// no ref count rItem.pItem = new SvtJavaOptions();
break;
case E_LINGUCFG : case E_LINGUCFG :
rItem.pItem = new SvtLinguConfig(); rItem.pItem = new SvtLinguConfig();
break; break;
...@@ -246,14 +236,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) ...@@ -246,14 +236,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
rItem.pItem = new SvtViewOptions(E_WINDOW, ::rtl::OUString()); rItem.pItem = new SvtViewOptions(E_WINDOW, ::rtl::OUString());
break; break;
case E_WORKINGSETOPTIONS :
rItem.pItem = new SvtWorkingSetOptions();
break;
case E_XMLACCELCFG :
// ??? TODO
break;
case E_USEROPTIONS : case E_USEROPTIONS :
rItem.pItem = new SvtUserOptions(); rItem.pItem = new SvtUserOptions();
break; break;
......
/* -*- 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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment