summaryrefslogtreecommitdiff
path: root/unotools/source/config
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/source/config')
-rw-r--r--unotools/source/config/accelcfg.cxx19
-rw-r--r--unotools/source/config/bootstrap.cxx92
-rw-r--r--unotools/source/config/cacheoptions.cxx43
-rw-r--r--unotools/source/config/cmdoptions.cxx44
-rw-r--r--unotools/source/config/compatibility.cxx71
-rw-r--r--unotools/source/config/configitem.cxx108
-rw-r--r--unotools/source/config/configmgr.cxx183
-rw-r--r--unotools/source/config/confignode.cxx38
-rw-r--r--unotools/source/config/configpathes.cxx5
-rw-r--r--unotools/source/config/configvaluecontainer.cxx69
-rw-r--r--unotools/source/config/defaultoptions.cxx8
-rw-r--r--unotools/source/config/docinfohelper.cxx54
-rw-r--r--unotools/source/config/dynamicmenuoptions.cxx37
-rw-r--r--unotools/source/config/eventcfg.cxx42
-rw-r--r--unotools/source/config/extendedsecurityoptions.cxx45
-rw-r--r--unotools/source/config/fltrcfg.cxx103
-rw-r--r--unotools/source/config/fontcfg.cxx86
-rw-r--r--unotools/source/config/fontoptions.cxx40
-rw-r--r--unotools/source/config/historyoptions.cxx60
-rw-r--r--unotools/source/config/inetoptions.cxx13
-rw-r--r--unotools/source/config/internaloptions.cxx124
-rw-r--r--unotools/source/config/itemholder1.cxx8
-rw-r--r--unotools/source/config/itemholder1.hxx3
-rw-r--r--unotools/source/config/javaoptions.cxx43
-rw-r--r--[-rwxr-xr-x]unotools/source/config/lingucfg.cxx173
-rw-r--r--unotools/source/config/localisationoptions.cxx47
-rw-r--r--unotools/source/config/misccfg.cxx83
-rw-r--r--unotools/source/config/moduleoptions.cxx155
-rw-r--r--unotools/source/config/options.cxx31
-rw-r--r--unotools/source/config/optionsdlg.cxx27
-rw-r--r--unotools/source/config/pathoptions.cxx135
-rw-r--r--unotools/source/config/printwarningoptions.cxx39
-rw-r--r--unotools/source/config/regoptions.cxx26
-rw-r--r--unotools/source/config/saveopt.cxx39
-rw-r--r--unotools/source/config/searchopt.cxx16
-rw-r--r--unotools/source/config/securityoptions.cxx36
-rw-r--r--unotools/source/config/sourceviewconfig.cxx38
-rw-r--r--unotools/source/config/startoptions.cxx39
-rw-r--r--[-rwxr-xr-x]unotools/source/config/syslocaleoptions.cxx41
-rw-r--r--unotools/source/config/undoopt.cxx14
-rw-r--r--unotools/source/config/useroptions.cxx153
-rw-r--r--unotools/source/config/viewoptions.cxx34
-rw-r--r--unotools/source/config/workingsetoptions.cxx39
-rw-r--r--unotools/source/config/xmlaccelcfg.cxx8
44 files changed, 976 insertions, 1535 deletions
diff --git a/unotools/source/config/accelcfg.cxx b/unotools/source/config/accelcfg.cxx
index d3f26de35304..c1748e3b411c 100644
--- a/unotools/source/config/accelcfg.cxx
+++ b/unotools/source/config/accelcfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,8 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
+
#include "rtl/instance.hxx"
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -54,11 +54,12 @@
using namespace utl;
-using namespace rtl;
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;
@@ -84,7 +85,7 @@ SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >&
: bModified( false )
{
Reference< XParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))),
UNO_QUERY);
// connect stream to input stream to the parser
@@ -104,7 +105,7 @@ bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStrea
Reference< XDocumentHandler > xWriter;
xWriter = Reference< XDocumentHandler >( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))), UNO_QUERY) ;
Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY );
xDataSource->setOutputStream( rOutputStream );
@@ -235,7 +236,7 @@ SvtAcceleratorConfiguration::~SvtAcceleratorConfiguration()
nCode = rKeyEvent.KeyFunc;
std::list< SvtAcceleratorConfigItem>::const_iterator p;
- for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ )
+ for ( p = pImp->aList.begin(); p != pImp->aList.end(); ++p )
if ( p->nCode == nCode && p->nModifier == nModifier )
return p->aCommand;
@@ -250,7 +251,7 @@ const SvtAcceleratorItemList& SvtAcceleratorConfiguration::GetItems()
void SvtAcceleratorConfiguration::SetCommand( const SvtAcceleratorConfigItem& rItem )
{
std::list< SvtAcceleratorConfigItem>::iterator p;
- for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ )
+ for ( p = pImp->aList.begin(); p != pImp->aList.end(); ++p )
if ( p->nCode == rItem.nCode && p->nModifier == rItem.nModifier )
{
p->aCommand = rItem.aCommand;
@@ -270,7 +271,7 @@ void SvtAcceleratorConfiguration::SetItems( const SvtAcceleratorItemList& rItems
else
{
std::list< SvtAcceleratorConfigItem>::const_iterator p;
- for ( p = rItems.begin(); p != rItems.end(); p++ )
+ for ( p = rItems.begin(); p != rItems.end(); ++p )
SetCommand( *p );
}
}
@@ -287,3 +288,5 @@ SvStream* SvtAcceleratorConfiguration::GetDefaultStream( StreamMode nMode )
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/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index b2e1bf1739f8..64555b2de877 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,6 +41,7 @@
#include <osl/diagnose.h>
// ---------------------------------------------------------------------------------------
#include <rtl/bootstrap.hxx>
+#include <rtl/instance.hxx>
#include <osl/process.h> // for osl_getExecutableFile
#include "tools/getprocessworkingdir.hxx"
@@ -51,6 +53,7 @@
#define BOOTSTRAP_DATA_NAME SAL_CONFIGFILE("bootstrap")
#define BOOTSTRAP_ITEM_PRODUCT_KEY "ProductKey"
+#define BOOTSTRAP_ITEM_PRODUCT_VERSION "OOOBaseVersion"
#define BOOTSTRAP_ITEM_PRODUCT_SOURCE "ProductSource"
#define BOOTSTRAP_ITEM_VERSIONFILE "Location"
#define BOOTSTRAP_ITEM_BUILDID "buildid"
@@ -85,9 +88,21 @@ namespace utl
// Implementation class: Bootstrap::Impl
// ---------------------------------------------------------------------------------------
+ namespace
+ {
+ rtl::OUString makeImplName()
+ {
+ rtl::OUString uri;
+ rtl::Bootstrap::get(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")),
+ uri);
+ return uri + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME));
+ }
+ }
+
class Bootstrap::Impl
{
- OUString const m_aImplName;
+ const OUString m_aImplName;
public: // struct to cache the result of a path lookup
struct PathData
{
@@ -114,14 +129,12 @@ namespace utl
Status status_;
public: // construction and initialization
- explicit
- Impl(OUString const& _aImplName)
- : m_aImplName(_aImplName)
+ Impl() : m_aImplName(makeImplName())
{
- status_ = initialize();
+ initialize();
}
- Status initialize();
+ void initialize();
// access helper
OUString getBootstrapValue(OUString const& _sName, OUString const& _sDefault) const;
@@ -133,36 +146,20 @@ namespace utl
bool initBaseInstallationData(rtl::Bootstrap& _rData);
bool initUserInstallationData(rtl::Bootstrap& _rData);
};
-// ---------------------------------------------------------------------------------------
- static OUString getExecutableDirectory();
-// ---------------------------------------------------------------------------------------
- static Bootstrap::Impl* s_pData = NULL;
-
- Bootstrap::Impl const& Bootstrap::data()
+ namespace
{
+ class theImpl : public rtl::Static<Bootstrap::Impl, theImpl> {};
+ }
- if (!s_pData)
- {
- using namespace osl;
- MutexGuard aGuard( Mutex::getGlobalMutex() );
-
- // static Impl s_theData(getExecutableDirectory() + OUString(RTL_CONSTASCII_USTRINGPARAM("/"BOOTSTRAP_DATA_NAME)));
- // s_pData = &s_theData;
- rtl::OUString uri;
- rtl::Bootstrap::get(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")), uri);
- s_pData = new Impl(uri + OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME)));
- }
- return *s_pData;
+ const Bootstrap::Impl& Bootstrap::data()
+ {
+ return theImpl::get();
}
void Bootstrap::reloadData()
{
- if (s_pData != NULL) {
- delete s_pData;
- s_pData = NULL;
- }
+ theImpl::get().initialize();
}
// ---------------------------------------------------------------------------------------
@@ -232,9 +229,9 @@ bool implNormalizeURL(OUString & _sURL, osl::DirectoryItem& aDirItem)
OSL_PRECOND(aDirItem.is(), "Opened DirItem required");
- static const sal_uInt32 cFileStatusMask = FileStatusMask_FileURL;
+ static const sal_uInt32 cosl_FileStatus_Mask = osl_FileStatus_Mask_FileURL;
- FileStatus aFileStatus(cFileStatusMask);
+ FileStatus aFileStatus(cosl_FileStatus_Mask);
if (aDirItem.getFileStatus(aFileStatus) != DirectoryItem::E_None)
return false;
@@ -260,7 +257,7 @@ bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !!
using osl::File;
OUString sBasePath;
- OSL_VERIFY(tools::getProcessWorkingDir(&sBasePath));
+ OSL_VERIFY(tools::getProcessWorkingDir(sBasePath));
OUString sAbsolute;
if ( File::E_None == File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
@@ -270,7 +267,7 @@ bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !!
}
else
{
- OSL_ENSURE(false, "Could not get absolute file URL for URL");
+ OSL_FAIL("Could not get absolute file URL for URL");
return false;
}
}
@@ -358,7 +355,7 @@ PathStatus checkStatusAndNormalizeURL(OUString & _sURL)
if (eStatus == Bootstrap::PATH_EXISTS)
{
if (!implNormalizeURL(_sURL,aDirItem))
- OSL_ENSURE(false,"Unexpected failure getting actual URL for existing object");
+ OSL_FAIL("Unexpected failure getting actual URL for existing object");
}
}
return eStatus;
@@ -400,7 +397,7 @@ PathStatus getDerivedPath(
OSL_ENSURE(sDerivedURL == _rURL,"Could not set derived URL via Bootstrap default parameter");
OSL_POSTCOND(RTL_BOOTSTRAP_DEFAULTS_BROKEN ||
- _rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL,"Use of default did not affect bootstrap value");
+ (_rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL),"Use of default did not affect bootstrap value");
}
else
{
@@ -651,6 +648,14 @@ OUString Bootstrap::getProductKey(OUString const& _sDefault)
}
// ---------------------------------------------------------------------------------------
+OUString Bootstrap::getProductVersion()
+{
+ // read OOOBaseVersion from version.ini (versionrc)
+ OUString sVersion;
+ data().getVersionValue( OUString( RTL_CONSTASCII_USTRINGPARAM( BOOTSTRAP_ITEM_PRODUCT_VERSION ) ), sVersion, OUString() );
+ return sVersion;
+}
+
OUString Bootstrap::getProductSource(OUString const& _sDefault)
{
OUString const csProductSourceItem(RTL_CONSTASCII_USTRINGPARAM(BOOTSTRAP_ITEM_PRODUCT_SOURCE));
@@ -674,6 +679,7 @@ OUString Bootstrap::getBuildIdData(OUString const& _sDefault)
sBuildId = data().getBootstrapValue( csBuildIdItem, _sDefault );
return sBuildId;
}
+
// ---------------------------------------------------------------------------------------
OUString Bootstrap::getAllUsersValue(OUString const& _sDefault)
@@ -840,19 +846,17 @@ bool Bootstrap::Impl::initUserInstallationData(rtl::Bootstrap& _rData)
}
// ---------------------------------------------------------------------------------------
-Bootstrap::Status Bootstrap::Impl::initialize()
+void Bootstrap::Impl::initialize()
{
- Bootstrap::Status result;
-
rtl::Bootstrap aData( m_aImplName );
if (!initBaseInstallationData(aData))
{
- result = INVALID_BASE_INSTALL;
+ status_ = INVALID_BASE_INSTALL;
}
else if (!initUserInstallationData(aData))
{
- result = INVALID_USER_INSTALL;
+ status_ = INVALID_USER_INSTALL;
if (aUserInstall_.status >= DATA_MISSING)
{
@@ -860,12 +864,12 @@ Bootstrap::Status Bootstrap::Impl::initialize()
{
case PATH_EXISTS:
case PATH_VALID:
- result = MISSING_USER_INSTALL;
+ status_ = MISSING_USER_INSTALL;
break;
case DATA_INVALID:
case DATA_MISSING:
- result = INVALID_BASE_INSTALL;
+ status_ = INVALID_BASE_INSTALL;
break;
default:
break;
@@ -874,9 +878,8 @@ Bootstrap::Status Bootstrap::Impl::initialize()
}
else
{
- result = DATA_OK;
+ status_ = DATA_OK;
}
- return result;
}
// ---------------------------------------------------------------------------------------
@@ -910,3 +913,4 @@ sal_Bool Bootstrap::Impl::getVersionValue(OUString const& _sName, OUString& _rVa
} // namespace utl
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx
index 2b2b612274ac..3e2ce0251970 100644
--- a/unotools/source/config/cacheoptions.cxx
+++ b/unotools/source/config/cacheoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,16 +28,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#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>
@@ -334,13 +330,10 @@ void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgr
SetModified();
}
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_WRITEROLE,
PROPERTYNAME_DRAWINGOLE,
@@ -349,7 +342,7 @@ Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames()
PROPERTYNAME_GRFMGR_OBJECTRELEASE
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
@@ -486,27 +479,17 @@ void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjec
m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime );
}
+namespace
+{
+ class theCacheOptionsMutex : public rtl::Static<osl::Mutex, theCacheOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtCacheOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theCacheOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx
index fd4fb07e7918..c110148c069f 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -41,11 +42,12 @@
#include <cppuhelper/weakref.hxx>
#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/instance.hxx>
#include <itemholder1.hxx>
#include <algorithm>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
//_________________________________________________________________________________________________________________
// namespaces
@@ -104,11 +106,6 @@ class SvtCmdOptions
return ( m_aCommandHashMap.size() > 0 );
}
- void SetContainerSize( sal_Int32 nSize )
- {
- m_aCommandHashMap.resize( nSize );
- }
-
sal_Bool Lookup( const OUString& aCmd ) const
{
CommandHashMap::const_iterator pEntry = m_aCommandHashMap.find( aCmd );
@@ -142,7 +139,7 @@ class SvtCmdOptions
}
private:
- class CommandHashMap : public ::std::hash_map< ::rtl::OUString ,
+ class CommandHashMap : public ::boost::unordered_map< ::rtl::OUString ,
sal_Int32 ,
OUStringHashCode ,
::std::equal_to< ::rtl::OUString > >
@@ -291,9 +288,6 @@ SvtCommandOptions_Impl::SvtCommandOptions_Impl()
sal_Int32 nItem = 0 ;
OUString sCmd ;
- // Set size of hash_map reach a used size of approx. 60%
- m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 );
-
// Get names/values for disabled commands.
for( nItem=0; nItem < lNames.getLength(); ++nItem )
{
@@ -342,9 +336,7 @@ void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& )
sal_Int32 nItem = 0 ;
OUString sCmd ;
- // Set size of hash_map reach a used size of approx. 60%
m_aDisabledCommands.Clear();
- m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 );
// Get names/values for disabled commands.
for( nItem=0; nItem < lNames.getLength(); ++nItem )
@@ -371,7 +363,7 @@ void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& )
//*****************************************************************************************************************
void SvtCommandOptions_Impl::Commit()
{
- DBG_ERROR( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" );
+ OSL_FAIL( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" );
}
//*****************************************************************************************************************
@@ -602,27 +594,17 @@ void SvtCommandOptions::EstablisFrameCallback(const ::com::sun::star::uno::Refer
m_pDataContainer->EstablisFrameCallback(xFrame);
}
+namespace
+{
+ class theCommandOptionsMutex : public rtl::Static<osl::Mutex, theCommandOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtCommandOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theCommandOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx
index 61ebe0211817..6a5087089490 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,13 +36,12 @@
#include <unotools/compatibility.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/configitem.hxx>
+#include <unotools/syslocale.hxx>
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#ifndef __SGI_STL_VECTOR
#include <vector>
-#endif
#include <itemholder1.hxx>
@@ -223,7 +223,7 @@ class SvtCompatibility
return lEntries.size();
}
- const SvtCompatibilityEntry& operator[]( int i )
+ const SvtCompatibilityEntry& operator[]( int i ) const
{
return lEntries[i];
}
@@ -247,6 +247,8 @@ class SvtCompatibilityOptions_Impl : public ConfigItem
SvtCompatibilityOptions_Impl();
~SvtCompatibilityOptions_Impl();
+ void SetDefault( OUString sName, bool bValue );
+
//---------------------------------------------------------------------------------------------------------
// overloaded methods of baseclass
//---------------------------------------------------------------------------------------------------------
@@ -425,6 +427,13 @@ SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl()
if ( !bDefaultFound && aItem.sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False )
{
+ SvtSysLocale aSysLocale;
+ com::sun::star::lang::Locale aLocale = aSysLocale.GetLocale();
+ if ( aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) ||
+ aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ja")) ||
+ aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ko")) )
+ aItem.bExpandWordSpace = false;
+
m_aDefOptions = aItem;
bDefaultFound = true;
}
@@ -443,6 +452,32 @@ SvtCompatibilityOptions_Impl::~SvtCompatibilityOptions_Impl()
}
}
+void SvtCompatibilityOptions_Impl::SetDefault( OUString sName, bool bValue )
+{
+ if ( COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS.equals( sName ) )
+ m_aDefOptions.SetUsePrtMetrics( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_ADDSPACING.equals( sName ) )
+ m_aDefOptions.SetAddSpacing( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES.equals( sName ) )
+ m_aDefOptions.SetAddSpacingAtPages( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS.equals( sName ) )
+ m_aDefOptions.SetUseOurTabStops( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_NOEXTLEADING.equals( sName ) )
+ m_aDefOptions.SetNoExtLeading( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_USELINESPACING.equals( sName ) )
+ m_aDefOptions.SetUseLineSpacing( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING.equals( sName ) )
+ m_aDefOptions.SetAddTableSpacing( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING.equals( sName ) )
+ m_aDefOptions.SetUseObjPos( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING.equals( sName ) )
+ m_aDefOptions.SetUseOurTextWrapping( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE.equals( sName ) )
+ m_aDefOptions.SetConsiderWrappingStyle( bValue );
+ else if ( COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE.equals( sName ) )
+ m_aDefOptions.SetExpandWordSpace( bValue );
+}
+
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
@@ -680,6 +715,11 @@ void SvtCompatibilityOptions::Clear()
m_pDataContainer->Clear();
}
+void SvtCompatibilityOptions::SetDefault( ::rtl::OUString sName, bool bValue )
+{
+ m_pDataContainer->SetDefault( sName, bValue );
+}
+
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
@@ -777,28 +817,17 @@ Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const
return m_pDataContainer->GetList();
}
+namespace
+{
+ class theCompatibilityOptionsMutex : public rtl::Static<osl::Mutex, theCompatibilityOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtCompatibilityOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theCompatibilityOptionsMutex::get();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index e191f471057a..0832b203ab2c 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -60,7 +61,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace com::sun::star::configuration;
-#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar))
#include <cppuhelper/implbase1.hxx> // helper for implementations
#ifdef DBG_UTIL
@@ -68,7 +69,7 @@ inline void lcl_CFG_DBG_EXCEPTION(const sal_Char* cText, const Exception& rEx)
{
OString sMsg(cText);
sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
#define CATCH_INFO(a) \
catch(Exception& rEx) \
@@ -105,9 +106,7 @@ namespace utl{
//XEventListener
virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
};
-/* -----------------------------12.02.01 11:38--------------------------------
- ---------------------------------------------------------------------------*/
struct ConfigItem_Impl
{
utl::ConfigManager* pManager;
@@ -125,9 +124,7 @@ struct ConfigItem_Impl
{}
};
}
-/* -----------------------------04.12.00 10:25--------------------------------
- ---------------------------------------------------------------------------*/
class ValueCounter_Impl
{
sal_Int16& rCnt;
@@ -141,9 +138,7 @@ public:
rCnt--;
}
};
-/* -----------------------------03.12.02 -------------------------------------
- ---------------------------------------------------------------------------*/
namespace
{
// helper to achieve exception - safe handling of an Item under construction
@@ -165,24 +160,18 @@ namespace
void keep() { m_pItem = 0; }
};
}
-/* -----------------------------29.08.00 16:34--------------------------------
- ---------------------------------------------------------------------------*/
ConfigChangeListener_Impl::ConfigChangeListener_Impl(
ConfigItem& rItem, const Sequence< OUString >& rNames) :
pParent(&rItem),
aPropertyNames(rNames)
{
}
-/* -----------------------------29.08.00 16:34--------------------------------
- ---------------------------------------------------------------------------*/
ConfigChangeListener_Impl::~ConfigChangeListener_Impl()
{
}
-/* -----------------------------29.08.00 16:34--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool lcl_Find(
const rtl::OUString& rTemp,
const OUString* pCheckPropertyNames,
@@ -224,23 +213,19 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th
}
}
-/* -----------------------------29.08.00 16:34--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) throw(RuntimeException)
{
pParent->RemoveChangesListener();
}
-/* -----------------------------29.08.00 12:50--------------------------------
- ---------------------------------------------------------------------------*/
-ConfigItem::ConfigItem(const OUString rSubTree, sal_Int16 nSetMode ) :
+ConfigItem::ConfigItem(const OUString &rSubTree, sal_Int16 nSetMode ) :
sSubTree(rSubTree),
pImpl(new ConfigItem_Impl)
{
AutoDeleter<ConfigItem_Impl> aNewImpl(pImpl);
- pImpl->pManager = ConfigManager::GetConfigManager();
+ pImpl->pManager = &ConfigManager::GetConfigManager();
pImpl->nMode = nSetMode;
if(0 != (nSetMode&CONFIG_MODE_RELEASE_TREE))
pImpl->pManager->AddConfigItem(*this);
@@ -251,9 +236,7 @@ ConfigItem::ConfigItem(const OUString rSubTree, sal_Int16 nSetMode ) :
aNewImpl.keep();
pImpl->nMode &= ~CONFIG_MODE_PROPAGATE_ERRORS;
}
-/* -----------------------------17.11.00 13:53--------------------------------
- ---------------------------------------------------------------------------*/
ConfigItem::ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTree) :
sSubTree(rSubTree),
pImpl(new ConfigItem_Impl)
@@ -262,16 +245,12 @@ ConfigItem::ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTr
pImpl->nMode = CONFIG_MODE_IMMEDIATE_UPDATE; // does not allow exceptions
m_xHierarchyAccess = pImpl->pManager->AddConfigItem(*this);
}
-//---------------------------------------------------------------------
-//--- 02.08.2002 16:33:23 -----------------------------------------------
+
sal_Bool ConfigItem::IsValidConfigMgr() const
{
return ( pImpl->pManager && pImpl->pManager->GetConfigurationProvider().is() );
}
-/* -----------------------------29.08.00 12:52--------------------------------
-
- ---------------------------------------------------------------------------*/
ConfigItem::~ConfigItem()
{
if(pImpl->pManager)
@@ -281,9 +260,7 @@ ConfigItem::~ConfigItem()
}
delete pImpl;
}
-/* -----------------------------29.08.00 12:52--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::ReleaseConfigMgr()
{
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
@@ -300,9 +277,7 @@ void ConfigItem::ReleaseConfigMgr()
OSL_ENSURE(pImpl->pManager, "ConfigManager already released");
pImpl->pManager = 0;
}
-/* -----------------------------29.08.00 12:52--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPropertyNames )
{
// the call is forwarded to the virtual Notify() method
@@ -312,9 +287,6 @@ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPro
Notify(rPropertyNames);
}
-/* -----------------------------12.12.00 17:09--------------------------------
-
- ---------------------------------------------------------------------------*/
sal_Bool lcl_IsLocalProperty(const OUString& rSubTree, const OUString& rProperty)
{
static const sal_Char* aLocalProperties[] =
@@ -337,9 +309,7 @@ sal_Bool lcl_IsLocalProperty(const OUString& rSubTree, const OUString& rProperty
return sal_False;
}
-/* -----------------------------10.04.01 15:00--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::impl_packLocalizedProperties( const Sequence< OUString >& lInNames ,
const Sequence< Any >& lInValues ,
Sequence< Any >& lOutValues )
@@ -411,9 +381,7 @@ void ConfigItem::impl_packLocalizedProperties( const Sequence< OUString >&
++nDestinationCounter;
}
}
-/* -----------------------------10.04.01 15:00--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::impl_unpackLocalizedProperties( const Sequence< OUString >& lInNames ,
const Sequence< Any >& lInValues ,
Sequence< OUString >& lOutNames ,
@@ -488,9 +456,7 @@ void ConfigItem::impl_unpackLocalizedProperties( const Sequence< OUString >
}
}
}
-/* -----------------------------03.02.2003 14:44------------------------------
- ---------------------------------------------------------------------------*/
Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Sequence< rtl::OUString >& rNames)
{
sal_Int32 i;
@@ -516,7 +482,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se
{
if(pImpl->pManager->IsLocalConfigProvider() && lcl_IsLocalProperty(sSubTree, rNames[i]))
{
- OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nlocal mode seams to be used!?\n");
+ OSL_FAIL("ConfigItem::IsReadonly()\nlocal mode seams to be used!?\n");
continue;
}
@@ -527,7 +493,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se
::utl::splitLastFromConfigurationPath(sName,sPath,sProperty);
if (!sPath.getLength() && !sProperty.getLength())
{
- OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nsplitt failed\n");
+ OSL_FAIL("ConfigItem::IsReadonly()\nsplitt failed\n");
continue;
}
@@ -539,7 +505,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se
Any aNode = xHierarchyAccess->getByHierarchicalName(sPath);
if (!(aNode >>= xNode) || !xNode.is())
{
- OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nno set available\n");
+ OSL_FAIL("ConfigItem::IsReadonly()\nno set available\n");
continue;
}
}
@@ -562,7 +528,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se
if (!xInfo.is())
{
- OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nno prop info available\n");
+ OSL_FAIL("ConfigItem::IsReadonly()\nno prop info available\n");
continue;
}
@@ -575,9 +541,6 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se
return lStates;
}
-/* -----------------------------29.08.00 15:10--------------------------------
-
- ---------------------------------------------------------------------------*/
Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
{
Sequence< Any > aRet(rNames.getLength());
@@ -618,7 +581,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
sMsg += OString(pNames[i].getStr(),
pNames[i].getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
#else
(void) rEx; // avoid warning
#endif
@@ -635,9 +598,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
}
return aRet;
}
-/* -----------------------------29.08.00 17:28--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames,
const Sequence< Any>& rValues)
{
@@ -721,17 +682,13 @@ sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames,
return bRet;
}
-/* -----------------------------08.12.05 15:27--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::DisableNotification()
{
OSL_ENSURE( xChangeLstnr.is(), "ConfigItem::DisableNotification: notifications not enabled currently!" );
RemoveChangesListener();
}
-/* -----------------------------29.08.00 16:19--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::EnableNotification(const Sequence< OUString >& rNames,
sal_Bool bEnableInternalNotification )
@@ -759,9 +716,7 @@ sal_Bool ConfigItem::EnableNotification(const Sequence< OUString >& rNames,
}
return bRet;
}
-/* -----------------------------29.08.00 16:47--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::RemoveChangesListener()
{
Reference<XChangesNotifier> xChgNot(m_xHierarchyAccess, UNO_QUERY);
@@ -777,9 +732,7 @@ void ConfigItem::RemoveChangesListener()
}
}
}
-/* -----------------------------10.07.00 --------------------------------
- ---------------------------------------------------------------------------*/
void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eFormat, Reference<XInterface> const& _xParentNode)
{
switch (_eFormat)
@@ -803,7 +756,7 @@ void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eF
break;
}
}
- OSL_ENSURE(false, "Cannot create absolute pathes: missing interface");
+ OSL_FAIL("Cannot create absolute pathes: missing interface");
// make local pathes instaed
case CONFIG_NAME_LOCAL_PATH:
@@ -854,18 +807,14 @@ void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eF
}
}
-/* -----------------------------10.07.00 --------------------------------
- ---------------------------------------------------------------------------*/
Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode)
{
ConfigNameFormat const eDefaultFormat = CONFIG_NAME_LOCAL_NAME; // CONFIG_NAME_DEFAULT;
return GetNodeNames(rNode, eDefaultFormat);
}
-/* -----------------------------15.09.00 12:06--------------------------------
- ---------------------------------------------------------------------------*/
Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode, ConfigNameFormat eFormat)
{
Sequence< OUString > aRet;
@@ -893,9 +842,7 @@ Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode, ConfigNameF
}
return aRet;
}
-/* -----------------------------15.09.00 15:52--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::ClearNodeSet(const OUString& rNode)
{
ValueCounter_Impl aCounter(pImpl->nInValueChange);
@@ -933,9 +880,7 @@ sal_Bool ConfigItem::ClearNodeSet(const OUString& rNode)
}
return bRet;
}
-/* -----------------------------24.11.00 10:58--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::ClearNodeElements(const OUString& rNode, Sequence< OUString >& rElements)
{
ValueCounter_Impl aCounter(pImpl->nInValueChange);
@@ -1007,9 +952,8 @@ Sequence< OUString > lcl_extractSetPropertyNames( const Sequence< PropertyValue
return aSubNodeNames;
}
-/* -----------------------------15.09.00 15:52--------------------------------
- add or change properties
- ---------------------------------------------------------------------------*/
+
+// Add or change properties
sal_Bool ConfigItem::SetSetProperties(
const OUString& rNode, Sequence< PropertyValue > rValues)
{
@@ -1108,9 +1052,7 @@ sal_Bool ConfigItem::SetSetProperties(
}
return bRet;
}
-/* -----------------------------15.09.00 15:52--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::ReplaceSetProperties(
const OUString& rNode, Sequence< PropertyValue > rValues)
{
@@ -1247,9 +1189,7 @@ sal_Bool ConfigItem::ReplaceSetProperties(
}
return bRet;
}
-/* -----------------------------07.05.01 12:15--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::getUniqueSetElementName( const ::rtl::OUString& _rSetNode, ::rtl::OUString& _rName)
{
::rtl::OUString sNewElementName;
@@ -1288,9 +1228,7 @@ sal_Bool ConfigItem::getUniqueSetElementName( const ::rtl::OUString& _rSetNode,
}
return bRet;
}
-/* -----------------------------23.01.01 12:49--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::AddNode(const rtl::OUString& rNode, const rtl::OUString& rNewNode)
{
ValueCounter_Impl aCounter(pImpl->nInValueChange);
@@ -1353,44 +1291,32 @@ sal_Bool ConfigItem::AddNode(const rtl::OUString& rNode, const rtl::OUString& rN
}
return bRet;
}
-/* -----------------------------12.02.01 11:38--------------------------------
- ---------------------------------------------------------------------------*/
sal_Int16 ConfigItem::GetMode() const
{
return pImpl->nMode;
}
-/* -----------------------------12.02.01 13:31--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::SetModified()
{
pImpl->bIsModified = sal_True;
}
-/* -----------------------------05.05.01 14:07--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::ClearModified()
{
pImpl->bIsModified = sal_False;
}
-/* -----------------------------12.02.01 13:31--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::IsModified() const
{
return pImpl->bIsModified;
}
-/* -----------------------------12.02.01 13:33--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigItem::IsInValueChange() const
{
return pImpl->nInValueChange > 0;
}
-/* -----------------------------21.06.01 12:26--------------------------------
- ---------------------------------------------------------------------------*/
Reference< XHierarchicalNameAccess> ConfigItem::GetTree()
{
Reference< XHierarchicalNameAccess> xRet;
@@ -1398,20 +1324,15 @@ Reference< XHierarchicalNameAccess> ConfigItem::GetTree()
xRet = pImpl->pManager->AcquireTree(*this);
else
xRet = m_xHierarchyAccess;
- OSL_ENSURE(xRet.is(), "AcquireTree failed");
return xRet;
}
-/* -----------------------------22.06.01 08:42--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::LockTree()
{
OSL_ENSURE(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "call LockTree in CONFIG_MODE_RELEASE_TREE mode, only");
m_xHierarchyAccess = GetTree();
}
-/* -----------------------------22.06.01 08:42--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigItem::UnlockTree()
{
OSL_ENSURE(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "call UnlockTree in CONFIG_MODE_RELEASE_TREE mode, only");
@@ -1420,3 +1341,4 @@ void ConfigItem::UnlockTree()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 0df6d49afe59..2ddc11340bc7 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,22 +46,26 @@
#include <list>
+#include <stdio.h>
+
//-----------------------------------------------------------------------------
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
-#define C2U(cChar) OUString::createFromAscii(cChar)
+using ::rtl::OUString;
+#if OSL_DEBUG_LEVEL > 0
+using ::rtl::OString;
+#endif
+
#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
//-----------------------------------------------------------------------------
-const char* cConfigBaseURL = "/org.openoffice.";
-//const char* cConfigBaseURL = "/com.sun.star.";
-const char* cAccessSrvc = "com.sun.star.configuration.ConfigurationUpdateAccess";
+const char* pConfigBaseURL = "/org.openoffice.";
+const char* pAccessSrvc = "com.sun.star.configuration.ConfigurationUpdateAccess";
namespace
{
@@ -101,35 +106,33 @@ struct utl::ConfigMgr_Impl
ConfigItemList aItemList;
};
-/* -----------------------------28.08.00 15:35--------------------------------
-
- ---------------------------------------------------------------------------*/
ConfigManager::ConfigManager() :
pMgrImpl(new utl::ConfigMgr_Impl)
{
GetConfigurationProvider(); // attempt to create the provider early
}
-/* -----------------------------17.11.00 13:51--------------------------------
- ---------------------------------------------------------------------------*/
ConfigManager::ConfigManager(Reference< XMultiServiceFactory > xConfigProv) :
xConfigurationProvider(xConfigProv),
pMgrImpl(new utl::ConfigMgr_Impl)
{
}
-/* -----------------------------28.08.00 15:35--------------------------------
- ---------------------------------------------------------------------------*/
ConfigManager::~ConfigManager()
{
//check list content -> should be empty!
+#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive");
+#endif
if(!pMgrImpl->aItemList.empty())
{
ConfigItemList::iterator aListIter;
for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
{
ConfigItemListEntry_Impl& rEntry = *aListIter;
+#if OSL_DEBUG_LEVEL > 0
+ fprintf(stderr, "Dangling config item of %s\n", rtl::OUStringToOString(rEntry.pConfigItem->GetSubTreeName(), RTL_TEXTENCODING_UTF8).getStr());
+#endif
rEntry.pConfigItem->ReleaseConfigMgr();
}
pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end());
@@ -137,9 +140,7 @@ ConfigManager::~ConfigManager()
delete pMgrImpl;
}
-/* -----------------------------28.08.00 16:17--------------------------------
- ---------------------------------------------------------------------------*/
Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
{
if(!xConfigurationProvider.is())
@@ -151,10 +152,10 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
{
xConfigurationProvider = Reference< XMultiServiceFactory >
(xMSF->createInstance(
- C2U("com.sun.star.configuration.ConfigurationProvider")),
+ UNISTRING("com.sun.star.configuration.ConfigurationProvider")),
UNO_QUERY);
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
catch(Exception& rEx)
{
static sal_Bool bMessage = sal_True;
@@ -165,7 +166,7 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
sMsg += OString(rEx.Message.getStr(),
rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
}
#else
@@ -175,9 +176,7 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
}
return xConfigurationProvider;
}
-/* -----------------------------03.12.02 -------------------------------------
- ---------------------------------------------------------------------------*/
namespace
{
// helper to achieve exception - safe registration of a ConfigItem under construction
@@ -201,16 +200,12 @@ namespace
void keep() { pCfgItem = 0; }
};
}
-/* -----------------------------12.12.00 17:19--------------------------------
- ---------------------------------------------------------------------------*/
Reference< XMultiServiceFactory > ConfigManager::GetLocalConfigurationProvider()
{
return GetConfigurationProvider();
}
-/* -----------------------------29.08.00 12:35--------------------------------
- ---------------------------------------------------------------------------*/
Reference< XHierarchicalNameAccess > ConfigManager::AddConfigItem(utl::ConfigItem& rCfgItem)
{
RegisterConfigItemHelper registeredItem(*this,rCfgItem);
@@ -218,30 +213,26 @@ Reference< XHierarchicalNameAccess > ConfigManager::AddConfigItem(utl::ConfigIte
registeredItem.keep();
return xTree;
}
-/* -----------------------------21.06.01 12:20--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigManager::RegisterConfigItem(utl::ConfigItem& rCfgItem)
{
ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
{
ConfigItemListEntry_Impl& rEntry = *aListIter;
if(rEntry.pConfigItem == &rCfgItem)
- OSL_ENSURE(sal_False, "RegisterConfigItem: already inserted!");
+ OSL_FAIL("RegisterConfigItem: already inserted!");
}
#endif
pMgrImpl->aItemList.insert(aListIter, ConfigItemListEntry_Impl(&rCfgItem));
}
-/* -----------------------------21.06.01 12:20--------------------------------
- ---------------------------------------------------------------------------*/
Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem& rCfgItem)
{
- ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
sal_Bool bFound = sal_False;
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
{
ConfigItemListEntry_Impl& rEntry = *aListIter;
@@ -253,17 +244,17 @@ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem&
}
OSL_ENSURE(bFound, "AcquireTree: ConfigItem unknown!");
#endif
- OUString sPath = C2U(cConfigBaseURL);
+ OUString sPath(OUString::createFromAscii(pConfigBaseURL));
sPath += rCfgItem.GetSubTreeName();
Sequence< Any > aArgs(2);
Any* pArgs = aArgs.getArray();
PropertyValue aPath;
- aPath.Name = C2U("nodepath");
+ aPath.Name = UNISTRING("nodepath");
aPath.Value <<= sPath;
pArgs[0] <<= aPath;
sal_Bool bLazy = 0 != (rCfgItem.GetMode()&CONFIG_MODE_DELAYED_UPDATE);
PropertyValue aUpdate;
- aUpdate.Name = C2U("lazywrite");
+ aUpdate.Name = UNISTRING("lazywrite");
aUpdate.Value.setValue(&bLazy, ::getBooleanCppuType());
pArgs[1] <<= aUpdate;
@@ -276,8 +267,8 @@ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem&
aArgs.realloc(nCount+1);
PropertyValue aAllLocale;
- aAllLocale.Name = C2U("locale");
- aAllLocale.Value <<= C2U("*" );
+ aAllLocale.Name = UNISTRING("locale");
+ aAllLocale.Value <<= UNISTRING("*" );
aArgs[nCount] <<= aAllLocale;
}
@@ -288,7 +279,7 @@ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem&
try
{
xIFace = xCfgProvider->createInstanceWithArguments(
- C2U(cAccessSrvc),
+ OUString::createFromAscii(pAccessSrvc),
aArgs);
}
catch(Exception& rEx)
@@ -300,23 +291,21 @@ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem&
throw;
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
if(0 == (CONFIG_MODE_IGNORE_ERRORS & rCfgItem.GetMode()))
{
OString sMsg("CreateInstance exception: ");
sMsg += OString(rEx.Message.getStr(),
rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
#endif
}
}
return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY);
}
-/* -----------------------------29.08.00 12:35--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem)
{
if( !pMgrImpl->aItemList.empty() )
@@ -333,9 +322,7 @@ void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem)
}
}
}
-/* -----------------------------30.08.00 15:04--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigManager::StoreConfigItems()
{
if(!pMgrImpl->aItemList.empty())
@@ -352,61 +339,37 @@ void ConfigManager::StoreConfigItems()
}
}
}
-ConfigManager* ConfigManager::pConfigManager = 0;
-/* -----------------------------07.09.00 11:06--------------------------------
- ---------------------------------------------------------------------------*/
-ConfigManager* ConfigManager::GetConfigManager()
-{
- if(!pConfigManager)
- {
- pConfigManager = new ConfigManager();
- }
- return pConfigManager;
-}
-/* -----------------------------07.09.00 11:06--------------------------------
+struct theConfigManager : public rtl::Static<ConfigManager, theConfigManager> {};
- ---------------------------------------------------------------------------*/
-void ConfigManager::RemoveConfigManager()
+ConfigManager& ConfigManager::GetConfigManager()
{
- if(pConfigManager)
- {
- delete pConfigManager;
- pConfigManager = 0;
- }
+ return theConfigManager::get();
}
-/* -----------------------------08.09.00 13:22--------------------------------
- ---------------------------------------------------------------------------*/
rtl::OUString ConfigManager::GetConfigBaseURL()
{
- return C2U(cConfigBaseURL);
+ return OUString::createFromAscii(pConfigBaseURL);
}
-/* -----------------------------25.09.00 16:34--------------------------------
- ---------------------------------------------------------------------------*/
Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
{
switch(eProp)
{
case INSTALLPATH:
- OSL_ENSURE( false,
- "ConfigManager::GetDirectConfigProperty: "
+ OSL_FAIL( "ConfigManager::GetDirectConfigProperty: "
"INSTALLPATH no longer supported." );
return Any();
case USERINSTALLURL:
- OSL_ENSURE( false,
- "ConfigManager::GetDirectConfigProperty: "
+ OSL_FAIL( "ConfigManager::GetDirectConfigProperty: "
"USERINSTALLURL no longer supported." );
return Any();
case OFFICEINSTALL:
- OSL_ENSURE( false,
- "ConfigManager::GetDirectConfigProperty: "
+ OSL_FAIL( "ConfigManager::GetDirectConfigProperty: "
"OFFICEINSTALL no longer supported." );
return Any();
case OFFICEINSTALLURL:
- OSL_ENSURE( false,
- "ConfigManager::GetDirectConfigProperty: "
+ OSL_FAIL( "ConfigManager::GetDirectConfigProperty: "
"OFFICEINSTALLURL no longer supported." );
return Any();
default:
@@ -414,6 +377,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
}
Any aRet;
+
::rtl::OUString &rBrandName = BrandName::get();
if ( eProp == PRODUCTNAME && rBrandName.getLength() )
{
@@ -480,9 +444,8 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
if (eProp == PRODUCTEXTENSION) {
rtl::OUString name(
- rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
- "${BRAND_BASE_DIR}/program/edition/edition.ini")));
+ "${BRAND_BASE_DIR}/program/edition/edition.ini"));
rtl::Bootstrap::expandMacros(name);
if (rtl::Bootstrap(name).getFrom(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EDITIONNAME")),
@@ -492,10 +455,10 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
}
}
- OUString sPath = C2U(cConfigBaseURL);
+ OUString sPath = OUString::createFromAscii(pConfigBaseURL);
switch(eProp)
{
- case LOCALE: sPath += C2U("Setup/L10N"); break;
+ case LOCALE: sPath += UNISTRING("Setup/L10N"); break;
case PRODUCTNAME:
case PRODUCTVERSION:
@@ -504,25 +467,25 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
case PRODUCTXMLFILEFORMATVERSION:
case OPENSOURCECONTEXT:
case OOOVENDOR:
- case ABOUTBOXPRODUCTVERSION: sPath += C2U("Setup/Product"); break;
+ case ABOUTBOXPRODUCTVERSION: sPath += UNISTRING("Setup/Product"); break;
- case DEFAULTCURRENCY: sPath += C2U("Setup/L10N"); break;
+ case DEFAULTCURRENCY: sPath += UNISTRING("Setup/L10N"); break;
case WRITERCOMPATIBILITYVERSIONOOO11:
- sPath += C2U("Office.Compatibility/WriterCompatibilityVersion"); break;
+ sPath += UNISTRING("Office.Compatibility/WriterCompatibilityVersion"); break;
default:
break;
}
Sequence< Any > aArgs(1);
aArgs[0] <<= sPath;
- Reference< XMultiServiceFactory > xCfgProvider = GetConfigManager()->GetConfigurationProvider();
+ Reference< XMultiServiceFactory > xCfgProvider = GetConfigManager().GetConfigurationProvider();
if(!xCfgProvider.is())
return aRet;
Reference< XInterface > xIFace;
try
{
xIFace = xCfgProvider->createInstanceWithArguments(
- C2U(cAccessSrvc),
+ OUString::createFromAscii(pAccessSrvc),
aArgs);
}
@@ -533,17 +496,17 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
OUString sProperty;
switch(eProp)
{
- case LOCALE: sProperty = C2U("ooLocale"); break;
- case PRODUCTNAME: sProperty = C2U("ooName"); break;
- case PRODUCTVERSION: sProperty = C2U("ooSetupVersion"); break;
- case ABOUTBOXPRODUCTVERSION: sProperty = C2U("ooSetupVersionAboutBox"); break;
- case OOOVENDOR: sProperty = C2U("ooVendor"); break;
- case PRODUCTEXTENSION: sProperty = C2U("ooSetupExtension"); break;
- case PRODUCTXMLFILEFORMATNAME: sProperty = C2U("ooXMLFileFormatName"); break;
- case PRODUCTXMLFILEFORMATVERSION: sProperty = C2U("ooXMLFileFormatVersion"); break;
- case OPENSOURCECONTEXT: sProperty = C2U("ooOpenSourceContext"); break;
- case DEFAULTCURRENCY: sProperty = C2U("ooSetupCurrency"); break;
- case WRITERCOMPATIBILITYVERSIONOOO11: sProperty = C2U("OOo11"); break;
+ case LOCALE: sProperty = UNISTRING("ooLocale"); break;
+ case PRODUCTNAME: sProperty = UNISTRING("ooName"); break;
+ case PRODUCTVERSION: sProperty = UNISTRING("ooSetupVersion"); break;
+ case ABOUTBOXPRODUCTVERSION: sProperty = UNISTRING("ooSetupVersionAboutBox"); break;
+ case OOOVENDOR: sProperty = UNISTRING("ooVendor"); break;
+ case PRODUCTEXTENSION: sProperty = UNISTRING("ooSetupExtension"); break;
+ case PRODUCTXMLFILEFORMATNAME: sProperty = UNISTRING("ooXMLFileFormatName"); break;
+ case PRODUCTXMLFILEFORMATVERSION: sProperty = UNISTRING("ooXMLFileFormatVersion"); break;
+ case OPENSOURCECONTEXT: sProperty = UNISTRING("ooOpenSourceContext"); break;
+ case DEFAULTCURRENCY: sProperty = UNISTRING("ooSetupCurrency"); break;
+ case WRITERCOMPATIBILITYVERSIONOOO11: sProperty = UNISTRING("OOo11"); break;
default:
break;
}
@@ -560,7 +523,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
aBuf.append( "\" under \"" );
aBuf.append( rtl::OUStringToOString( sPath, RTL_TEXTENCODING_ASCII_US ) );
aBuf.append( "\" (caught an exception)!" );
- OSL_ENSURE( sal_False, aBuf.getStr() );
+ OSL_FAIL( aBuf.getStr() );
#endif
}
}
@@ -641,9 +604,6 @@ void ConfigManager::getBasisAboutBoxProductVersion( OUString& rVersion )
}
}
-/* -----------------------------12.12.00 17:22--------------------------------
-
- ---------------------------------------------------------------------------*/
Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUString& rFullPath)
{
Sequence< Any > aArgs(1);
@@ -655,17 +615,17 @@ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUSt
try
{
xIFace = xCfgProvider->createInstanceWithArguments(
- C2U(cAccessSrvc),
+ OUString::createFromAscii(pAccessSrvc),
aArgs);
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
catch(Exception& rEx)
{
OString sMsg("CreateInstance exception: ");
sMsg += OString(rEx.Message.getStr(),
rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
#else
catch(Exception&){}
@@ -673,12 +633,10 @@ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUSt
}
return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY);
}
-/* -----------------------------12.12.00 17:17--------------------------------
- ---------------------------------------------------------------------------*/
Any ConfigManager::GetLocalProperty(const OUString& rProperty)
{
- OUString sPath = C2U(cConfigBaseURL);
+ OUString sPath(OUString::createFromAscii(pConfigBaseURL));
sPath += rProperty;
OUString sNode, sProperty;
@@ -691,26 +649,24 @@ Any ConfigManager::GetLocalProperty(const OUString& rProperty)
if(xAccess.is())
aRet = xAccess->getByName(sProperty);
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
catch(Exception& rEx)
{
OString sMsg("GetLocalProperty: ");
sMsg += OString(rEx.Message.getStr(),
rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
#else
catch(Exception&){}
#endif
return aRet;
}
-/* -----------------------------12.12.00 17:17--------------------------------
- ---------------------------------------------------------------------------*/
void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValue)
{
- OUString sPath = C2U(cConfigBaseURL);
+ OUString sPath(OUString::createFromAscii(pConfigBaseURL));
sPath += rProperty;
OUString sNode, sProperty;
@@ -723,25 +679,24 @@ void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValu
{
xNodeReplace->replaceByName(sProperty, rValue);
}
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
catch(Exception& rEx)
{
OString sMsg("PutLocalProperty: ");
sMsg += OString(rEx.Message.getStr(),
rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
#else
catch(Exception& ){}
#endif
}
}
-/* -----------------------------13.12.00 08:47--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool ConfigManager::IsLocalConfigProvider()
{
return false;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 181c7ca46c8f..264eda0f59ce 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -209,7 +210,7 @@ namespace utl
}
catch(Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::getNodeNames: caught a generic exception!");
+ OSL_FAIL("OConfigurationNode::getNodeNames: caught a generic exception!");
}
}
@@ -235,16 +236,16 @@ namespace utl
aBuf.append("OConfigurationNode::removeNode: there is no element named!");
aBuf.append( rtl::OUStringToOString( _rName, RTL_TEXTENCODING_ASCII_US ) );
aBuf.append( "!" );
- OSL_ENSURE(sal_False, aBuf.getStr());
+ OSL_FAIL(aBuf.getStr());
#endif
}
catch (WrappedTargetException&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::removeNode: caught a WrappedTargetException!");
+ OSL_FAIL("OConfigurationNode::removeNode: caught a WrappedTargetException!");
}
catch(Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::removeNode: caught a generic exception!");
+ OSL_FAIL("OConfigurationNode::removeNode: caught a generic exception!");
}
}
return sal_False;
@@ -315,12 +316,12 @@ namespace utl
if (m_xDirectAccess.is() && m_xDirectAccess->hasByName(sNormalized))
{
if (!::cppu::extractInterface(xNode, m_xDirectAccess->getByName(sNormalized)))
- OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
+ OSL_FAIL("OConfigurationNode::openNode: could not open the node!");
}
else if (m_xHierarchyAccess.is())
{
if (!::cppu::extractInterface(xNode, m_xHierarchyAccess->getByHierarchicalName(_rPath)))
- OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
+ OSL_FAIL("OConfigurationNode::openNode: could not open the node!");
}
if (xNode.is())
return OConfigurationNode( xNode );
@@ -333,12 +334,12 @@ namespace utl
aBuf.append("OConfigurationNode::openNode: there is no element named ");
aBuf.append( rtl::OUStringToOString( _rPath, RTL_TEXTENCODING_ASCII_US ) );
aBuf.append("!");
- OSL_ENSURE(sal_False, aBuf.getStr());
+ OSL_FAIL(aBuf.getStr());
#endif
}
catch(Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::openNode: caught an exception while retrieving the node!");
+ OSL_FAIL("OConfigurationNode::openNode: caught an exception while retrieving the node!");
}
return OConfigurationNode();
}
@@ -356,15 +357,12 @@ namespace utl
Reference< XServiceInfo > xSI(m_xHierarchyAccess, UNO_QUERY);
if (xSI.is())
{
- try { bIsSet = xSI->supportsService(::rtl::OUString::createFromAscii("com.sun.star.configuration.SetAccess")); }
+ try { bIsSet = xSI->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.SetAccess"))); }
catch(Exception&) { }
}
return bIsSet;
}
- //---------------------------------------------------------------------
- //--- 20.08.01 19:03:20 -----------------------------------------------
-
sal_Bool OConfigurationNode::hasByHierarchicalName( const ::rtl::OUString& _rName ) const throw()
{
OSL_ENSURE( m_xHierarchyAccess.is(), "OConfigurationNode::hasByHierarchicalName: no hierarchy access!" );
@@ -439,19 +437,19 @@ namespace utl
}
catch(IllegalArgumentException&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught an IllegalArgumentException!");
+ OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught an IllegalArgumentException!");
}
catch(NoSuchElementException&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a NoSuchElementException!");
+ OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught a NoSuchElementException!");
}
catch(WrappedTargetException&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a WrappedTargetException!");
+ OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught a WrappedTargetException!");
}
catch(Exception&)
{
- OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a generic Exception!");
+ OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught a generic Exception!");
}
@@ -532,10 +530,9 @@ namespace utl
aArgs.put( "lazywrite", i_bLazyWrite );
aArgs.put( "depth", i_nDepth );
- ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(
- i_bUpdatable
- ? "com.sun.star.configuration.ConfigurationUpdateAccess"
- : "com.sun.star.configuration.ConfigurationAccess" );
+ ::rtl::OUString sAccessService( i_bUpdatable ?
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" )) :
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )));
Reference< XInterface > xRoot(
i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ),
@@ -663,3 +660,4 @@ namespace utl
} // namespace utl
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/configpathes.cxx b/unotools/source/config/configpathes.cxx
index 5e7a4c80813e..5c35e112bad0 100644
--- a/unotools/source/config/configpathes.cxx
+++ b/unotools/source/config/configpathes.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -97,7 +98,7 @@ sal_Bool splitLastFromConfigurationPath(OUString const& _sInPath,
// strip trailing slash
if (nPos > 0 && _sInPath[ nPos ] == sal_Unicode('/'))
{
- OSL_ENSURE(false, "Invalid config path: trailing '/' is not allowed");
+ OSL_FAIL("Invalid config path: trailing '/' is not allowed");
--nPos;
}
@@ -306,3 +307,5 @@ OUString wrapConfigurationElementName(OUString const& _sElementName,
//----------------------------------------------------------------------------
} // namespace utl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index 653305f92f74..a7fc30699218 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -81,9 +82,6 @@ namespace utl
bool operator != ( const NodeValueAccessor& rhs ) const { return !operator == ( rhs ); }
};
- //---------------------------------------------------------------------
- //--- 20.08.01 17:21:13 -----------------------------------------------
-
NodeValueAccessor::NodeValueAccessor( const ::rtl::OUString& _rNodePath )
:sRelativePath( _rNodePath )
,eLocationType( ltUnbound )
@@ -91,9 +89,6 @@ namespace utl
{
}
- //---------------------------------------------------------------------
- //--- 20.08.01 17:06:36 -----------------------------------------------
-
bool NodeValueAccessor::operator == ( const NodeValueAccessor& rhs ) const
{
return ( sRelativePath == rhs.sRelativePath )
@@ -101,9 +96,6 @@ namespace utl
&& ( pLocation == rhs.pLocation );
}
- //---------------------------------------------------------------------
- //--- 20.08.01 17:47:43 -----------------------------------------------
-
void NodeValueAccessor::bind( void* _pLocation, const Type& _rType )
{
DBG_ASSERT( !isBound(), "NodeValueAccessor::bind: already bound!" );
@@ -113,9 +105,6 @@ namespace utl
aDataType = _rType;
}
- //---------------------------------------------------------------------
- //--- 20.08.01 17:48:47 -----------------------------------------------
-
void NodeValueAccessor::bind( Any* _pLocation )
{
DBG_ASSERT( !isBound(), "NodeValueAccessor::bind: already bound!" );
@@ -125,9 +114,6 @@ namespace utl
aDataType = ::getCppuType( _pLocation );
}
- //---------------------------------------------------------------------
- //--- 20.08.01 17:42:17 -----------------------------------------------
-
#ifndef UNX
static
#endif
@@ -173,9 +159,6 @@ namespace utl
}
}
- //---------------------------------------------------------------------
- //--- 21.08.01 12:06:43 -----------------------------------------------
-
#ifndef UNX
static
#endif
@@ -204,9 +187,6 @@ namespace utl
//= functors on NodeValueAccessor instances
//=====================================================================
- //---------------------------------------------------------------------
- //--- 21.08.01 12:01:16 -----------------------------------------------
-
/// base class for functors syncronizing between exchange locations and config sub nodes
struct SubNodeAccess : public ::std::unary_function< NodeValueAccessor, void >
{
@@ -222,9 +202,6 @@ namespace utl
}
};
- //---------------------------------------------------------------------
- //--- 21.08.01 11:25:56 -----------------------------------------------
-
struct UpdateFromConfig : public SubNodeAccess
{
public:
@@ -236,9 +213,6 @@ namespace utl
}
};
- //---------------------------------------------------------------------
- //--- 21.08.01 11:25:56 -----------------------------------------------
-
struct UpdateToConfig : public SubNodeAccess
{
public:
@@ -252,9 +226,6 @@ namespace utl
}
};
- //---------------------------------------------------------------------
- //--- 20.08.01 16:58:24 -----------------------------------------------
-
DECLARE_STL_VECTOR( NodeValueAccessor, NodeValueAccessors );
//=====================================================================
@@ -279,9 +250,6 @@ namespace utl
//= OConfigurationValueContainer
//=====================================================================
- //---------------------------------------------------------------------
- //--- 20.08.01 15:53:35 -----------------------------------------------
-
OConfigurationValueContainer::OConfigurationValueContainer(
const Reference< XMultiServiceFactory >& _rxORB, ::osl::Mutex& _rAccessSafety,
const sal_Char* _pConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels )
@@ -290,9 +258,6 @@ namespace utl
implConstruct( ::rtl::OUString::createFromAscii( _pConfigLocation ), _nAccessFlags, _nLevels );
}
- //---------------------------------------------------------------------
- //--- 20.08.01 15:55:20 -----------------------------------------------
-
OConfigurationValueContainer::OConfigurationValueContainer(
const Reference< XMultiServiceFactory >& _rxORB, ::osl::Mutex& _rAccessSafety,
const ::rtl::OUString& _rConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels )
@@ -301,25 +266,16 @@ namespace utl
implConstruct( _rConfigLocation, _nAccessFlags, _nLevels );
}
- //---------------------------------------------------------------------
- //--- 20.08.01 16:01:29 -----------------------------------------------
-
OConfigurationValueContainer::~OConfigurationValueContainer()
{
delete m_pImpl;
}
- //---------------------------------------------------------------------
- //--- 20.08.01 15:59:13 -----------------------------------------------
-
const Reference< XMultiServiceFactory >& OConfigurationValueContainer::getServiceFactory( ) const
{
return m_pImpl->xORB;
}
- //---------------------------------------------------------------------
- //--- 20.08.01 16:02:07 -----------------------------------------------
-
void OConfigurationValueContainer::implConstruct( const ::rtl::OUString& _rConfigLocation,
const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels )
{
@@ -343,9 +299,6 @@ namespace utl
#endif
}
- //---------------------------------------------------------------------
- //--- 20.08.01 16:39:05 -----------------------------------------------
-
void OConfigurationValueContainer::registerExchangeLocation( const sal_Char* _pRelativePath,
void* _pContainer, const Type& _rValueType )
{
@@ -369,9 +322,6 @@ namespace utl
implRegisterExchangeLocation( aNewAccessor );
}
- //---------------------------------------------------------------------
- //--- 21.08.01 14:44:45 -----------------------------------------------
-
void OConfigurationValueContainer::registerNullValueExchangeLocation( const sal_Char* _pRelativePath, Any* _pContainer )
{
// build an accessor for this container
@@ -382,25 +332,19 @@ namespace utl
implRegisterExchangeLocation( aNewAccessor );
}
- //---------------------------------------------------------------------
- //--- 21.08.01 10:23:34 -----------------------------------------------
-
void OConfigurationValueContainer::read( )
{
- for_each(
+ std::for_each(
m_pImpl->aAccessors.begin(),
m_pImpl->aAccessors.end(),
UpdateFromConfig( m_pImpl->aConfigRoot, m_pImpl->rMutex )
);
}
- //---------------------------------------------------------------------
- //--- 21.08.01 12:04:48 -----------------------------------------------
-
void OConfigurationValueContainer::write( sal_Bool _bCommit )
{
// collect the current values in the exchange locations
- for_each(
+ std::for_each(
m_pImpl->aAccessors.begin(),
m_pImpl->aAccessors.end(),
UpdateToConfig( m_pImpl->aConfigRoot, m_pImpl->rMutex )
@@ -411,9 +355,6 @@ namespace utl
commit( sal_False );
}
- //---------------------------------------------------------------------
- //--- 21.08.01 12:09:45 -----------------------------------------------
-
void OConfigurationValueContainer::commit( sal_Bool _bWrite )
{
// write the current values in the exchange locations (if requested)
@@ -424,9 +365,6 @@ namespace utl
m_pImpl->aConfigRoot.commit( );
}
- //---------------------------------------------------------------------
- //--- 20.08.01 17:29:27 -----------------------------------------------
-
void OConfigurationValueContainer::implRegisterExchangeLocation( const NodeValueAccessor& _rAccessor )
{
// some checks
@@ -454,3 +392,4 @@ namespace utl
} // namespace utl
//.........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx
index 7bd4b566e928..0b9f1331b261 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,7 +40,6 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/mutex.hxx>
-#include <vos/process.hxx>
#include <unotools/localfilehelper.hxx>
#include <rtl/instance.hxx>
@@ -47,9 +47,10 @@
using namespace osl;
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
+
// define ----------------------------------------------------------------
#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
@@ -125,7 +126,7 @@ struct PathToDefaultMapping_Impl
PathStrPtr _pDefaultPath;
};
-static PathToDefaultMapping_Impl __READONLY_DATA PathMap_Impl[] =
+static PathToDefaultMapping_Impl const PathMap_Impl[] =
{
{ SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath },
{ SvtPathOptions::PATH_AUTOCORRECT, &SvtDefaultOptions_Impl::m_aAutoCorrectPath },
@@ -361,3 +362,4 @@ String SvtDefaultOptions::GetDefaultPath( sal_uInt16 nId ) const
return pImp->GetDefaultPath( nId );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/docinfohelper.cxx b/unotools/source/config/docinfohelper.cxx
index 677432e1f7d3..462ab33ca162 100644
--- a/unotools/source/config/docinfohelper.cxx
+++ b/unotools/source/config/docinfohelper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,6 +34,7 @@
#include <unotools/configmgr.hxx>
#include <unotools/bootstrap.hxx>
#include <unotools/docinfohelper.hxx>
+#include <rtl/bootstrap.hxx>
using namespace ::com::sun::star;
@@ -45,46 +47,47 @@ namespace utl
// First product: branded name + version
// version is <product_versions>_<product_extension>$<platform>
- utl::ConfigManager* pMgr = utl::ConfigManager::GetConfigManager();
- if ( pMgr )
+ utl::ConfigManager& rMgr = utl::ConfigManager::GetConfigManager();
+ // plain product name
+ rtl::OUString aValue;
+ uno::Any aAny = rMgr.GetDirectConfigProperty(
+ utl::ConfigManager::PRODUCTNAME);
+ if ( (aAny >>= aValue) && aValue.getLength() )
{
- // plain product name
- rtl::OUString aValue;
- uno::Any aAny = pMgr->GetDirectConfigProperty(
- utl::ConfigManager::PRODUCTNAME);
+ aResult.append( aValue.replace( ' ', '_' ) );
+ aResult.append( (sal_Unicode)'/' );
+
+ aAny = rMgr.GetDirectConfigProperty(
+ utl::ConfigManager::PRODUCTVERSION);
if ( (aAny >>= aValue) && aValue.getLength() )
{
aResult.append( aValue.replace( ' ', '_' ) );
- aResult.append( (sal_Unicode)'/' );
- aAny = pMgr->GetDirectConfigProperty(
- utl::ConfigManager::PRODUCTVERSION);
+ aAny = rMgr.GetDirectConfigProperty(
+ utl::ConfigManager::PRODUCTEXTENSION);
if ( (aAny >>= aValue) && aValue.getLength() )
{
+ aResult.append( (sal_Unicode)'_' );
aResult.append( aValue.replace( ' ', '_' ) );
-
- aAny = pMgr->GetDirectConfigProperty(
- utl::ConfigManager::PRODUCTEXTENSION);
- if ( (aAny >>= aValue) && aValue.getLength() )
- {
- aResult.append( (sal_Unicode)'_' );
- aResult.append( aValue.replace( ' ', '_' ) );
- }
}
-
- aResult.append( (sal_Unicode)'$' );
- aResult.append( ::rtl::OUString::createFromAscii(
- TOOLS_INETDEF_OS ).replace( ' ', '_' ) );
-
- aResult.append( (sal_Unicode)' ' );
}
+
+ ::rtl::OUString os( RTL_CONSTASCII_USTRINGPARAM("$_OS") );
+ ::rtl::OUString arch( RTL_CONSTASCII_USTRINGPARAM("$_ARCH") );
+ ::rtl::Bootstrap::expandMacros(os);
+ ::rtl::Bootstrap::expandMacros(arch);
+ aResult.append( (sal_Unicode)'$' );
+ aResult.append( os );
+ aResult.append( (sal_Unicode)'_' );
+ aResult.append( arch );
+ aResult.append( (sal_Unicode)' ' );
}
- // second product: OpenOffice.org_project/<build_information>
+ // second product: LibreOffice_project/<build_information>
// build_information has '(' and '[' encoded as '$', ')' and ']' ignored
// and ':' replaced by '-'
{
- aResult.appendAscii( "OpenOffice.org_project/" );
+ aResult.appendAscii( "LibreOffice_project/" );
::rtl::OUString aDefault;
::rtl::OUString aBuildId( Bootstrap::getBuildIdData( aDefault ) );
for( sal_Int32 i=0; i < aBuildId.getLength(); i++ )
@@ -114,3 +117,4 @@ namespace utl
} // end of namespace utl
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx
index 6ef88002a442..ec80822b4d65 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/dynamicmenuoptions.hxx>
#include <unotools/moduleoptions.hxx>
@@ -42,9 +37,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#ifndef __SGI_STL_VECTOR
#include <vector>
-#endif
#include <itemholder1.hxx>
@@ -546,7 +539,7 @@ void SvtDynamicMenuOptions_Impl::Notify( const Sequence< OUString >& )
//*****************************************************************************************************************
void SvtDynamicMenuOptions_Impl::Commit()
{
- DBG_ERROR( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" );
+ OSL_FAIL( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" );
/*
// Write all properties!
// Delete complete sets first.
@@ -894,27 +887,17 @@ void SvtDynamicMenuOptions::AppendItem( EDynamicMenuType eMenu
m_pDataContainer->AppendItem( eMenu, sURL, sTitle, sImageIdentifier, sTargetName );
}
+namespace
+{
+ class theDynamicMenuOptionsMutex : public rtl::Static<osl::Mutex, theDynamicMenuOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtDynamicMenuOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theDynamicMenuOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx
index a07c99b70381..a6de56a6a5d6 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,9 +38,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/weakref.hxx>
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
+#include <boost/unordered_map.hpp>
#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
@@ -188,8 +187,8 @@ void GlobalEventConfig_Impl::Commit()
ClearNodeSet( SETNODE_BINDINGS );
Sequence< beans::PropertyValue > seqValues( 1 );
OUString sNode;
- static const OUString sPrefix(SETNODE_BINDINGS + PATHDELIMITER + OUString::createFromAscii("BindingType['"));
- static const OUString sPostfix(OUString::createFromAscii("']") + PATHDELIMITER + PROPERTYNAME_BINDINGURL);
+ static const OUString sPrefix(SETNODE_BINDINGS + PATHDELIMITER + OUString(RTL_CONSTASCII_USTRINGPARAM("BindingType['")));
+ static const OUString sPostfix(OUString(RTL_CONSTASCII_USTRINGPARAM("']")) + PATHDELIMITER + PROPERTYNAME_BINDINGURL);
//step through the list of events
for(int i=0;it!=it_end;++it,++i)
{
@@ -291,9 +290,9 @@ Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (c
{
Any aRet;
Sequence< beans::PropertyValue > props(2);
- props[0].Name = OUString::createFromAscii("EventType");
- props[0].Value <<= OUString::createFromAscii("Script");
- props[1].Name = OUString::createFromAscii("Script");
+ props[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("EventType"));
+ props[0].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("Script"));
+ props[1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Script"));
EventBindingHash::const_iterator it = m_eventBindingHash.find( aName );
if( it != m_eventBindingHash.end() )
{
@@ -424,28 +423,14 @@ sal_Bool SAL_CALL GlobalEventConfig::hasElements( ) throw (RuntimeException)
return m_pImpl->hasElements( );
}
+namespace
+{
+ class theGlobalEventConfigMutex : public rtl::Static<osl::Mutex, theGlobalEventConfigMutex>{};
+}
+
Mutex& GlobalEventConfig::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect following code with
- // the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that
- // another instance of our class will be faster then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theGlobalEventConfigMutex::get();
}
::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex )
@@ -453,3 +438,4 @@ Mutex& GlobalEventConfig::GetOwnStaticMutex()
return GlobalEventConfig().m_pImpl->GetEventName( nIndex );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx
index 716733e2d090..c93d85ed5fe7 100644
--- a/unotools/source/config/extendedsecurityoptions.cxx
+++ b/unotools/source/config/extendedsecurityoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -44,7 +45,7 @@
#include <unotools/pathoptions.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <rtl/logfile.hxx>
#include "itemholder1.hxx"
@@ -85,7 +86,7 @@ struct OUStringHashCode
}
};
-class ExtensionHashMap : public ::std::hash_map< ::rtl::OUString,
+class ExtensionHashMap : public ::boost::unordered_map< ::rtl::OUString,
sal_Int32,
OUStringHashCode,
::std::equal_to< ::rtl::OUString > >
@@ -256,7 +257,7 @@ SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()
if ( seqValues[nProperty] >>= nMode )
m_eOpenHyperlinkMode = (SvtExtendedSecurityOptions::OpenHyperlinkMode)nMode;
else {
- DBG_ERROR("Wrong type for Open mode!");
+ OSL_FAIL("Wrong type for Open mode!");
}
m_bROOpenHyperlinkMode = seqRO[nProperty];
}
@@ -341,7 +342,7 @@ Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetSecureExtensionList() c
sal_Int32 nIndex = 0;
for ( ExtensionHashMap::const_iterator pIter = m_aExtensionHashMap.begin();
- pIter != m_aExtensionHashMap.end(); pIter++ )
+ pIter != m_aExtensionHashMap.end(); ++pIter )
{
aResult[nIndex++] = pIter->first;
}
@@ -356,9 +357,7 @@ SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions_Impl::G
{
return m_eOpenHyperlinkMode;
}
-/* -----------------09.07.2003 11:26-----------------
- --------------------------------------------------*/
sal_Bool SvtExtendedSecurityOptions_Impl::IsOpenHyperlinkModeReadOnly() const
{
return m_bROOpenHyperlinkMode;
@@ -413,13 +412,13 @@ void SvtExtendedSecurityOptions_Impl::FillExtensionHashMap( ExtensionHashMap& aH
//*****************************************************************************************************************
Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_HYPERLINKS_OPEN
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
@@ -495,9 +494,7 @@ SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpe
MutexGuard aGuard( GetInitMutex() );
return m_pDataContainer->GetOpenHyperlinkMode();
}
-/* -----------------09.07.2003 11:26-----------------
- --------------------------------------------------*/
sal_Bool SvtExtendedSecurityOptions::IsOpenHyperlinkModeReadOnly() const
{
return m_pDataContainer->IsOpenHyperlinkModeReadOnly();
@@ -512,27 +509,17 @@ void SvtExtendedSecurityOptions::SetOpenHyperlinkMode( SvtExtendedSecurityOption
m_pDataContainer->SetOpenHyperlinkMode( eMode );
}
+namespace
+{
+ class theExtendedSecurityOptionsMutex : public rtl::Static<osl::Mutex, theExtendedSecurityOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtExtendedSecurityOptions::GetInitMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theExtendedSecurityOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index f16f6ed9cfca..805a38f98620 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,10 +37,11 @@
#include <com/sun/star/uno/Sequence.hxx>
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
-#define C2U(cChar) OUString::createFromAscii(cChar)
+using ::rtl::OUString;
+
+#define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar))
// -----------------------------------------------------------------------
#define FILTERCFG_WORD_CODE 0x0001
@@ -61,12 +63,10 @@ using namespace com::sun::star::uno;
#define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000
#define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000
#define FILTERCFG_USE_ENHANCED_FIELDS 0x100000
+#define FILTERCFG_WORD_WBCTBL 0x200000
static SvtFilterOptions* pOptions=0;
-/* -----------------------------22.01.01 10:23--------------------------------
-
- ---------------------------------------------------------------------------*/
class SvtAppFilterOptions_Impl : public utl::ConfigItem
{
sal_Bool bLoadVBA;
@@ -97,17 +97,12 @@ public:
}
};
-/* -----------------------------22.01.01 11:08--------------------------------
-
- ---------------------------------------------------------------------------*/
SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl()
{
if(IsModified())
Commit();
}
-/* -----------------------------22.01.01 10:38--------------------------------
- ---------------------------------------------------------------------------*/
void SvtAppFilterOptions_Impl::Commit()
{
Sequence<OUString> aNames(2);
@@ -129,10 +124,6 @@ void SvtAppFilterOptions_Impl::Notify( const Sequence< rtl::OUString >& )
// no listeners supported yet
}
-
-/* -----------------------------22.01.01 10:38--------------------------------
-
- ---------------------------------------------------------------------------*/
void SvtAppFilterOptions_Impl::Load()
{
Sequence<OUString> aNames(2);
@@ -150,6 +141,52 @@ void SvtAppFilterOptions_Impl::Load()
}
// -----------------------------------------------------------------------
+class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl
+{
+ sal_Bool bLoadExecutable;
+public:
+ SvtWriterFilterOptions_Impl(const OUString& rRoot) :
+ SvtAppFilterOptions_Impl(rRoot),
+ bLoadExecutable(sal_False)
+ {}
+ virtual void Commit();
+ void Load();
+
+ sal_Bool IsLoadExecutable() const {return bLoadExecutable;}
+ void SetLoadExecutable(sal_Bool bSet)
+ {
+ if(bSet != bLoadExecutable)
+ SetModified();
+ bLoadExecutable = bSet;
+ }
+};
+
+void SvtWriterFilterOptions_Impl::Commit()
+{
+ SvtAppFilterOptions_Impl::Commit();
+
+ Sequence<OUString> aNames(1);
+ aNames[0] = C2U("Executable");
+ Sequence<Any> aValues(1);
+ aValues[0] <<= bLoadExecutable;
+
+ PutProperties(aNames, aValues);
+}
+
+void SvtWriterFilterOptions_Impl::Load()
+{
+ SvtAppFilterOptions_Impl::Load();
+
+ Sequence<OUString> aNames(1);
+ aNames[0] = C2U("Executable");
+
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ if(pValues[0].hasValue())
+ bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
+}
+
+// -----------------------------------------------------------------------
class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
{
sal_Bool bLoadExecutable;
@@ -195,13 +232,10 @@ void SvtCalcFilterOptions_Impl::Load()
bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
}
-/* -----------------------------22.01.01 10:32--------------------------------
-
- ---------------------------------------------------------------------------*/
struct SvtFilterOptions_Impl
{
sal_uLong nFlags;
- SvtAppFilterOptions_Impl aWriterCfg;
+ SvtWriterFilterOptions_Impl aWriterCfg;
SvtCalcFilterOptions_Impl aCalcCfg;
SvtAppFilterOptions_Impl aImpressCfg;
@@ -237,15 +271,14 @@ struct SvtFilterOptions_Impl
aImpressCfg.Load();
}
};
-/* -----------------------------22.01.01 10:34--------------------------------
- ---------------------------------------------------------------------------*/
void SvtFilterOptions_Impl::SetFlag( sal_uLong nFlag, sal_Bool bSet )
{
switch(nFlag)
{
case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break;
case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break;
+ case FILTERCFG_WORD_WBCTBL: aWriterCfg.SetLoadExecutable(bSet);break;
case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break;
case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break;
case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break;
@@ -258,9 +291,7 @@ void SvtFilterOptions_Impl::SetFlag( sal_uLong nFlag, sal_Bool bSet )
nFlags &= ~nFlag;
}
}
-/* -----------------------------22.01.01 10:35--------------------------------
- ---------------------------------------------------------------------------*/
sal_Bool SvtFilterOptions_Impl::IsFlag( sal_uLong nFlag ) const
{
sal_Bool bRet;
@@ -268,6 +299,7 @@ sal_Bool SvtFilterOptions_Impl::IsFlag( sal_uLong nFlag ) const
{
case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break;
case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break;
+ case FILTERCFG_WORD_WBCTBL : bRet = aWriterCfg.IsLoadExecutable();break;
case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break;
case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break;
case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break;
@@ -294,9 +326,7 @@ SvtFilterOptions::~SvtFilterOptions()
{
delete pImp;
}
-/* -----------------------------22.01.01 08:45--------------------------------
- ---------------------------------------------------------------------------*/
const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
{
static Sequence<OUString> aNames;
@@ -321,7 +351,7 @@ const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
};
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
- pNames[i] = C2U(aPropNames[i]);
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
}
return aNames;
}
@@ -344,20 +374,16 @@ static sal_uLong lcl_GetFlag(sal_Int32 nProp)
case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break;
case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break;
- default: DBG_ERROR("illegal value");
+ default: OSL_FAIL("illegal value");
}
return nFlag;
}
-/*-- 22.01.01 08:53:03---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtFilterOptions::Notify( const Sequence<OUString>& )
{
Load();
}
-/*-- 22.01.01 08:53:04---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtFilterOptions::Commit()
{
const Sequence<OUString>& aNames = GetPropertyNames();
@@ -374,9 +400,7 @@ void SvtFilterOptions::Commit()
}
PutProperties(aNames, aValues);
}
-/*-- 22.01.01 08:53:04---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtFilterOptions::Load()
{
pImp->Load();
@@ -410,6 +434,17 @@ sal_Bool SvtFilterOptions::IsLoadWordBasicCode() const
return pImp->IsFlag( FILTERCFG_WORD_CODE );
}
+void SvtFilterOptions::SetLoadWordBasicExecutable( sal_Bool bFlag )
+{
+ pImp->SetFlag( FILTERCFG_WORD_WBCTBL, bFlag );
+ SetModified();
+}
+
+sal_Bool SvtFilterOptions::IsLoadWordBasicExecutable() const
+{
+ return pImp->IsFlag( FILTERCFG_WORD_WBCTBL );
+}
+
void SvtFilterOptions::SetLoadWordBasicStorage( sal_Bool bFlag )
{
pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag );
@@ -530,8 +565,7 @@ void SvtFilterOptions::SetWriter2WinWord( sal_Bool bFlag )
sal_Bool SvtFilterOptions::IsUseEnhancedFields() const
{
- return false; // disable for now;
-// return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
+ return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
}
void SvtFilterOptions::SetUseEnhancedFields( sal_Bool bFlag )
@@ -614,3 +648,4 @@ sal_Bool SvtFilterOptions::IsEnableWordPreview() const
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index b7fd73898c71..46d92d121a66 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,6 +37,8 @@
#include <unotools/configpathes.hxx>
#include <unotools/syslocale.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/instance.hxx>
+#include <sal/macros.h>
#include <tools/debug.hxx>
#if OSL_DEBUG_LEVEL > 1
@@ -49,16 +52,13 @@
#define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts"
#define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions"
-using namespace rtl;
using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
-static DefaultFontConfiguration* mpDefaultFontConfiguration = 0;
-
-static FontSubstConfiguration* mpFontSubstConfiguration = 0;
+using ::rtl::OUString;
/*
* DefaultFontConfiguration
@@ -92,16 +92,23 @@ static const char* getKeyType( int nKeyType )
case DEFAULTFONT_UI_FIXED: return "UI_FIXED";
case DEFAULTFONT_UI_SANS: return "UI_SANS";
default:
- DBG_ERROR( "unmatched type" );
+ OSL_FAIL( "unmatched type" );
return "";
}
}
-DefaultFontConfiguration* DefaultFontConfiguration::get()
+namespace
+{
+ class theDefaultFontConfiguration
+ : public rtl::Static<DefaultFontConfiguration,
+ theDefaultFontConfiguration>
+ {
+ };
+}
+
+DefaultFontConfiguration& DefaultFontConfiguration::get()
{
- if( !mpDefaultFontConfiguration )
- mpDefaultFontConfiguration = new DefaultFontConfiguration();
- return mpDefaultFontConfiguration;
+ return theDefaultFontConfiguration::get();
}
DefaultFontConfiguration::DefaultFontConfiguration()
@@ -191,7 +198,7 @@ OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUStr
{
OUString aRet;
- std::hash_map< Locale, LocaleAccess, LocaleHash >::const_iterator it =
+ boost::unordered_map< Locale, LocaleAccess, LocaleHash >::const_iterator it =
m_aConfig.find( rLocale );
if( it != m_aConfig.end() )
{
@@ -325,40 +332,40 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
static const OUString aFallBackKorean( aFallBackKoreanLocalized );
// optimize font list for some locales, as long as Andale Sans UI does not support them
- if( aLocale.Language.equalsAscii( "ar" ) ||
- aLocale.Language.equalsAscii( "he" ) ||
- aLocale.Language.equalsAscii( "iw" ) )
+ if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ar" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "he" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "iw" ) ) )
{
return aFallBackArabic;
}
- else if( aLocale.Language.equalsAscii( "th" ) )
+ else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "th" ) ) )
{
return aFallBackThai;
}
- else if( aLocale.Language.equalsAscii( "ko" ) )
+ else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ko" ) ) )
{
return aFallBackKorean;
}
- else if( aLocale.Language.equalsAscii( "cs" ) ||
- aLocale.Language.equalsAscii( "hu" ) ||
- aLocale.Language.equalsAscii( "pl" ) ||
- aLocale.Language.equalsAscii( "ro" ) ||
- aLocale.Language.equalsAscii( "rm" ) ||
- aLocale.Language.equalsAscii( "hr" ) ||
- aLocale.Language.equalsAscii( "sk" ) ||
- aLocale.Language.equalsAscii( "sl" ) ||
- aLocale.Language.equalsAscii( "sb" ) )
+ else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cs" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hu" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "pl" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ro" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "rm" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hr" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sk" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sl" ) ) ||
+ aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sb" ) ) )
{
return aFallbackLatin2;
}
- else if( aLocale.Language.equalsAscii( "zh" ) )
+ else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "zh" ) ) )
{
- if( ! aLocale.Country.equalsAscii( "cn" ) )
+ if( ! aLocale.Country.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cn" ) ) )
return aFallBackChineseTRD;
else
return aFallBackChineseSIM;
}
- else if( aLocale.Language.equalsAscii( "ja" ) )
+ else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ja" ) ) )
{
return aFallBackJapanese;
}
@@ -372,11 +379,17 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
* FontSubstConfigItem::get
*/
-FontSubstConfiguration* FontSubstConfiguration::get()
+namespace
+{
+ class theFontSubstConfiguration
+ : public rtl::Static<FontSubstConfiguration, theFontSubstConfiguration>
+ {
+ };
+}
+
+FontSubstConfiguration& FontSubstConfiguration::get()
{
- if( !mpFontSubstConfiguration )
- mpFontSubstConfiguration = new FontSubstConfiguration();
- return mpFontSubstConfiguration;
+ return theFontSubstConfiguration::get();
}
/*
@@ -1001,7 +1014,7 @@ FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Re
const OUString* pLine = (const OUString*)aAny.getValue();
if( pLine->getLength() )
{
- for( weight=sizeof(pWeightNames)/sizeof(pWeightNames[0])-1; weight >= 0; weight-- )
+ for( weight=SAL_N_ELEMENTS(pWeightNames)-1; weight >= 0; weight-- )
if( pLine->equalsIgnoreAsciiCaseAscii( pWeightNames[weight].pName ) )
break;
}
@@ -1033,7 +1046,7 @@ FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Refe
const OUString* pLine = (const OUString*)aAny.getValue();
if( pLine->getLength() )
{
- for( width=sizeof(pWidthNames)/sizeof(pWidthNames[0])-1; width >= 0; width-- )
+ for( width=SAL_N_ELEMENTS(pWidthNames)-1; width >= 0; width-- )
if( pLine->equalsIgnoreAsciiCaseAscii( pWidthNames[width].pName ) )
break;
}
@@ -1091,7 +1104,7 @@ unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::R
void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const
{
- std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator it =
+ boost::unordered_map< Locale, LocaleSubst, LocaleHash >::const_iterator it =
m_aSubst.find( rLocale );
if( it != m_aSubst.end() )
{
@@ -1191,7 +1204,7 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam
while( aLocale.Language.getLength() )
{
- std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale );
+ boost::unordered_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale );
if( lang != m_aSubst.end() )
{
if( ! lang->second.bConfigRead )
@@ -1214,7 +1227,7 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam
aLocale.Variant = OUString();
else if( aLocale.Country.getLength() )
aLocale.Country = OUString();
- else if( ! aLocale.Language.equalsAscii( "en" ) )
+ else if( ! aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "en" ) ) )
aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) );
else
aLocale.Language = OUString();
@@ -1222,3 +1235,4 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam
return NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx
index 5853dd36af98..7c32000a6a0d 100644
--- a/unotools/source/config/fontoptions.cxx
+++ b/unotools/source/config/fontoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/fontoptions.hxx>
#include <unotools/configmgr.hxx>
@@ -42,6 +37,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include "itemholder1.hxx"
//_________________________________________________________________________________________________________________
@@ -373,15 +369,15 @@ void SvtFontOptions_Impl::EnableFontWYSIWYG( sal_Bool bState )
//*****************************************************************************************************************
Sequence< OUString > SvtFontOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_REPLACEMENTTABLE ,
PROPERTYNAME_FONTHISTORY ,
PROPERTYNAME_FONTWYSIWYG ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
@@ -485,27 +481,17 @@ void SvtFontOptions::EnableFontWYSIWYG( sal_Bool bState )
m_pDataContainer->EnableFontWYSIWYG( bState );
}
+namespace
+{
+ class theFontOptionsMutex : public rtl::Static<osl::Mutex, theFontOptionsMutex> {};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtFontOptions::impl_GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theFontOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx
index 5cb74f9bbf35..d6990fb40fa8 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/historyoptions.hxx>
#include <unotools/historyoptions_const.hxx>
@@ -42,44 +37,25 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#ifndef __SGI_STL_DEQUE
#include <deque>
-#endif
-
-#ifndef __SGI_STL_ALGORITHM
#include <algorithm>
-#endif
#include <rtl/logfile.hxx>
#include "itemholder1.hxx"
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#endif
-#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
#include <comphelper/configurationhelper.hxx>
-#endif
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
-#endif
-#ifndef _SVT_LOGHELPER_HXX
#include <unotools/loghelper.hxx>
-#endif
//_________________________________________________________________________________________________________________
// namespaces
@@ -126,7 +102,7 @@ struct IMPL_THistoryItem
sPassword = sNewPassword ;
}
- sal_Bool operator==( const OUString& sSearchedURL )
+ sal_Bool operator==( const OUString& sSearchedURL ) const
{
return( sURL == sSearchedURL );
}
@@ -208,9 +184,13 @@ SvtHistoryOptions_Impl::~SvtHistoryOptions_Impl()
//*****************************************************************************************************************
sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory )
{
- sal_uInt32 nSize = 0 ;
css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY);
+ if (!xListAccess.is())
+ return 0;
+
+ sal_uInt32 nSize = 0 ;
+
try
{
switch( eHistory )
@@ -719,27 +699,17 @@ void SvtHistoryOptions::AppendItem( EHistoryType eHistory ,
m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword );
}
+namespace
+{
+ class theHistoryOptionsMutex : public rtl::Static<osl::Mutex, theHistoryOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtHistoryOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theHistoryOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/inetoptions.cxx b/unotools/source/config/inetoptions.cxx
index 15bf425af744..d851102d2d23 100644
--- a/unotools/source/config/inetoptions.cxx
+++ b/unotools/source/config/inetoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <unotools/inetoptions.hxx>
#include "rtl/instance.hxx"
#include <tools/urlobj.hxx>
-#ifndef _WILDCARD_HXX
#include <tools/wldcrd.hxx>
-#endif
#include <algorithm>
#include <map>
@@ -248,7 +247,7 @@ SvtInetOptions::Impl::notifyListeners(
{
aEvents.realloc(nCount);
aNotifications.
- push_back(std::make_pair< List::value_type::first_type,
+ push_back(std::pair< List::value_type::first_type,
List::value_type::second_type >(
aIt->first, aEvents));
}
@@ -281,8 +280,7 @@ SvtInetOptions::Impl::Impl():
for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i)
aKeys[i] = m_aEntries[i].m_aName;
if (!EnableNotification(aKeys))
- OSL_ENSURE(false,
- "SvtInetOptions::Impl::Impl(): Bad EnableNotifications()");
+ OSL_FAIL("SvtInetOptions::Impl::Impl(): Bad EnableNotifications()");
}
//============================================================================
@@ -331,8 +329,7 @@ star::uno::Any SvtInetOptions::Impl::getProperty(Index nPropIndex)
}
}
}
- OSL_ENSURE(false,
- "SvtInetOptions::Impl::getProperty(): Possible life lock");
+ OSL_FAIL("SvtInetOptions::Impl::getProperty(): Possible life lock");
{
osl::MutexGuard aGuard(m_aMutex);
return m_aEntries[nPropIndex].m_aValue;
@@ -552,3 +549,5 @@ SvtInetOptions::removePropertiesChangeListener(
{
m_pImpl->removePropertiesChangeListener(rPropertyNames, rListener);
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/internaloptions.cxx b/unotools/source/config/internaloptions.cxx
index 310b52f8c98f..60601f9dea3e 100644
--- a/unotools/source/config/internaloptions.cxx
+++ b/unotools/source/config/internaloptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <deque>
@@ -267,14 +262,14 @@ SvtInternalOptions_Impl::SvtInternalOptions_Impl()
// Init baseclasses first
: ConfigItem ( ROOTNODE_INTERNAL, CONFIG_MODE_IMMEDIATE_UPDATE )
// Init member then.
- , m_bRemoveMenuEntryClose ( sal_False )
- , m_bRemoveMenuEntryBackToWebtop ( sal_False )
- , m_bRemoveMenuEntryNewWebtop ( sal_False )
- , m_bRemoveMenuEntryLogout ( sal_False )
- , m_bSlotCFG ( DEFAULT_SLOTCFG )
- , m_bSendCrashMail ( DEFAULT_SENDCRASHMAIL )
- , m_bUseMailUI ( DEFAULT_USEMAILUI )
- , m_aCurrentTempURL ( DEFAULT_CURRENTTEMPURL )
+ , m_bRemoveMenuEntryClose(sal_False)
+ , m_bRemoveMenuEntryBackToWebtop(sal_False)
+ , m_bRemoveMenuEntryNewWebtop(sal_False)
+ , m_bRemoveMenuEntryLogout(sal_False)
+ , m_bSlotCFG(DEFAULT_SLOTCFG)
+ , m_bSendCrashMail(DEFAULT_SENDCRASHMAIL)
+ , m_bUseMailUI(DEFAULT_USEMAILUI)
+ , m_aCurrentTempURL(DEFAULT_CURRENTTEMPURL)
{
// Use our list of configuration keys to get his values.
// structure of internal section: (first 2 entries are fixed - all other are member of a set!)
@@ -296,38 +291,12 @@ SvtInternalOptions_Impl::SvtInternalOptions_Impl()
DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nI miss some values of configuration keys!\n" );
// Read fixed values first!
- DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SLOTCFG].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\Slot\"?" );
- DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\SendCrashMail\"?" );
- seqValues[FIXPROPERTYHANDLE_SLOTCFG ] >>= m_bSlotCFG ;
- seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL ] >>= m_bSendCrashMail ;
- seqValues[FIXPROPERTYHANDLE_USEMAILUI ] >>= m_bUseMailUI ;
- seqValues[FIXPROPERTYHANDLE_CURRENTTEMPURL ] >>= m_aCurrentTempURL ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] >>= m_bRemoveMenuEntryClose ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] >>= m_bRemoveMenuEntryBackToWebtop ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] >>= m_bRemoveMenuEntryNewWebtop ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] >>= m_bRemoveMenuEntryLogout ;
-/*
- // Read dynamical set "RecoveryList" then.
- // 3 subkeys for every item!
- // Attention: Start at next element after last fixed entry! We must ignore "Slot" and "SendCrashMail" ...
- tIMPL_RecoveryEntry aEntry;
- sal_uInt32 nCount = seqValues.getLength() ;
- sal_uInt32 nPosition = FIXPROPERTYCOUNT ;
-
- while( nPosition<nCount )
- {
- seqValues[nPosition] >>= aEntry.sURL ;
- ++nPosition;
- seqValues[nPosition] >>= aEntry.sFilter ;
- ++nPosition;
- seqValues[nPosition] >>= aEntry.sTempName ;
- ++nPosition;
- m_aRecoveryList.push_front( aEntry );
- }
-*/
- // We don't need any notifications here.
- // "Slot" and "SendCrashMail" are readonly(!) and our recovery list should not modified during runtime - it's used
- // by our crash guard only ... otherwise we have a big problem.
+ DBG_ASSERT(!seqValues[FIXPROPERTYHANDLE_SLOTCFG].hasValue() || (seqValues[FIXPROPERTYHANDLE_SLOTCFG].getValueTypeClass() == TypeClass_BOOLEAN), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\Slot\"?");
+ DBG_ASSERT(!seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].hasValue() || !(seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\SendCrashMail\"?");
+ seqValues[FIXPROPERTYHANDLE_SLOTCFG] >>= m_bSlotCFG;
+ seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL] >>= m_bSendCrashMail;
+ seqValues[FIXPROPERTYHANDLE_USEMAILUI] >>= m_bUseMailUI;
+ seqValues[FIXPROPERTYHANDLE_CURRENTTEMPURL] >>= m_aCurrentTempURL;
}
//*****************************************************************************************************************
@@ -411,43 +380,6 @@ void SvtInternalOptions_Impl::SetCurrentTempURL( const OUString& aNewCurrentTemp
Commit();
}
-#if 0
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtInternalOptions_Impl::PushRecoveryItem( const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTempName )
-{
- tIMPL_RecoveryEntry aEntry( sURL, sFilter, sTempName );
- m_aRecoveryList.push_front( aEntry );
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtInternalOptions_Impl::PopRecoveryItem( OUString& sURL ,
- OUString& sFilter ,
- OUString& sTempName )
-{
- tIMPL_RecoveryEntry aEntry = m_aRecoveryList.front();
- m_aRecoveryList.pop_front();
- SetModified(); // Don't forget it - we delete an entry here!
- sURL = aEntry.sURL ;
- sFilter = aEntry.sFilter ;
- sTempName = aEntry.sTempName ;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtInternalOptions_Impl::IsRecoveryListEmpty() const
-{
- return ( m_aRecoveryList.empty() );
-}
-#endif
-
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
@@ -602,27 +534,17 @@ void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL )
m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL );
}
+namespace
+{
+ class theInternalOptionsMutex : public rtl::Static<osl::Mutex, theInternalOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtInternalOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theInternalOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 48b1decc4983..f9a22805dd6d 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -86,7 +87,7 @@ ItemHolder1::ItemHolder1()
{
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
css::uno::Reference< css::lang::XComponent > xCfg(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
+ xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))),
css::uno::UNO_QUERY);
if (xCfg.is())
xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
@@ -103,7 +104,7 @@ ItemHolder1::ItemHolder1()
sMsg += ::rtl::OString(rEx.Message.getStr(),
rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
+ OSL_FAIL(sMsg.getStr());
}
}
#else
@@ -312,7 +313,7 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
break;
default:
- OSL_ASSERT( "unknown item type" );
+ OSL_FAIL( "unknown item type" );
break;
}
}
@@ -327,3 +328,4 @@ void ItemHolder1::impl_deleteItem(TItemInfo& rItem)
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/itemholder1.hxx b/unotools/source/config/itemholder1.hxx
index 8e7fd285cc0a..e04b423152ba 100644
--- a/unotools/source/config/itemholder1.hxx
+++ b/unotools/source/config/itemholder1.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -87,3 +88,5 @@ class ItemHolder1 : private ItemHolderMutexBase
#undef css
#endif // INCLUDED_unotools_ITEMHOLDER1_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/javaoptions.cxx b/unotools/source/config/javaoptions.cxx
index 8c41aac2d3de..1ddef0dd409b 100644
--- a/unotools/source/config/javaoptions.cxx
+++ b/unotools/source/config/javaoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-#ifndef _unotools_JAVAPTIONS_HXX
#include <unotools/javaoptions.hxx>
-#endif
#include <com/sun/star/uno/Any.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/logfile.hxx>
@@ -41,11 +38,9 @@
using namespace ::com::sun::star::uno;
using namespace ::rtl;
-#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar))
#define CFG_READONLY_DEFAULT sal_False
-/* -----------------------------10.04.01 12:39--------------------------------
- ---------------------------------------------------------------------------*/
class SvtExecAppletsItem_Impl : public utl::ConfigItem
{
sal_Bool bExecute;
@@ -60,9 +55,7 @@ public:
void SetExecuteApplets(sal_Bool bSet);
sal_Bool IsReadOnly() const {return bRO;}
};
-/* -----------------------------10.02.2003 07:46------------------------------
- ---------------------------------------------------------------------------*/
void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet)
{
OSL_ENSURE(!bRO, "SvtExecAppletsItem_Impl::SetExecuteApplets()\nYou tried to write on a readonly value!\n");
@@ -72,9 +65,7 @@ void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet)
SetModified();
}
}
-/* -----------------------------18.05.01 14:44--------------------------------
- ---------------------------------------------------------------------------*/
SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl() :
utl::ConfigItem(C2U("Office.Common/Java/Applet")),
bExecute (sal_False ),
@@ -142,9 +133,7 @@ struct SvtJavaOptions_Impl
pNames[3] = C2U("UserClassPath");
}
};
-/* -----------------------------18.05.01 13:28--------------------------------
- ---------------------------------------------------------------------------*/
SvtJavaOptions::SvtJavaOptions() :
utl::ConfigItem(C2U("Office.Java/VirtualMachine")),
pImpl(new SvtJavaOptions_Impl)
@@ -176,16 +165,12 @@ SvtJavaOptions::SvtJavaOptions() :
pImpl->bROUserClassPath = pROStates[3];
}
}
-/* -----------------------------18.05.01 13:28--------------------------------
- ---------------------------------------------------------------------------*/
SvtJavaOptions::~SvtJavaOptions()
{
delete pImpl;
}
-/*-- 18.05.01 13:28:35---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtJavaOptions::Commit()
{
pImpl->aExecItem.Commit();
@@ -246,37 +231,27 @@ void SvtJavaOptions::Commit()
aNames.realloc(nRealCount);
PutProperties(aNames,aValues);
}
-/*-- 18.05.01 13:28:35---------------------------------------------------
- -----------------------------------------------------------------------*/
sal_Bool SvtJavaOptions::IsEnabled() const
{
return pImpl->bEnabled;
}
-/*-- 18.05.01 13:28:35---------------------------------------------------
- -----------------------------------------------------------------------*/
sal_Bool SvtJavaOptions::IsSecurity()const
{
return pImpl->bSecurity;
}
-/*-- 18.05.01 13:28:35---------------------------------------------------
- -----------------------------------------------------------------------*/
sal_Int32 SvtJavaOptions::GetNetAccess() const
{
return pImpl->nNetAccess;
}
-/*-- 18.05.01 13:28:36---------------------------------------------------
- -----------------------------------------------------------------------*/
rtl::OUString& SvtJavaOptions::GetUserClassPath()const
{
return pImpl->sUserClassPath;
}
-/*-- 18.05.01 13:28:37---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtJavaOptions::SetEnabled(sal_Bool bSet)
{
OSL_ENSURE(!pImpl->bROEnabled, "SvtJavaOptions::SetEnabled()\nYou tried to write on a readonly value!\n");
@@ -286,9 +261,7 @@ void SvtJavaOptions::SetEnabled(sal_Bool bSet)
SetModified();
}
}
-/*-- 18.05.01 13:28:38---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtJavaOptions::SetSecurity(sal_Bool bSet)
{
OSL_ENSURE(!pImpl->bROSecurity, "SvtJavaOptions::SetSecurity()\nYou tried to write on a readonly value!\n");
@@ -298,9 +271,7 @@ void SvtJavaOptions::SetSecurity(sal_Bool bSet)
SetModified();
}
}
-/*-- 18.05.01 13:28:38---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtJavaOptions::SetNetAccess(sal_Int32 nSet)
{
OSL_ENSURE(!pImpl->bRONetAccess, "SvtJavaOptions::SetNetAccess()\nYou tried to write on a readonly value!\n");
@@ -310,9 +281,7 @@ void SvtJavaOptions::SetNetAccess(sal_Int32 nSet)
SetModified();
}
}
-/*-- 18.05.01 13:28:38---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet)
{
OSL_ENSURE(!pImpl->bROUserClassPath, "SvtJavaOptions::SetUserClassPath()\nYou tried to write on a readonly value!\n");
@@ -323,16 +292,12 @@ void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet)
}
}
-/*-- 18.05.01 14:34:32---------------------------------------------------
- -----------------------------------------------------------------------*/
sal_Bool SvtJavaOptions::IsExecuteApplets() const
{
return pImpl->aExecItem.IsExecuteApplets();
}
-/*-- 18.05.01 14:34:32---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet)
{
if(!pImpl->aExecItem.IsReadOnly() && pImpl->aExecItem.IsExecuteApplets() != bSet)
@@ -341,9 +306,7 @@ void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet)
SetModified();
}
}
-/*--10.02.2003 08:40---------------------------------------------------
------------------------------------------------------------------------*/
sal_Bool SvtJavaOptions::IsReadOnly( EOption eOption ) const
{
sal_Bool bRO = sal_True;
@@ -367,3 +330,5 @@ sal_Bool SvtJavaOptions::IsReadOnly( EOption eOption ) const
}
return bRO;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index b17681331935..382ac3f578f3 100755..100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -38,37 +39,38 @@
#include "com/sun/star/util/XMacroExpander.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
#include <rtl/uri.hxx>
-#include <vos/mutex.hxx>
+#include <rtl/instance.hxx>
+#include <osl/mutex.hxx>
#include <i18npool/mslangid.hxx>
#include <tools/debug.hxx>
#include <tools/string.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
+#include <sal/macros.h>
#include <comphelper/processfactory.hxx>
#include <itemholder1.hxx>
-using namespace rtl;
using namespace com::sun::star;
-#define A2OU(x) ::rtl::OUString::createFromAscii( x )
+using ::rtl::OUString;
+using ::rtl::Uri;
+
+#define A2OU(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x ))
#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
#define FILE_PROTOCOL "file:///"
///////////////////////////////////////////////////////////////////////////
-
-static osl::Mutex & GetOwnMutex()
+namespace
{
- static osl::Mutex aMutex;
- return aMutex;
+ class theSvtLinguConfigItemMutex :
+ public rtl::Static< osl::Mutex, theSvtLinguConfigItemMutex > {};
}
-
///////////////////////////////////////////////////////////////////////////
-
static sal_Bool lcl_SetLocale( sal_Int16 &rLanguage, const uno::Any &rVal )
{
sal_Bool bSucc = sal_False;
@@ -167,7 +169,7 @@ class SvtLinguConfigItem : public utl::ConfigItem
SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & );
static sal_Bool GetHdlByName( sal_Int32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False );
- static const uno::Sequence< OUString > & GetPropertyNames();
+ static const uno::Sequence< OUString > GetPropertyNames();
sal_Bool LoadOptions( const uno::Sequence< OUString > &rProperyNames );
sal_Bool SaveOptions( const uno::Sequence< OUString > &rProperyNames );
@@ -209,11 +211,12 @@ public:
SvtLinguConfigItem::SvtLinguConfigItem() :
utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) )
{
- LoadOptions( GetPropertyNames() );
+ const uno::Sequence< OUString > &rPropertyNames = GetPropertyNames();
+ LoadOptions( rPropertyNames );
ClearModified();
// request notify events when properties change
- EnableNotification( GetPropertyNames() );
+ EnableNotification( rPropertyNames );
}
@@ -285,31 +288,26 @@ static struct NamesToHdl
};
-const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames()
+const uno::Sequence< OUString > SvtLinguConfigItem::GetPropertyNames()
{
- static uno::Sequence< OUString > aNames;
- static sal_Bool bInitialized = sal_False;
+ uno::Sequence< OUString > aNames;
- if (!bInitialized)
- {
- sal_Int32 nMax = sizeof(aNamesToHdl) / sizeof(aNamesToHdl[0]);
+ sal_Int32 nMax = SAL_N_ELEMENTS(aNamesToHdl);
- aNames.realloc( nMax );
- OUString *pNames = aNames.getArray();
- sal_Int32 nIdx = 0;
- for (sal_Int32 i = 0; i < nMax; ++i)
- {
- const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName;
- if (pFullPropName)
- pNames[ nIdx++ ] = A2OU( pFullPropName );
- }
- aNames.realloc( nIdx );
- bInitialized = sal_True;
+ aNames.realloc( nMax );
+ OUString *pNames = aNames.getArray();
+ sal_Int32 nIdx = 0;
+ for (sal_Int32 i = 0; i < nMax; ++i)
+ {
+ const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName;
+ if (pFullPropName)
+ pNames[ nIdx++ ] = ::rtl::OUString::createFromAscii( pFullPropName );
}
+ aNames.realloc( nIdx );
+
return aNames;
}
-
sal_Bool SvtLinguConfigItem::GetHdlByName(
sal_Int32 &rnHdl,
const OUString &rPropertyName,
@@ -348,7 +346,7 @@ sal_Bool SvtLinguConfigItem::GetHdlByName(
uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Int32 nHdl;
return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any();
@@ -357,7 +355,7 @@ uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const
uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
uno::Any aRes;
@@ -440,7 +438,7 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
sal_Bool SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bSucc = sal_False;
sal_Int32 nHdl;
@@ -452,7 +450,7 @@ sal_Bool SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const u
sal_Bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any &rValue )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bSucc = sal_False;
if (!rValue.hasValue())
@@ -578,7 +576,7 @@ sal_Bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::
sal_Bool SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
rOptions = aOpt;
return sal_True;
@@ -587,7 +585,7 @@ sal_Bool SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const
sal_Bool SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
aOpt = rOptions;
SetModified();
@@ -598,7 +596,7 @@ sal_Bool SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions )
sal_Bool SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bRes = sal_False;
@@ -721,7 +719,7 @@ sal_Bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProp
if (!IsModified())
return sal_True;
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bRet = sal_False;
const uno::Type &rBOOL = ::getBooleanCppuType();
@@ -786,7 +784,7 @@ sal_Bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProp
sal_Bool SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bReadOnly = sal_False;
sal_Int32 nHdl;
@@ -797,7 +795,7 @@ sal_Bool SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) co
sal_Bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bReadOnly = sal_False;
@@ -845,25 +843,25 @@ sal_Bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const
static SvtLinguConfigItem *pCfgItem = 0;
static sal_Int32 nCfgItemRefCount = 0;
-static const rtl::OUString aG_SupportedDictionaryFormats( A2OU("SupportedDictionaryFormats") );
-static const rtl::OUString aG_Dictionaries( A2OU("Dictionaries") );
-static const rtl::OUString aG_Locations( A2OU("Locations") );
-static const rtl::OUString aG_Format( A2OU("Format") );
-static const rtl::OUString aG_Locales( A2OU("Locales") );
-static const rtl::OUString aG_DisabledDictionaries( A2OU("DisabledDictionaries") );
-static const rtl::OUString aG_LastActiveDictionaries( A2OU("LastActiveDictionaries") );
+static const rtl::OUString aG_SupportedDictionaryFormats(RTL_CONSTASCII_USTRINGPARAM("SupportedDictionaryFormats"));
+static const rtl::OUString aG_Dictionaries(RTL_CONSTASCII_USTRINGPARAM("Dictionaries"));
+static const rtl::OUString aG_Locations(RTL_CONSTASCII_USTRINGPARAM("Locations"));
+static const rtl::OUString aG_Format(RTL_CONSTASCII_USTRINGPARAM("Format"));
+static const rtl::OUString aG_Locales(RTL_CONSTASCII_USTRINGPARAM("Locales"));
+static const rtl::OUString aG_DisabledDictionaries(RTL_CONSTASCII_USTRINGPARAM("DisabledDictionaries"));
+static const rtl::OUString aG_LastActiveDictionaries(RTL_CONSTASCII_USTRINGPARAM("LastActiveDictionaries"));
SvtLinguConfig::SvtLinguConfig()
{
// Global access, must be guarded (multithreading)
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
++nCfgItemRefCount;
}
SvtLinguConfig::~SvtLinguConfig()
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
if (pCfgItem && pCfgItem->IsModified())
pCfgItem->Commit();
@@ -880,7 +878,7 @@ SvtLinguConfig::~SvtLinguConfig()
SvtLinguConfigItem & SvtLinguConfig::GetConfigItem()
{
// Global access, must be guarded (multithreading)
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
if (!pCfgItem)
{
pCfgItem = new SvtLinguConfigItem;
@@ -963,7 +961,7 @@ sal_Bool SvtLinguConfig::GetElementNamesFor(
try
{
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW );
rElementNames = xNA->getElementNames();
bSuccess = true;
@@ -1007,7 +1005,7 @@ sal_Bool SvtLinguConfig::GetSupportedDictionaryFormatsFor(
try
{
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW );
if (xNA->getByName( aG_SupportedDictionaryFormats ) >>= rFormatList)
@@ -1033,7 +1031,7 @@ void SvtLinguConfig::SetOrCreateSupportedDictionaryFormatsFor(
uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() );
uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
xNA = GetOrCreateSetEntry_Impl( xNA, rSetEntry );
@@ -1059,11 +1057,11 @@ static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander()
{
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))) >>= xContext;
if ( xContext.is() )
{
aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander"))),
uno::UNO_QUERY );
xMacroExpander = aG_xMacroExpander;
}
@@ -1123,7 +1121,7 @@ sal_Bool SvtLinguConfig::GetDictionaryEntry(
try
{
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW );
@@ -1175,7 +1173,7 @@ void SvtLinguConfig::SetOrCreateDictionaryEntry(
{
uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() );
uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW );
xNA = GetOrCreateSetEntry_Impl( xNA, rNodeName );
@@ -1201,7 +1199,7 @@ uno::Sequence< rtl::OUString > SvtLinguConfig::GetDisabledDictionaries() const
try
{
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
xNA->getByName( aG_DisabledDictionaries ) >>= aResult;
}
catch (uno::Exception &)
@@ -1217,7 +1215,7 @@ void SvtLinguConfig::SetDisabledDictionaries(
{
uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() );
uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))), uno::UNO_QUERY_THROW );
if (xNA->hasByName( aG_DisabledDictionaries ))
{
uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW );
@@ -1299,20 +1297,20 @@ uno::Reference< util::XChangesBatch > SvtLinguConfig::GetMainUpdateAccess() cons
if (xMgr.is())
{
xConfigurationProvider = uno::Reference< lang::XMultiServiceFactory > (
- xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ) ) ),
+ xMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationProvider"))),
uno::UNO_QUERY_THROW ) ;
}
// get configuration update access
beans::PropertyValue aValue;
- aValue.Name = A2OU( "nodepath" );
- aValue.Value = uno::makeAny( A2OU("org.openoffice.Office.Linguistic") );
+ aValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
+ aValue.Value = uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Linguistic")));
uno::Sequence< uno::Any > aProps(1);
aProps[0] <<= aValue;
m_xMainUpdateAccess = uno::Reference< util::XChangesBatch >(
xConfigurationProvider->createInstanceWithArguments(
- A2OU( "com.sun.star.configuration.ConfigurationUpdateAccess" ), aProps ),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")), aProps),
uno::UNO_QUERY_THROW );
}
catch (uno::Exception &)
@@ -1332,16 +1330,16 @@ rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl(
try
{
uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xImagesNA.set( xImagesNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
+ xImagesNA.set( xImagesNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Images"))), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName( A2OU("ServiceNameEntries") ), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceNameEntries"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW );
- uno::Any aAny( xNA->getByName( A2OU("VendorImagesNode") ) );
+ uno::Any aAny(xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VendorImagesNode"))));
rtl::OUString aVendorImagesNode;
if (aAny >>= aVendorImagesNode)
{
xNA = xImagesNA;
- xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VendorImages"))), uno::UNO_QUERY_THROW );
xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW );
aAny = xNA->getByName( rImageName );
rtl::OUString aTmp;
@@ -1362,13 +1360,13 @@ rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl(
rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage(
- const rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
+ const rtl::OUString &rServiceImplName
+) const
{
rtl::OUString aRes;
if (rServiceImplName.getLength() > 0)
{
- rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarDialogImage_HC" : "SpellAndGrammarDialogImage" ));
+ rtl::OUString aImageName( A2OU( "SpellAndGrammarDialogImage" ));
rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
aRes = aPath;
}
@@ -1377,13 +1375,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage(
rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage(
- const rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
+ const rtl::OUString &rServiceImplName
+) const
{
rtl::OUString aRes;
if (rServiceImplName.getLength() > 0)
{
- rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuSuggestionImage_HC" : "SpellAndGrammarContextMenuSuggestionImage" ));
+ rtl::OUString aImageName( A2OU( "SpellAndGrammarContextMenuSuggestionImage" ));
rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
aRes = aPath;
}
@@ -1392,13 +1390,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage(
rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
- const rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
+ const rtl::OUString &rServiceImplName
+) const
{
rtl::OUString aRes;
if (rServiceImplName.getLength() > 0)
{
- rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuDictionaryImage_HC" : "SpellAndGrammarContextMenuDictionaryImage" ));
+ rtl::OUString aImageName( A2OU( "SpellAndGrammarContextMenuDictionaryImage" ));
rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
aRes = aPath;
}
@@ -1407,13 +1405,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage(
- const ::rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
+ const ::rtl::OUString &rServiceImplName
+) const
{
rtl::OUString aRes;
if (rServiceImplName.getLength() > 0)
{
- rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" ));
+ rtl::OUString aImageName( A2OU( "ThesaurusDialogImage" ));
rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
aRes = aPath;
}
@@ -1422,13 +1420,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
::rtl::OUString SvtLinguConfig::GetSynonymsContextImage(
- const ::rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
+ const ::rtl::OUString &rServiceImplName
+) const
{
rtl::OUString aRes;
if (rServiceImplName.getLength() > 0)
{
- rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" ));
+ rtl::OUString aImageName( A2OU( "SynonymsContextMenuImage" ));
rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
aRes = aPath;
}
@@ -1444,8 +1442,8 @@ bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const
try
{
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Images")) ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VendorImages")) ), uno::UNO_QUERY_THROW );
uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
sal_Int32 nVendors = aElementNames.getLength();
@@ -1484,8 +1482,8 @@ bool SvtLinguConfig::HasGrammarChecker() const
try
{
uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("GrammarCheckerList") ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager")) ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GrammarCheckerList")) ), uno::UNO_QUERY_THROW );
uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
bRes = aElementNames.getLength() > 0;
@@ -1499,3 +1497,4 @@ bool SvtLinguConfig::HasGrammarChecker() const
//////////////////////////////////////////////////////////////////////
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx
index f4b8bbd087ef..b38f4d42fb97 100644
--- a/unotools/source/config/localisationoptions.cxx
+++ b/unotools/source/config/localisationoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/localisationoptions.hxx>
#include <unotools/configmgr.hxx>
@@ -199,13 +194,12 @@ SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()
// Follow assignment use order of values in relation to our list of key names!
DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nI miss some values of configuration keys!\n" );
- // Copy values from list in right order to ouer internal member.
+ // Copy values from list in right order to our 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), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nInvalid property value detected!\n" );
+ if (!seqValues[nProperty].hasValue())
+ continue;
switch( nProperty )
{
case PROPERTYHANDLE_AUTOMNEMONIC : {
@@ -334,19 +328,16 @@ void SvtLocalisationOptions_Impl::SetDialogScale( sal_Int32 nScale )
SetModified();
}
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
Sequence< OUString > SvtLocalisationOptions_Impl::GetPropertyNames()
{
// Build static list of configuration key names.
- static const OUString pProperties[] =
+ const OUString aProperties[] =
{
PROPERTYNAME_AUTOMNEMONIC ,
PROPERTYNAME_DIALOGSCALE ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ Sequence< OUString > seqPropertyNames(aProperties, PROPERTYCOUNT);
// ... and return it.
return seqPropertyNames;
}
@@ -432,27 +423,17 @@ void SvtLocalisationOptions::SetDialogScale( sal_Int32 nScale )
m_pDataContainer->SetDialogScale( nScale );
}
+namespace
+{
+ class theLocalisationOptionsMutex : public rtl::Static<osl::Mutex, theLocalisationOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtLocalisationOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theLocalisationOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx
index 37e3dfac304f..903a3a8c2657 100644
--- a/unotools/source/config/misccfg.cxx
+++ b/unotools/source/config/misccfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,7 +36,7 @@
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <osl/mutex.hxx>
#include <rtl/logfile.hxx>
#include "itemholder1.hxx"
@@ -45,10 +46,9 @@
#define DEF_INCH 2540L
#define DEF_RELTWIP 1440L
-using namespace rtl;
using namespace com::sun::star::uno;
-#define C2U(cChar) OUString::createFromAscii(cChar)
+using ::rtl::OUString;
namespace utl
{
@@ -63,7 +63,7 @@ class SfxMiscCfg : public utl::ConfigItem
sal_Bool bNotFound;
sal_Int32 nYear2000; // two digit year representation
- const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ const com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
void Load();
public:
@@ -88,11 +88,8 @@ public:
};
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
SfxMiscCfg::SfxMiscCfg() :
- ConfigItem(C2U("Office.Common") ),
+ ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common")) ),
bPaperSize(sal_False),
bPaperOrientation (sal_False),
bNotFound (sal_False),
@@ -102,15 +99,10 @@ SfxMiscCfg::SfxMiscCfg() :
Load();
}
-/* -----------------------------02.03.01 15:31--------------------------------
- ---------------------------------------------------------------------------*/
SfxMiscCfg::~SfxMiscCfg()
{
}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
void SfxMiscCfg::SetNotFoundWarning( sal_Bool bSet)
{
@@ -119,10 +111,6 @@ void SfxMiscCfg::SetNotFoundWarning( sal_Bool bSet)
bNotFound = bSet;
}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
void SfxMiscCfg::SetPaperSizeWarning( sal_Bool bSet)
{
if(bPaperSize != bSet)
@@ -130,18 +118,12 @@ void SfxMiscCfg::SetPaperSizeWarning( sal_Bool bSet)
bPaperSize = bSet;
}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
void SfxMiscCfg::SetPaperOrientationWarning( sal_Bool bSet)
{
if(bPaperOrientation != bSet)
SetModified();
bPaperOrientation = bSet;
}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
void SfxMiscCfg::SetYear2000( sal_Int32 nSet )
{
@@ -149,42 +131,30 @@ void SfxMiscCfg::SetYear2000( sal_Int32 nSet )
SetModified();
nYear2000 = nSet;
}
-/* -----------------------------02.03.01 15:31--------------------------------
- ---------------------------------------------------------------------------*/
-const Sequence<OUString>& SfxMiscCfg::GetPropertyNames()
+const Sequence<OUString> SfxMiscCfg::GetPropertyNames()
{
- static Sequence<OUString> aNames;
- if(!aNames.getLength())
+ const OUString pProperties[] =
{
- static const char* aPropNames[] =
- {
- "Print/Warning/PaperSize", // 0
- "Print/Warning/PaperOrientation", // 1
- "Print/Warning/NotFound", // 2
- "DateFormat/TwoDigitYear", // 3
- };
- const int nCount = 4;
- aNames.realloc(nCount);
- OUString* pNames = aNames.getArray();
- for(int i = 0; i < nCount; i++)
- pNames[i] = OUString::createFromAscii(aPropNames[i]);
- }
- return aNames;
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/PaperSize")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/PaperOrientation")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/NotFound")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("DateFormat/TwoDigitYear"))
+ };
+ const Sequence< OUString > seqPropertyNames( pProperties, 4 );
+ return seqPropertyNames;
}
-/* -----------------------------02.03.01 15:31--------------------------------
- ---------------------------------------------------------------------------*/
void SfxMiscCfg::Load()
{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(aNames);
- EnableNotification(aNames);
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(rNames);
+ EnableNotification(rNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == rNames.getLength())
{
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
@@ -199,24 +169,20 @@ void SfxMiscCfg::Load()
}
}
}
-/* -----------------------------02.03.01 15:31--------------------------------
- ---------------------------------------------------------------------------*/
void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
{
Load();
}
-/* -----------------------------02.03.01 15:31--------------------------------
- ---------------------------------------------------------------------------*/
void SfxMiscCfg::Commit()
{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues(aNames.getLength());
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ Sequence<Any> aValues(rNames.getLength());
Any* pValues = aValues.getArray();
const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
{
switch(nProp)
{
@@ -226,7 +192,7 @@ void SfxMiscCfg::Commit()
case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear",
}
}
- PutProperties(aNames, aValues);
+ PutProperties(rNames, aValues);
}
// -----------------------------------------------------------------------
namespace
@@ -308,3 +274,4 @@ void MiscCfg::SetYear2000( sal_Int32 nSet )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index ec2da6bff054..c275a910510e 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/moduleoptions.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -43,6 +38,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -222,7 +218,6 @@ struct FactoryInfo
::rtl::OUString getShortName () const { return sShortName; };
::rtl::OUString getTemplateFile () const { return sTemplateFile; };
::rtl::OUString getWindowAttributes () const { return sWindowAttributes; };
- ::rtl::OUString getEmptyDocumentURL () const { return sEmptyDocumentURL; };
::rtl::OUString getDefaultFilter () const { return sDefaultFilter; };
sal_Bool isDefaultFilterReadonly() const { return bDefaultFilterReadonly; }
sal_Int32 getIcon () const { return nIcon; };
@@ -255,24 +250,6 @@ struct FactoryInfo
}
//---------------------------------------------------------------------------------------------------------
- void setInstalled( sal_Bool bNewInstalled )
- {
- bInstalled = bNewInstalled;
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setFactory( const ::rtl::OUString& sNewFactory )
- {
- sFactory = sNewFactory;
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setShortName( const ::rtl::OUString& sNewShortName )
- {
- sShortName = sNewShortName;
- };
-
- //---------------------------------------------------------------------------------------------------------
void setTemplateFile( const ::rtl::OUString& sNewTemplateFile )
{
if( sTemplateFile != sNewTemplateFile )
@@ -293,16 +270,6 @@ struct FactoryInfo
};
//---------------------------------------------------------------------------------------------------------
- void setEmptyDocumentURL( const ::rtl::OUString& sNewEmptyDocumentURL )
- {
- if( sEmptyDocumentURL != sNewEmptyDocumentURL )
- {
- sEmptyDocumentURL = sNewEmptyDocumentURL;
- bChangedEmptyDocumentURL = sal_True ;
- }
- };
-
- //---------------------------------------------------------------------------------------------------------
void setDefaultFilter( const ::rtl::OUString& sNewDefaultFilter )
{
if( sDefaultFilter != sNewDefaultFilter )
@@ -312,16 +279,6 @@ struct FactoryInfo
}
};
- //---------------------------------------------------------------------------------------------------------
- void setIcon( sal_Int32 nNewIcon )
- {
- if( nNewIcon != nNewIcon )
- {
- nNewIcon = nNewIcon;
- bChangedIcon = sal_True;
- }
- };
-
private:
css::uno::Reference< css::util::XStringSubstitution > getStringSubstitution()
{
@@ -522,7 +479,7 @@ SvtModuleOptions_Impl::~SvtModuleOptions_Impl()
*//*-*************************************************************************************************************/
void SvtModuleOptions_Impl::Notify( const css::uno::Sequence< ::rtl::OUString >& )
{
- OSL_ENSURE( sal_False, "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" );
+ OSL_FAIL( "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" );
}
/*-****************************************************************************************************//**
@@ -724,7 +681,7 @@ sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eMo
case SvtModuleOptions::E_DATABASE : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdatabase"));
break;
default:
- OSL_ASSERT( "unknown factory" );
+ OSL_FAIL( "unknown factory" );
break;
}
@@ -789,7 +746,7 @@ sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eMo
case SvtModuleOptions::E_DATABASE : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/sdatabase?Interactive"));
break;
default:
- OSL_ASSERT( "unknown factory" );
+ OSL_FAIL( "unknown factory" );
break;
}
return sURL;
@@ -1322,6 +1279,10 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const
return nFeature;
}
+namespace
+{
+ class theModuleOptionsMutex : public rtl::Static<osl::Mutex, theModuleOptionsMutex> {};
+}
/*-****************************************************************************************************//**
@short return a reference to a static mutex
@descr These class is threadsafe.
@@ -1338,42 +1299,25 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const
*//*-*****************************************************************************************************/
::osl::Mutex& SvtModuleOptions::impl_GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theModuleOptionsMutex::get();
}
::rtl::OUString SvtModuleOptions::GetModuleName( EModule eModule ) const
{
switch( eModule )
{
- case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_SWEB : { return ::rtl::OUString::createFromAscii("Web"); }
- case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString::createFromAscii("Global"); }
- case SvtModuleOptions::E_SCALC : { return ::rtl::OUString::createFromAscii("Calc"); }
- case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString::createFromAscii("Draw"); }
- case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); }
- case SvtModuleOptions::E_SMATH : { return ::rtl::OUString::createFromAscii("Math"); }
- case SvtModuleOptions::E_SCHART : { return ::rtl::OUString::createFromAscii("Chart"); }
- case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString::createFromAscii("Basic"); }
- case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString::createFromAscii("Database"); }
+ case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); }
+ case SvtModuleOptions::E_SWEB : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Web")); }
+ case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Global")); }
+ case SvtModuleOptions::E_SCALC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Calc")); }
+ case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Draw")); }
+ case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Impress")); }
+ case SvtModuleOptions::E_SMATH : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Math")); }
+ case SvtModuleOptions::E_SCHART : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Chart")); }
+ case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Basic")); }
+ case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Database")); }
default:
- OSL_ASSERT( "unknown module" );
+ OSL_FAIL( "unknown module" );
break;
}
@@ -1384,18 +1328,18 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const
{
switch( eFactory )
{
- case SvtModuleOptions::E_WRITER : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_CALC : { return ::rtl::OUString::createFromAscii("Calc"); }
- case SvtModuleOptions::E_DRAW : { return ::rtl::OUString::createFromAscii("Draw"); }
- case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); }
- case SvtModuleOptions::E_MATH : { return ::rtl::OUString::createFromAscii("Math"); }
- case SvtModuleOptions::E_CHART : { return ::rtl::OUString::createFromAscii("Chart"); }
- case SvtModuleOptions::E_BASIC : { return ::rtl::OUString::createFromAscii("Basic"); }
- case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString::createFromAscii("Database"); }
+ case SvtModuleOptions::E_WRITER : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); }
+ case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); }
+ case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); }
+ case SvtModuleOptions::E_CALC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Calc")); }
+ case SvtModuleOptions::E_DRAW : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Draw")); }
+ case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Impress")); }
+ case SvtModuleOptions::E_MATH : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Math")); }
+ case SvtModuleOptions::E_CHART : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Chart")); }
+ case SvtModuleOptions::E_BASIC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Basic")); }
+ case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Database")); }
default:
- OSL_ASSERT( "unknown factory" );
+ OSL_FAIL( "unknown factory" );
break;
}
@@ -1407,25 +1351,25 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const
-----------------------------------------------*/
SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const ::rtl::OUString& sName)
{
- if (sName.equalsAscii("swriter"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("swriter")))
return E_WRITER;
- if (sName.equalsIgnoreAsciiCaseAscii("swriter/Web")) // sometimes they are registerd for swriter/web :-(
+ if (sName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("swriter/Web"))) // sometimes they are registerd for swriter/web :-(
return E_WRITERWEB;
- if (sName.equalsIgnoreAsciiCaseAscii("swriter/GlobalDocument")) // sometimes they are registerd for swriter/globaldocument :-(
+ if (sName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("swriter/GlobalDocument"))) // sometimes they are registerd for swriter/globaldocument :-(
return E_WRITERGLOBAL;
- if (sName.equalsAscii("scalc"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("scalc")))
return E_CALC;
- if (sName.equalsAscii("sdraw"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdraw")))
return E_DRAW;
- if (sName.equalsAscii("simpress"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("simpress")))
return E_IMPRESS;
- if (sName.equalsAscii("schart"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("schart")))
return E_CHART;
- if (sName.equalsAscii("smath"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("smath")))
return E_MATH;
- if (sName.equalsAscii("sbasic"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sbasic")))
return E_BASIC;
- if (sName.equalsAscii("sdatabase"))
+ if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdatabase")))
return E_DATABASE;
return E_UNKNOWN_FACTORY;
@@ -1473,9 +1417,9 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O
try
{
xFilterCfg = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory")), css::uno::UNO_QUERY);
+ xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory"))), css::uno::UNO_QUERY);
xTypeCfg = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), css::uno::UNO_QUERY);
+ xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection"))), css::uno::UNO_QUERY);
}
catch(const css::uno::RuntimeException&)
{ throw; }
@@ -1485,13 +1429,13 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O
::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor);
// is there already a filter inside the descriptor?
- ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("FilterName"), ::rtl::OUString());
+ ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")), ::rtl::OUString());
if (sFilterName.getLength())
{
try
{
::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sFilterName));
- ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString());
+ ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString());
SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService);
if (eApp != E_UNKNOWN_FACTORY)
@@ -1504,7 +1448,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O
}
// is there already a type inside the descriptor?
- ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("TypeName"), ::rtl::OUString());
+ ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName")), ::rtl::OUString());
if (!sTypeName.getLength())
{
// no :-(
@@ -1521,9 +1465,9 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O
try
{
::comphelper::SequenceAsHashMap stlTypeProps (xTypeCfg->getByName(sTypeName));
- ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString());
+ ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredFilter")), ::rtl::OUString());
::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sPreferredFilter));
- ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString());
+ ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString());
SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService);
if (eApp != E_UNKNOWN_FACTORY)
@@ -1595,3 +1539,4 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::u
return aModule;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx
index c65fd09efd0c..5eee90dd28d9 100644
--- a/unotools/source/config/options.cxx
+++ b/unotools/source/config/options.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,14 +30,8 @@
#include "precompiled_unotools.hxx"
#include "sal/config.h"
-#include <tools/list.hxx>
#include <unotools/options.hxx>
-namespace utl
-{
- DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* )
-}
-
using utl::detail::Options;
using utl::ConfigurationBroadcaster;
@@ -56,13 +51,22 @@ void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListene
{
if ( !mpList )
mpList = new IMPL_ConfigurationListenerList;
- mpList->Insert( pListener );
+ mpList->push_back( pListener );
}
void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pListener )
{
- if ( mpList )
- mpList->Remove( pListener );
+ if ( mpList ) {
+ for ( IMPL_ConfigurationListenerList::iterator it = mpList->begin();
+ it < mpList->end();
+ ++it
+ ) {
+ if ( *it == pListener ) {
+ mpList->erase( it );
+ break;
+ }
+ }
+ }
}
void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint )
@@ -73,9 +77,11 @@ void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint )
{
nHint |= m_nBlockedHint;
m_nBlockedHint = 0;
- if ( mpList )
- for ( sal_uInt32 n=0; n<mpList->Count(); n++ )
- mpList->GetObject(n)->ConfigurationChanged( this, nHint );
+ if ( mpList ) {
+ for ( size_t n = 0; n < mpList->size(); n++ ) {
+ (*mpList)[ n ]->ConfigurationChanged( this, nHint );
+ }
+ }
}
}
@@ -104,3 +110,4 @@ void Options::ConfigurationChanged( ConfigurationBroadcaster*, sal_uInt32 nHint
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx
index cb98e8514358..4aeb603a6717 100644
--- a/unotools/source/config/optionsdlg.cxx
+++ b/unotools/source/config/optionsdlg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,14 +38,15 @@
#include <osl/mutex.hxx>
#include <comphelper/stl_types.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include "itemholder1.hxx"
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::beans ;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
+
#define CFG_FILENAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.OptionsDialog" ) )
#define ROOT_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsDialogGroups" ) )
#define PAGES_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) )
@@ -65,7 +67,7 @@ private:
}
};
- typedef std::hash_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList;
+ typedef boost::unordered_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList;
OUString m_sPathDelimiter;
OptionNodeList m_aOptionNodeList;
@@ -90,20 +92,14 @@ public:
const OUString& _rGroup ) const;
};
-::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex()
+namespace
{
- static ::osl::Mutex *pMutex = 0;
+ class theOptionsDlgOptions_ImplMutex : public rtl::Static<osl::Mutex, theOptionsDlgOptions_ImplMutex>{};
+}
- if( ! pMutex )
- {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( ! pMutex )
- {
- static ::osl::Mutex mutex;
- pMutex = &mutex;
- }
- }
- return *pMutex;
+::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex()
+{
+ return theOptionsDlgOptions_ImplMutex::get();
}
// -----------------------------------------------------------------------
@@ -288,3 +284,4 @@ sal_Bool SvtOptionsDialogOptions::IsOptionHidden(
return m_pImp->IsOptionHidden( _rOption, _rPage, _rGroup );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 613b9056d346..7bfbf487e164 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,8 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
#include <unotools/pathoptions.hxx>
#include <unotools/configitem.hxx>
@@ -44,7 +43,6 @@
#include <unotools/bootstrap.hxx>
#include <unotools/ucbhelper.hxx>
-#include <vos/process.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <com/sun/star/beans/XFastPropertySet.hpp>
@@ -59,16 +57,19 @@
#include <itemholder1.hxx>
#include <vector>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
using namespace osl;
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
using namespace com::sun::star::util;
using namespace com::sun::star::lang;
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OStringToOUString;
+
// define ----------------------------------------------------------------
#define SEARCHPATH_DELIMITER ';'
@@ -110,19 +111,19 @@ enum VarNameProperty
VAR_NEEDS_FILEURL
};
-class NameToHandleMap : public ::std::hash_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > >
+class NameToHandleMap : public ::boost::unordered_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > >
{
public:
inline void free() { NameToHandleMap().swap( *this ); }
};
-class EnumToHandleMap : public ::std::hash_map< sal_Int32, sal_Int32, std::hash< sal_Int32 >, std::equal_to< sal_Int32 > >
+class EnumToHandleMap : public ::boost::unordered_map< sal_Int32, sal_Int32, boost::hash< sal_Int32 >, std::equal_to< sal_Int32 > >
{
public:
inline void free() { EnumToHandleMap().swap( *this ); }
};
-class VarNameToEnumMap : public ::std::hash_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > >
+class VarNameToEnumMap : public ::boost::unordered_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > >
{
public:
inline void free() { VarNameToEnumMap().swap( *this ); }
@@ -263,51 +264,45 @@ static VarNameAttribute aVarNameAttribute[] =
{ SUBSTITUTE_PATH, VAR_NEEDS_SYSTEM_PATH }, // $(path)
};
-#if 0
-// currently unused
-static Sequence< OUString > GetPathPropertyNames()
-{
- const int nCount = sizeof( aPropNames ) / sizeof( PropertyStruct );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i].pPropName );
-
- return aNames;
-}
-#endif
-
// class SvtPathOptions_Impl ---------------------------------------------
const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath )
{
- ::osl::MutexGuard aGuard( m_aMutex );
-
if ( ePath >= SvtPathOptions::PATH_COUNT )
return m_aEmptyString;
- OUString aPathValue;
- String aResult;
- sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ];
-
- // Substitution is done by the service itself using the substition service
- Any a = m_xPathSettings->getFastPropertyValue( nHandle );
- a >>= aPathValue;
- if( ePath == SvtPathOptions::PATH_ADDIN ||
- ePath == SvtPathOptions::PATH_FILTER ||
- ePath == SvtPathOptions::PATH_HELP ||
- ePath == SvtPathOptions::PATH_MODULE ||
- ePath == SvtPathOptions::PATH_PLUGIN ||
- ePath == SvtPathOptions::PATH_STORAGE
- )
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ try
+ {
+ OUString aPathValue;
+ String aResult;
+ sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ];
+
+ // Substitution is done by the service itself using the substition service
+ Any a = m_xPathSettings->getFastPropertyValue( nHandle );
+ a >>= aPathValue;
+ if( ePath == SvtPathOptions::PATH_ADDIN ||
+ ePath == SvtPathOptions::PATH_FILTER ||
+ ePath == SvtPathOptions::PATH_HELP ||
+ ePath == SvtPathOptions::PATH_MODULE ||
+ ePath == SvtPathOptions::PATH_PLUGIN ||
+ ePath == SvtPathOptions::PATH_STORAGE
+ )
+ {
+ // These office paths have to be converted to system pathes
+ utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult );
+ aPathValue = aResult;
+ }
+
+ m_aPathArray[ ePath ] = aPathValue;
+ return m_aPathArray[ ePath ];
+ }
+ catch (UnknownPropertyException &)
{
- // These office paths have to be converted to system pathes
- utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult );
- aPathValue = aResult;
}
- m_aPathArray[ ePath ] = aPathValue;
- return m_aPathArray[ ePath ];
+ return m_aEmptyString;
}
// -----------------------------------------------------------------------
sal_Bool SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const
@@ -482,7 +477,7 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() :
if ( !m_xPathSettings.is() )
{
// #112719#: check for existance
- DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" );
+ OSL_FAIL( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" );
throw RuntimeException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSettings cannot be created" )),
Reference< XInterface >() );
@@ -530,7 +525,7 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() :
}
// Set language type!
- Any aLocale = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE );
+ Any aLocale = ConfigManager::GetConfigManager().GetDirectConfigProperty( ConfigManager::LOCALE );
OUString aLocaleStr;
if ( aLocale >>= aLocaleStr )
{
@@ -541,7 +536,7 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() :
}
else
{
- DBG_ERRORFILE( "wrong any type" );
+ DBG_ASSERT(!aLocale.hasValue(), "wrong any type");
m_aLocale.Language = OStringToOUString(OString("en"), RTL_TEXTENCODING_UTF8);
m_aLocale.Country = OStringToOUString(OString("US"), RTL_TEXTENCODING_UTF8);
m_aLocale.Variant = OStringToOUString(OString(""), RTL_TEXTENCODING_UTF8);
@@ -1060,50 +1055,4 @@ void SvtPathOptions::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPa
pImp->SetPath(ePath, rNewPath);
}
-// class PathService -----------------------------------------------------
-#include <com/sun/star/frame/XConfigManager.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-class PathService : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XConfigManager, ::com::sun::star::lang::XServiceInfo >
-{
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-// class PathService -----------------------------------------------------
-
-void SAL_CALL PathService::addPropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {}
-void SAL_CALL PathService::removePropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {}
-void SAL_CALL PathService::flush( ) throw(::com::sun::star::uno::RuntimeException) {}
-
-::rtl::OUString SAL_CALL PathService::substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException)
-{
- return SvtPathOptions().SubstituteVariable( sText );
-}
-
-::rtl::OUString SAL_CALL PathService::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return OUString::createFromAscii("com.sun.star.comp.unotools.PathService");
-}
-
-sal_Bool SAL_CALL PathService::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException)
-{
- if ( ServiceName.compareToAscii("com.sun.star.config.SpecialConfigManager") == COMPARE_EQUAL )
- return sal_True;
- else
- return sal_False;
-}
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL PathService::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
-{
- Sequence< OUString > aRet(1);
- *aRet.getArray() = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager");
- return aRet;
-}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx
index d723b3c068d4..bf8b5738c818 100644
--- a/unotools/source/config/printwarningoptions.cxx
+++ b/unotools/source/config/printwarningoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/printwarningoptions.hxx>
#include <unotools/configmgr.hxx>
@@ -249,8 +244,8 @@ void SvtPrintWarningOptions_Impl::Notify( const Sequence< rtl::OUString >& )
//*****************************************************************************************************************
Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_PAPERSIZE,
PROPERTYNAME_PAPERORIENTATION,
@@ -260,7 +255,7 @@ Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames()
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
return seqPropertyNames;
}
@@ -395,27 +390,17 @@ void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( sal_Bool bState
m_pDataContainer->SetModifyDocumentOnPrintingAllowed( bState ) ;
}
+namespace
+{
+ class thePrintWarningOptionsMutex : public rtl::Static<osl::Mutex, thePrintWarningOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtPrintWarningOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return thePrintWarningOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx
index 3e99cf2dd327..9b0550a8cdc5 100644
--- a/unotools/source/config/regoptions.cxx
+++ b/unotools/source/config/regoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,6 +35,7 @@
#include <osl/mutex.hxx>
#include <unotools/bootstrap.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/instance.hxx>
//........................................................................
namespace utl
@@ -138,7 +140,7 @@ namespace utl
#define DECLARE_STATIC_LAZY_USTRING( name ) \
static const ::rtl::OUString& lcl_get##name##Name() \
{ \
- static const ::rtl::OUString sName = ::rtl::OUString::createFromAscii( #name ); \
+ static const ::rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM( #name )); \
return sName; \
}
@@ -195,20 +197,15 @@ namespace utl
sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False;
sal_Int32 RegOptionsImpl::s_nInstanceCount = 0;
+ namespace
+ {
+ class theRegOptionsImplMutex : public rtl::Static<osl::Mutex, theRegOptionsImplMutex>{};
+ }
+
//--------------------------------------------------------------------
::osl::Mutex& RegOptionsImpl::getStaticMutex()
{
- static ::osl::Mutex* s_pStaticMutex = NULL;
- if ( !s_pStaticMutex )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !s_pStaticMutex )
- {
- static ::osl::Mutex s_aStaticMutex;
- s_pStaticMutex = &s_aStaticMutex;
- }
- }
- return *s_pStaticMutex;
+ return theRegOptionsImplMutex::get();
}
//--------------------------------------------------------------------
@@ -258,13 +255,13 @@ namespace utl
// create the config node for all our registration information
m_aRegistrationNode = OConfigurationTreeRoot::createWithServiceFactory(
::comphelper::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Common/Help/Registration" )
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Help/Registration"))
);
// cache some data
//the URL to use for online registration
::rtl::OUString sStringValue;
- m_aRegistrationNode.getNodeValue( ::rtl::OUString::createFromAscii( "URL" ) ) >>= sStringValue;
+ m_aRegistrationNode.getNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ) >>= sStringValue;
m_sRegistrationURL = sStringValue;
// the state of the dialog
@@ -548,3 +545,4 @@ namespace utl
} // namespace utl
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 6a30149c555f..83aea5d7cc9f 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
#include <unotools/saveopt.hxx>
#include "rtl/instance.hxx"
#include <unotools/configmgr.hxx>
@@ -46,8 +44,10 @@
#include "itemholder1.hxx"
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
+
+using ::rtl::OUString;
+
namespace css = ::com::sun::star;
class SvtSaveOptions_Impl;
@@ -421,7 +421,7 @@ Sequence< OUString > GetPropertyNames()
// -----------------------------------------------------------------------
SvtSaveOptions_Impl::SvtSaveOptions_Impl()
- : ConfigItem( OUString::createFromAscii("Office.Common/Save") )
+ : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Save")) )
, nAutoSaveTime( 0 )
, bUseUserData( sal_False )
, bBackup( sal_False )
@@ -483,7 +483,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
if ( pValues[nProp] >>= nTemp )
nAutoSaveTime = nTemp;
else {
- DBG_ERROR( "Wrong Type!" );
+ OSL_FAIL( "Wrong Type!" );
};
bROAutoSaveTime = pROStates[nProp];
break;
@@ -584,7 +584,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
}
else
{
- DBG_ERROR( "Wrong Type!" );
+ OSL_FAIL( "Wrong Type!" );
}
}
}
@@ -596,21 +596,21 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
{
css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig(
::utl::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Recovery")),
::comphelper::ConfigurationHelper::E_READONLY);
::comphelper::ConfigurationHelper::readRelativeKey(
xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave;
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Enabled"))) >>= bAutoSave;
::comphelper::ConfigurationHelper::readRelativeKey(
xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime;
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeIntervall"))) >>= nAutoSaveTime;
}
catch(const css::uno::Exception&)
- { DBG_ERROR("Could not find needed informations for AutoSave feature."); }
+ { OSL_FAIL("Could not find needed informations for AutoSave feature."); }
}
SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
@@ -783,19 +783,19 @@ void SvtSaveOptions_Impl::Commit()
css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig(
::utl::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Recovery")),
::comphelper::ConfigurationHelper::E_STANDARD);
::comphelper::ConfigurationHelper::writeRelativeKey(
xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("TimeIntervall"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeIntervall")),
css::uno::makeAny(nAutoSaveTime));
::comphelper::ConfigurationHelper::writeRelativeKey(
xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("Enabled"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Enabled")),
css::uno::makeAny(bAutoSave));
::comphelper::ConfigurationHelper::flush(xCFG);
@@ -827,7 +827,7 @@ public:
const sal_Char cUserDefinedSettings[] = "UserDefinedSettings";
SvtLoadOptions_Impl::SvtLoadOptions_Impl()
- : ConfigItem( OUString::createFromAscii("Office.Common/Load") )
+ : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Load")) )
, bLoadUserDefinedSettings( sal_False )
{
Sequence< OUString > aNames(1);
@@ -1088,3 +1088,4 @@ sal_Bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption ) const
return pImp->pSaveOpt->IsReadOnly(eOption);
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx
index 9e09dcc96dac..800672c3ac95 100644
--- a/unotools/source/config/searchopt.cxx
+++ b/unotools/source/config/searchopt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,13 +37,15 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Any.h>
#include <rtl/logfile.hxx>
+#include <sal/macros.h>
-using namespace rtl;
using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star::i18n;
+using ::rtl::OUString;
+
#define MAX_FLAGS_OFFSET 25
//////////////////////////////////////////////////////////////////////
@@ -81,7 +84,7 @@ public:
SvtSearchOptions_Impl::SvtSearchOptions_Impl() :
- ConfigItem( OUString::createFromAscii( "Office.Common/SearchOptions" ) )
+ ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/SearchOptions")) )
{
RTL_LOGFILE_CONTEXT(aLog, "unotools SvtSearchOptions_Impl::SvtSearchOptions_Impl()");
nFlags = 0x0003FFFF; // set all options values to 'true'
@@ -171,7 +174,7 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const
"IsNotes" // 25
};
- const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] );
+ const int nCount = SAL_N_ELEMENTS( aPropNames );
Sequence< OUString > aNames( nCount );
OUString* pNames = aNames.getArray();
for (sal_Int32 i = 0; i < nCount; ++i)
@@ -213,18 +216,18 @@ sal_Bool SvtSearchOptions_Impl::Load()
SetFlag( i, bVal );
}
else {
- DBG_ERROR( "unexpected index" );
+ OSL_FAIL( "unexpected index" );
}
}
else
{
- DBG_ERROR( "unexpected type" );
+ OSL_FAIL( "unexpected type" );
bSucc = sal_False;
}
}
else
{
- DBG_ERROR( "value missing" );
+ OSL_FAIL( "value missing" );
bSucc = sal_False;
}
}
@@ -634,3 +637,4 @@ void SvtSearchOptions::SetNotes( sal_Bool bVal )
//////////////////////////////////////////////////////////////////////
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index 526e33d1917c..ef4689dc6922 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/securityoptions.hxx>
#include <unotools/configmgr.hxx>
@@ -1029,7 +1024,7 @@ sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption e
Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
{
// Build static list of configuration key names.
- static const OUString pProperties[] =
+ const OUString pProperties[] =
{
PROPERTYNAME_SECUREURL,
PROPERTYNAME_STAROFFICEBASIC,
@@ -1048,7 +1043,7 @@ Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
PROPERTYNAME_MACRO_DISABLE
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
@@ -1171,26 +1166,14 @@ bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const
return m_pDataContainer->IsOptionEnabled( eOption );
}
+namespace
+{
+ class theSecurityOptionsMutex : public rtl::Static<osl::Mutex, theSecurityOptionsMutex>{};
+}
+
Mutex& SvtSecurityOptions::GetInitMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be faster then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theSecurityOptionsMutex::get();
}
@@ -1307,3 +1290,4 @@ EBasicSecurityMode SvtSecurityOptions::GetBasicMode() const
return m_pDataContainer->GetBasicMode();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/sourceviewconfig.cxx b/unotools/source/config/sourceviewconfig.cxx
index cb37db74138d..82b71fbceabb 100644
--- a/unotools/source/config/sourceviewconfig.cxx
+++ b/unotools/source/config/sourceviewconfig.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,8 +38,10 @@
#include <itemholder1.hxx>
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
+
+using ::rtl::OUString;
+
namespace utl
{
class SourceViewConfig_Impl : public utl::ConfigItem
@@ -96,25 +99,19 @@ public:
SourceViewConfig_Impl* SourceViewConfig::m_pImplConfig = 0;
sal_Int32 SourceViewConfig::m_nRefCount = 0;
namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; }
-/* -----------------------------28.08.2002 16:45------------------------------
- ---------------------------------------------------------------------------*/
SourceViewConfig_Impl::SourceViewConfig_Impl() :
- ConfigItem(OUString::createFromAscii("Office.Common/Font/SourceViewFont")),
+ ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Font/SourceViewFont"))),
m_nFontHeight(12),
m_bProportionalFontOnly(sal_False)
{
Load();
}
-/* -----------------------------28.08.2002 16:45------------------------------
- ---------------------------------------------------------------------------*/
SourceViewConfig_Impl::~SourceViewConfig_Impl()
{
}
-/* -----------------------------28.08.2002 16:25------------------------------
- ---------------------------------------------------------------------------*/
Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames()
{
//this list needs exactly to mach the enum PropertyNameIndex
@@ -133,9 +130,6 @@ Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames()
return aNames;
}
-/*-- 28.08.2002 16:37:59---------------------------------------------------
-
- -----------------------------------------------------------------------*/
void SourceViewConfig_Impl::Load()
{
Sequence< OUString > aNames = GetPropertyNames();
@@ -159,16 +153,12 @@ void SourceViewConfig_Impl::Load()
}
}
}
-/*-- 28.08.2002 16:38:00---------------------------------------------------
- -----------------------------------------------------------------------*/
void SourceViewConfig_Impl::Notify( const Sequence< OUString >& )
{
Load();
}
-/*-- 28.08.2002 16:38:00---------------------------------------------------
- -----------------------------------------------------------------------*/
void SourceViewConfig_Impl::Commit()
{
ClearModified();
@@ -190,9 +180,7 @@ void SourceViewConfig_Impl::Commit()
NotifyListeners(0);
}
-/*-- 28.08.2002 16:32:19---------------------------------------------------
- -----------------------------------------------------------------------*/
SourceViewConfig::SourceViewConfig()
{
{
@@ -208,9 +196,7 @@ SourceViewConfig::SourceViewConfig()
m_pImplConfig->AddListener( this );
}
-/*-- 28.08.2002 16:32:19---------------------------------------------------
- -----------------------------------------------------------------------*/
SourceViewConfig::~SourceViewConfig()
{
m_pImplConfig->RemoveListener( this );
@@ -222,47 +208,37 @@ SourceViewConfig::~SourceViewConfig()
DELETEZ( m_pImplConfig );
}
}
-/*-- 28.08.2002 16:32:19---------------------------------------------------
- -----------------------------------------------------------------------*/
const OUString& SourceViewConfig::GetFontName() const
{
return m_pImplConfig->GetFontName();
}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
- -----------------------------------------------------------------------*/
void SourceViewConfig::SetFontName(const OUString& rName)
{
m_pImplConfig->SetFontName(rName);
}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
- -----------------------------------------------------------------------*/
sal_Int16 SourceViewConfig::GetFontHeight() const
{
return m_pImplConfig->GetFontHeight();
}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
- -----------------------------------------------------------------------*/
void SourceViewConfig::SetFontHeight(sal_Int16 nHeight)
{
m_pImplConfig->SetFontHeight(nHeight);
}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
- -----------------------------------------------------------------------*/
sal_Bool SourceViewConfig::IsShowProportionalFontsOnly() const
{
return m_pImplConfig->IsShowProportionalFontsOnly();
}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
- -----------------------------------------------------------------------*/
void SourceViewConfig::SetShowProportionalFontsOnly(sal_Bool bSet)
{
m_pImplConfig->SetShowProportionalFontsOnly(bSet);
}
}
// namespace utl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx
index d6012c0ad84f..edeab14539c0 100644
--- a/unotools/source/config/startoptions.cxx
+++ b/unotools/source/config/startoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/startoptions.hxx>
#include <unotools/configmgr.hxx>
@@ -339,14 +334,14 @@ void SvtStartOptions_Impl::SetConnectionURL( const OUString& sURL )
//*****************************************************************************************************************
Sequence< OUString > SvtStartOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_SHOWINTRO ,
PROPERTYNAME_CONNECTIONURL ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
@@ -432,27 +427,17 @@ void SvtStartOptions::SetConnectionURL( const OUString& sURL )
m_pDataContainer->SetConnectionURL( sURL );
}
+namespace
+{
+ class theStartOptionsMutex : public rtl::Static<osl::Mutex, theStartOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtStartOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theStartOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 64ea0816d210..eb61d75f2483 100755..100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,10 +47,10 @@
using namespace osl;
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
+using ::rtl::OUString;
SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL;
sal_Int32 SvtSysLocaleOptions::nRefCount = 0;
@@ -146,14 +147,14 @@ public:
const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
{
- static const OUString pProperties[] =
+ const OUString pProperties[] =
{
PROPERTYNAME_LOCALE,
PROPERTYNAME_UILOCALE,
PROPERTYNAME_CURRENCY,
PROPERTYNAME_DECIMALSEPARATOR
};
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
return seqPropertyNames;
}
@@ -182,7 +183,6 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
{
for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ )
{
- DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
if ( pValues[nProp].hasValue() )
{
switch ( nProp )
@@ -241,7 +241,6 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
}
}
}
-// UpdateMiscSettings_Impl();
EnableNotification( aNames );
}
@@ -272,19 +271,16 @@ void SvtSysLocaleOptions_Impl::MakeRealLocale()
void SvtSysLocaleOptions_Impl::MakeRealUILocale()
{
- if ( !m_aRealUILocale.Language.getLength() )
+ // as we can't switch UILocale at runtime, we only store changes in the configuration
+ m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString );
+ if ( m_aRealUILocale.Language.getLength() )
{
- // as we can't switch UILocale at runtime, we only store changes in the configuration
- m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString );
- if ( m_aRealUILocale.Language.getLength() )
- {
- m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale );
- }
- else
- {
- m_eRealUILanguage = MsLangId::getSystemUILanguage();
- MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale );
- }
+ m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale );
+ }
+ else
+ {
+ m_eRealUILanguage = MsLangId::getSystemUILanguage();
+ MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale );
}
}
@@ -398,13 +394,12 @@ void SvtSysLocaleOptions_Impl::SetUILocaleString( const OUString& rStr )
if (!m_bROUILocale && rStr != m_aUILocaleString )
{
m_aUILocaleString = rStr;
-/*
+
// as we can't switch UILocale at runtime, we only store changes in the configuration
MakeRealUILocale();
MsLangId::setConfiguredSystemLanguage( m_eRealUILanguage );
SetModified();
NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE );
-*/
}
}
@@ -577,19 +572,12 @@ void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr )
pOptions->SetCurrencyString( rStr );
}
-
-
-/*-- 11.02.2004 13:31:41---------------------------------------------------
-
- -----------------------------------------------------------------------*/
sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const
{
MutexGuard aGuard( GetMutex() );
return pOptions->IsDecimalSeparatorAsLocale();
}
-/*-- 11.02.2004 13:31:41---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet)
{
MutexGuard aGuard( GetMutex() );
@@ -700,3 +688,4 @@ LanguageType SvtSysLocaleOptions::GetRealUILanguage() const
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx
index 25cb7837008f..3ae8aab68de0 100644
--- a/unotools/source/config/undoopt.cxx
+++ b/unotools/source/config/undoopt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,14 +36,14 @@
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <osl/mutex.hxx>
#include <rtl/logfile.hxx>
#include "itemholder1.hxx"
using namespace utl;
-using namespace rtl;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
static SvtUndoOptions_Impl* pOptions = NULL;
static sal_Int32 nRefCount = 0;
@@ -68,7 +69,7 @@ public:
// -----------------------------------------------------------------------
SvtUndoOptions_Impl::SvtUndoOptions_Impl()
- : ConfigItem( OUString::createFromAscii("Office.Common/Undo") )
+ : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Undo")) )
, nUndoCount( 20 )
{
Load();
@@ -119,7 +120,6 @@ void SvtUndoOptions_Impl::Load()
{
for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ )
{
- DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
if ( pValues[nProp].hasValue() )
{
switch ( nProp )
@@ -131,13 +131,13 @@ void SvtUndoOptions_Impl::Load()
nUndoCount = nTemp;
else
{
- DBG_ERROR( "Wrong Type!" );
+ OSL_FAIL( "Wrong Type!" );
}
break;
}
default:
- DBG_ERROR( "Wrong Type!" );
+ OSL_FAIL( "Wrong Type!" );
break;
}
}
@@ -199,3 +199,5 @@ sal_Int32 SvtUndoOptions::GetUndoCount() const
{
return pImp->GetUndoCount();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index 59f4a14548ca..11a781213b4c 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,7 +36,7 @@
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <rtl/logfile.hxx>
#include "itemholder1.hxx"
@@ -54,9 +55,9 @@
#include <unotools/loghelper.hxx>
using namespace utl;
-using namespace rtl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
+using ::rtl::OUString;
namespace css = ::com::sun::star;
@@ -145,30 +146,21 @@ static sal_Int32 nRefCount = 0;
#define READONLY_DEFAULT sal_False
-/*-- 16.06.2009 14:22:56---------------------------------------------------
-
- -----------------------------------------------------------------------*/
SvtUserConfigChangeListener_Impl::SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent) :
m_rParent( rParent )
{
}
-/*-- 16.06.2009 14:22:56---------------------------------------------------
- -----------------------------------------------------------------------*/
SvtUserConfigChangeListener_Impl::~SvtUserConfigChangeListener_Impl()
{
}
-/*-- 16.06.2009 14:22:56---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtUserConfigChangeListener_Impl::changesOccurred( const util::ChangesEvent& rEvent ) throw(RuntimeException)
{
if(rEvent.Changes.getLength())
m_rParent.Notify();
}
-/*-- 16.06.2009 14:22:56---------------------------------------------------
- -----------------------------------------------------------------------*/
void SvtUserConfigChangeListener_Impl::disposing( const lang::EventObject& rSource ) throw(RuntimeException)
{
try
@@ -212,7 +204,7 @@ SvtUserOptions_Impl::SvtUserOptions_Impl() :
LogHelper::logIt(ex);
}
- Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE );
+ Any aAny = ConfigManager::GetConfigManager().GetDirectConfigProperty( ConfigManager::LOCALE );
::rtl::OUString aLocale;
if ( aAny >>= aLocale )
m_aLocale = aLocale;
@@ -234,7 +226,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_so) >>= sCompany;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_so) >>= sCompany;
}
catch ( const css::uno::Exception& ex )
{
@@ -250,7 +243,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
}
catch ( const css::uno::Exception& ex )
{
@@ -266,7 +260,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_ssn) >>= sLastName;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_ssn) >>= sLastName;
}
catch ( const css::uno::Exception& ex )
{
@@ -282,7 +277,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sinitials) >>= sID;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sinitials) >>= sID;
}
catch ( const css::uno::Exception& ex )
{
@@ -298,7 +294,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sstreet) >>= sStreet;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sstreet) >>= sStreet;
}
catch ( const css::uno::Exception& ex )
{
@@ -314,7 +311,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sl) >>= sCity;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sl) >>= sCity;
}
catch ( const css::uno::Exception& ex )
{
@@ -330,7 +328,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sst) >>= sState;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sst) >>= sState;
}
catch ( const css::uno::Exception& ex )
{
@@ -346,7 +345,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_spostalcode) >>= sZip;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_spostalcode) >>= sZip;
}
catch ( const css::uno::Exception& ex )
{
@@ -362,7 +362,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sc) >>= sCountry;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sc) >>= sCountry;
}
catch ( const css::uno::Exception& ex )
{
@@ -378,7 +379,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sposition) >>= sPosition;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sposition) >>= sPosition;
}
catch ( const css::uno::Exception& ex )
{
@@ -394,7 +396,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_stitle) >>= sTitle;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_stitle) >>= sTitle;
}
catch ( const css::uno::Exception& ex )
{
@@ -410,7 +413,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome;
}
catch ( const css::uno::Exception& ex )
{
@@ -426,7 +430,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork;
}
catch ( const css::uno::Exception& ex )
{
@@ -442,7 +447,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax;
}
catch ( const css::uno::Exception& ex )
{
@@ -458,7 +464,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_smail) >>= sEmail;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_smail) >>= sEmail;
}
catch ( const css::uno::Exception& ex )
{
@@ -474,7 +481,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber;
}
catch ( const css::uno::Exception& ex )
{
@@ -490,7 +498,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sfathersname) >>= sFathersName;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sfathersname) >>= sFathersName;
}
catch ( const css::uno::Exception& ex )
{
@@ -506,7 +515,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl()
try
{
- m_xData->getPropertyValue(s_sapartment) >>= sApartment;
+ if (m_xData.is())
+ m_xData->getPropertyValue(s_sapartment) >>= sApartment;
}
catch ( const css::uno::Exception& ex )
{
@@ -520,7 +530,8 @@ void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany )
{
try
{
- m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -533,7 +544,8 @@ void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName )
{
try
{
- m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -546,7 +558,8 @@ void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName )
{
try
{
- m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -558,7 +571,8 @@ void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID )
{
try
{
- m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -571,7 +585,8 @@ void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet )
{
try
{
- m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -584,7 +599,8 @@ void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity )
{
try
{
- m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -597,7 +613,8 @@ void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState )
{
try
{
- m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -610,7 +627,8 @@ void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip )
{
try
{
- m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -623,7 +641,8 @@ void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry )
{
try
{
- m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -636,7 +655,8 @@ void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition )
{
try
{
- m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -649,7 +669,8 @@ void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle )
{
try
{
- m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -662,7 +683,8 @@ void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHom
{
try
{
- m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -675,7 +697,8 @@ void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWor
{
try
{
- m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -688,7 +711,8 @@ void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax )
{
try
{
- m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -701,7 +725,8 @@ void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail )
{
try
{
- m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -714,7 +739,8 @@ void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNum
{
try
{
- m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -727,7 +753,8 @@ void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName )
{
try
{
- m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -740,7 +767,8 @@ void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment )
{
try
{
- m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment)));
+ if (m_xData.is())
+ m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment)));
::comphelper::ConfigurationHelper::flush(m_xCfg);
}
catch ( const css::uno::Exception& ex)
@@ -758,7 +786,7 @@ void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment )
sFullName = GetFirstName();
sFullName.trim();
if ( sFullName.getLength() )
- sFullName += ::rtl::OUString::createFromAscii(" ");
+ sFullName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
sFullName += GetLastName();
sFullName.trim();
@@ -957,27 +985,14 @@ SvtUserOptions::~SvtUserOptions()
// -----------------------------------------------------------------------
+namespace
+{
+ class theUserOptionsMutex : public rtl::Static<osl::Mutex, theUserOptionsMutex>{};
+}
+
::osl::Mutex& SvtUserOptions::GetInitMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if ( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again -
- // because another instance of our class will be faster then this instance!
- if ( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theUserOptionsMutex::get();
}
// -----------------------------------------------------------------------
@@ -1295,3 +1310,5 @@ sal_Bool SvtUserOptions::IsTokenReadonly( sal_uInt16 nToken ) const
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetToken( nToken );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx
index f76ce48eebdf..9fe4aba17ed7 100644
--- a/unotools/source/config/viewoptions.cxx
+++ b/unotools/source/config/viewoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,7 +35,7 @@
#include <unotools/viewoptions.hxx>
#include <com/sun/star/uno/Any.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -103,7 +104,6 @@ namespace css = ::com::sun::star;
sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); \
sMsg.append (SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION.Message); \
sMsg.appendAscii("\"" ); \
- OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); \
}
//_________________________________________________________________________________________________________________
@@ -272,7 +272,7 @@ struct IMPL_TStringHashCode
}
};
-typedef ::std::hash_map< ::rtl::OUString ,
+typedef ::boost::unordered_map< ::rtl::OUString ,
IMPL_TViewData ,
IMPL_TStringHashCode ,
::std::equal_to< ::rtl::OUString > > IMPL_TViewHash;
@@ -859,7 +859,7 @@ SvtViewOptions::SvtViewOptions( EViewType eType ,
}
}
break;
- default : OSL_ENSURE( sal_False, "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" );
+ default : OSL_FAIL( "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" );
}
}
@@ -1225,29 +1225,17 @@ void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName ,
}
}
+namespace
+{
+ class theViewOptionsMutex : public rtl::Static<osl::Mutex, theViewOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
::osl::Mutex& SvtViewOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theViewOptionsMutex::get();
}
void SvtViewOptions::AcquireOptions()
@@ -1299,3 +1287,5 @@ void SvtViewOptions::ReleaseOptions()
m_pDataContainer_Windows = NULL;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx
index aebac3377510..e465ac439981 100644
--- a/unotools/source/config/workingsetoptions.cxx
+++ b/unotools/source/config/workingsetoptions.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,12 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
#include <unotools/workingsetoptions.hxx>
#include <unotools/configmgr.hxx>
@@ -295,13 +290,13 @@ void SvtWorkingSetOptions_Impl::SetWindowList( const Sequence< OUString >& seqWi
//*****************************************************************************************************************
Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_WINDOWLIST ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
@@ -367,27 +362,17 @@ void SvtWorkingSetOptions::SetWindowList( const Sequence< OUString >& seqWindowL
m_pDataContainer->SetWindowList( seqWindowList );
}
+namespace
+{
+ class theWorkingSetOptionsMutex : public rtl::Static<osl::Mutex, theWorkingSetOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
Mutex& SvtWorkingSetOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theWorkingSetOptionsMutex::get();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/xmlaccelcfg.cxx b/unotools/source/config/xmlaccelcfg.cxx
index a446c60bbdc5..fbf33a889ca5 100644
--- a/unotools/source/config/xmlaccelcfg.cxx
+++ b/unotools/source/config/xmlaccelcfg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,10 +35,11 @@
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <cppuhelper/implbase1.hxx>
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::xml::sax;
+using ::rtl::OUString;
+
#define ELEMENT_ACCELERATORLIST "acceleratorlist"
#define ELEMENT_ACCELERATORITEM "item"
@@ -376,7 +378,7 @@ void OWriteAccelatorDocumentHandler::WriteAcceleratorDocument()
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
std::list< SvtAcceleratorConfigItem>::const_iterator p;
- for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); p++ )
+ for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); ++p )
WriteAcceleratorItem( *p );
m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )) );
@@ -413,3 +415,5 @@ void OWriteAccelatorDocumentHandler::WriteAcceleratorItem(
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )) );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */