summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/unotools/configitem.hxx15
-rw-r--r--unotools/source/config/configitem.cxx107
-rw-r--r--unotools/source/config/syslocaleoptions.cxx165
-rw-r--r--vcl/source/gdi/configsettings.cxx6
-rw-r--r--vcl/unx/generic/dtrans/config.cxx45
5 files changed, 134 insertions, 204 deletions
diff --git a/include/unotools/configitem.hxx b/include/unotools/configitem.hxx
index 99aeae948d2a..9f3c86cc2fab 100644
--- a/include/unotools/configitem.hxx
+++ b/include/unotools/configitem.hxx
@@ -62,7 +62,6 @@ namespace utl
class ConfigChangeListener_Impl;
class ConfigManager;
- struct ConfigItem_Impl;
class UNOTOOLS_DLLPUBLIC ConfigItem : public ConfigurationBroadcaster
{
@@ -74,9 +73,11 @@ namespace utl
m_xHierarchyAccess;
com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
xChangeLstnr;
- ConfigItem_Impl* pImpl;
+ sal_Int16 m_nMode;
+ bool m_bIsModified;
+ bool m_bEnableInternalNotification;
+ sal_Int16 m_nInValueChange;
- ConfigItem();//
void RemoveChangesListener();
void CallNotify(
const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
@@ -165,18 +166,14 @@ namespace utl
const OUString& GetSubTreeName() const {return sSubTree;}
- sal_Bool IsModified() const;
+ bool IsModified() const;
/** writes the changed values into the sub tree. Always called in the Dtor of the derived class. */
virtual void Commit()=0;
- sal_Bool IsInValueChange() const;
+ bool IsInValueChange() const;
sal_Int16 GetMode() const;
-
- /** checks if the configuration manager used by this item is valid.
- */
- sal_Bool IsValidConfigMgr() const;
};
}//namespace utl
#endif // INCLUDED_UNOTOOLS_CONFIGITEM_HXX
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index 4119983f8e68..d3127c873cae 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -91,23 +91,6 @@ namespace utl{
//XEventListener
virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
};
-
-struct ConfigItem_Impl
-{
- utl::ConfigManager* pManager;
- sal_Int16 nMode;
- sal_Bool bIsModified;
- sal_Bool bEnableInternalNotification;
-
- sal_Int16 nInValueChange;
- ConfigItem_Impl() :
- pManager(0),
- nMode(0),
- bIsModified(sal_False),
- bEnableInternalNotification(sal_False),
- nInValueChange(0)
- {}
-};
}
class ValueCounter_Impl
@@ -124,28 +107,6 @@ public:
}
};
-namespace
-{
- // helper to achieve exception - safe handling of an Item under construction
- template <class TYP>
- class AutoDeleter // : Noncopyable
- {
- TYP* m_pItem;
- public:
- AutoDeleter(TYP * pItem)
- : m_pItem(pItem)
- {
- }
-
- ~AutoDeleter()
- {
- delete m_pItem;
- }
-
- void keep() { m_pItem = 0; }
- };
-}
-
ConfigChangeListener_Impl::ConfigChangeListener_Impl(
ConfigItem& rItem, const Sequence< OUString >& rNames) :
pParent(&rItem),
@@ -206,33 +167,21 @@ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) thro
ConfigItem::ConfigItem(const OUString &rSubTree, sal_Int16 nSetMode ) :
sSubTree(rSubTree),
- pImpl(new ConfigItem_Impl)
+ m_nMode(nSetMode),
+ m_bIsModified(false),
+ m_bEnableInternalNotification(false),
+ m_nInValueChange(0)
{
- AutoDeleter<ConfigItem_Impl> aNewImpl(pImpl);
-
- pImpl->pManager = &ConfigManager::getConfigManager();
- pImpl->nMode = nSetMode;
if(0 != (nSetMode&CONFIG_MODE_RELEASE_TREE))
- pImpl->pManager->addConfigItem(*this);
+ ConfigManager::getConfigManager().addConfigItem(*this);
else
- m_xHierarchyAccess = pImpl->pManager->addConfigItem(*this);
-
- aNewImpl.keep();
-}
-
-sal_Bool ConfigItem::IsValidConfigMgr() const
-{
- return pImpl->pManager != 0;
+ m_xHierarchyAccess = ConfigManager::getConfigManager().addConfigItem(*this);
}
ConfigItem::~ConfigItem()
{
- if(pImpl->pManager)
- {
- RemoveChangesListener();
- pImpl->pManager->removeConfigItem(*this);
- }
- delete pImpl;
+ RemoveChangesListener();
+ ConfigManager::getConfigManager().removeConfigItem(*this);
}
void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPropertyNames )
@@ -240,7 +189,7 @@ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPro
// the call is forwarded to the virtual Notify() method
// it is pure virtual, so all classes deriving from ConfigItem have to decide how they
// want to notify listeners
- if(!IsInValueChange() || pImpl->bEnableInternalNotification)
+ if(!IsInValueChange() || m_bEnableInternalNotification)
Notify(rPropertyNames);
}
@@ -250,7 +199,7 @@ void ConfigItem::impl_packLocalizedProperties( const Sequence< OUString >&
{
// Safe impossible cases.
// This method should be called for special ConfigItem-mode only!
- OSL_ENSURE( ((pImpl->nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES), "ConfigItem::impl_packLocalizedProperties()\nWrong call of this method detected!\n" );
+ OSL_ENSURE( ((m_nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES), "ConfigItem::impl_packLocalizedProperties()\nWrong call of this method detected!\n" );
sal_Int32 nSourceCounter ; // used to step during input lists
sal_Int32 nSourceSize ; // marks end of loop over input lists
@@ -323,7 +272,7 @@ void ConfigItem::impl_unpackLocalizedProperties( const Sequence< OUString >
{
// Safe impossible cases.
// This method should be called for special ConfigItem-mode only!
- OSL_ENSURE( ((pImpl->nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES), "ConfigItem::impl_unpackLocalizedProperties()\nWrong call of this method detected!\n" );
+ OSL_ENSURE( ((m_nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES), "ConfigItem::impl_unpackLocalizedProperties()\nWrong call of this method detected!\n" );
sal_Int32 nSourceCounter ; // used to step during input lists
sal_Int32 nSourceSize ; // marks end of loop over input lists
@@ -496,7 +445,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
}
// In special mode "ALL_LOCALES" we must convert localized values to Sequence< PropertyValue >.
- if((pImpl->nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES)
+ if((m_nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES)
{
Sequence< Any > lValues;
impl_packLocalizedProperties( rNames, aRet, lValues );
@@ -509,7 +458,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames,
const Sequence< Any>& rValues)
{
- ValueCounter_Impl aCounter(pImpl->nInValueChange);
+ ValueCounter_Impl aCounter(m_nInValueChange);
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
Reference<XNameReplace> xTopNodeReplace(xHierarchyAccess, UNO_QUERY);
sal_Bool bRet = xHierarchyAccess.is() && xTopNodeReplace.is();
@@ -520,7 +469,7 @@ sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames,
const OUString* pNames = NULL ;
const Any* pValues = NULL ;
sal_Int32 nNameCount ;
- if(( pImpl->nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES )
+ if(( m_nMode & CONFIG_MODE_ALL_LOCALES ) == CONFIG_MODE_ALL_LOCALES )
{
// If ConfigItem works in "ALL_LOCALES"-mode ... we must support a Sequence< PropertyValue >
// as value of an localized configuration entry!
@@ -590,8 +539,8 @@ sal_Bool ConfigItem::EnableNotification(const Sequence< OUString >& rNames,
sal_Bool bEnableInternalNotification )
{
- OSL_ENSURE(0 == (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "notification in CONFIG_MODE_RELEASE_TREE mode not possible");
- pImpl->bEnableInternalNotification = bEnableInternalNotification;
+ OSL_ENSURE(0 == (m_nMode&CONFIG_MODE_RELEASE_TREE), "notification in CONFIG_MODE_RELEASE_TREE mode not possible");
+ m_bEnableInternalNotification = bEnableInternalNotification;
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
Reference<XChangesNotifier> xChgNot(xHierarchyAccess, UNO_QUERY);
if(!xChgNot.is())
@@ -743,7 +692,7 @@ Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode, ConfigNameF
sal_Bool ConfigItem::ClearNodeSet(const OUString& rNode)
{
- ValueCounter_Impl aCounter(pImpl->nInValueChange);
+ ValueCounter_Impl aCounter(m_nInValueChange);
sal_Bool bRet = sal_False;
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
if(xHierarchyAccess.is())
@@ -781,7 +730,7 @@ sal_Bool ConfigItem::ClearNodeSet(const OUString& rNode)
sal_Bool ConfigItem::ClearNodeElements(const OUString& rNode, Sequence< OUString >& rElements)
{
- ValueCounter_Impl aCounter(pImpl->nInValueChange);
+ ValueCounter_Impl aCounter(m_nInValueChange);
sal_Bool bRet = sal_False;
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
if(xHierarchyAccess.is())
@@ -855,7 +804,7 @@ Sequence< OUString > lcl_extractSetPropertyNames( const Sequence< PropertyValue
sal_Bool ConfigItem::SetSetProperties(
const OUString& rNode, Sequence< PropertyValue > rValues)
{
- ValueCounter_Impl aCounter(pImpl->nInValueChange);
+ ValueCounter_Impl aCounter(m_nInValueChange);
sal_Bool bRet = sal_True;
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
if(xHierarchyAccess.is())
@@ -954,7 +903,7 @@ sal_Bool ConfigItem::SetSetProperties(
sal_Bool ConfigItem::ReplaceSetProperties(
const OUString& rNode, Sequence< PropertyValue > rValues)
{
- ValueCounter_Impl aCounter(pImpl->nInValueChange);
+ ValueCounter_Impl aCounter(m_nInValueChange);
sal_Bool bRet = sal_True;
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
if(xHierarchyAccess.is())
@@ -1091,7 +1040,7 @@ sal_Bool ConfigItem::ReplaceSetProperties(
sal_Bool ConfigItem::AddNode(const OUString& rNode, const OUString& rNewNode)
{
- ValueCounter_Impl aCounter(pImpl->nInValueChange);
+ ValueCounter_Impl aCounter(m_nInValueChange);
sal_Bool bRet = sal_True;
Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree();
if(xHierarchyAccess.is())
@@ -1154,27 +1103,27 @@ sal_Bool ConfigItem::AddNode(const OUString& rNode, const OUString& rNewNode)
sal_Int16 ConfigItem::GetMode() const
{
- return pImpl->nMode;
+ return m_nMode;
}
void ConfigItem::SetModified()
{
- pImpl->bIsModified = sal_True;
+ m_bIsModified = true;
}
void ConfigItem::ClearModified()
{
- pImpl->bIsModified = sal_False;
+ m_bIsModified = false;
}
-sal_Bool ConfigItem::IsModified() const
+bool ConfigItem::IsModified() const
{
- return pImpl->bIsModified;
+ return m_bIsModified;
}
-sal_Bool ConfigItem::IsInValueChange() const
+bool ConfigItem::IsInValueChange() const
{
- return pImpl->nInValueChange > 0;
+ return m_nInValueChange > 0;
}
Reference< XHierarchicalNameAccess> ConfigItem::GetTree()
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 806d58e1eb03..67c7de50d0fb 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -152,103 +152,100 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
, m_bROIgnoreLanguageChange(false)
{
- if ( IsValidConfigMgr() )
+ const Sequence< OUString > aNames = GetPropertyNames();
+ Sequence< Any > aValues = GetProperties( aNames );
+ Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames );
+ const Any* pValues = aValues.getConstArray();
+ const sal_Bool* pROStates = aROStates.getConstArray();
+ DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
+ DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" );
+ if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() )
{
- const Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames );
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" );
- if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() )
+ for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ )
{
- for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ )
+ if ( pValues[nProp].hasValue() )
{
- if ( pValues[nProp].hasValue() )
+ switch ( nProp )
{
- switch ( nProp )
+ case PROPERTYHANDLE_LOCALE :
{
- case PROPERTYHANDLE_LOCALE :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aLocaleString = aStr;
- else
- {
- SAL_WARN( "unotools.config", "Wrong property type!" );
- }
- m_bROLocale = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_UILOCALE :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aUILocaleString = aStr;
- else
- {
- SAL_WARN( "unotools.config", "Wrong property type!" );
- }
- m_bROUILocale = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_CURRENCY :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aCurrencyString = aStr;
- else
- {
- SAL_WARN( "unotools.config", "Wrong property type!" );
- }
- m_bROCurrency = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_DECIMALSEPARATOR:
+ OUString aStr;
+ if ( pValues[nProp] >>= aStr )
+ m_aLocaleString = aStr;
+ else
{
- bool bValue = false;
- if ( pValues[nProp] >>= bValue )
- m_bDecimalSeparator = bValue;
- else
- {
- SAL_WARN( "unotools.config", "Wrong property type!" );
- }
- m_bRODecimalSeparator = pROStates[nProp];
+ SAL_WARN( "unotools.config", "Wrong property type!" );
}
- break;
- case PROPERTYHANDLE_DATEPATTERNS :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aDatePatternsString = aStr;
- else
- {
- SAL_WARN( "unotools.config", "Wrong property type!" );
- }
- m_bRODatePatterns = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_IGNORELANGCHANGE :
- {
- bool bValue = false;
- if ( pValues[nProp] >>= bValue )
- m_bIgnoreLanguageChange = bValue;
- else
- {
- SAL_WARN( "unotools.config", "Wrong property type!" );
- }
- m_bROIgnoreLanguageChange = pROStates[nProp];
- }
- break;
- default:
+ m_bROLocale = pROStates[nProp];
+ }
+ break;
+ case PROPERTYHANDLE_UILOCALE :
+ {
+ OUString aStr;
+ if ( pValues[nProp] >>= aStr )
+ m_aUILocaleString = aStr;
+ else
+ {
SAL_WARN( "unotools.config", "Wrong property type!" );
+ }
+ m_bROUILocale = pROStates[nProp];
+ }
+ break;
+ case PROPERTYHANDLE_CURRENCY :
+ {
+ OUString aStr;
+ if ( pValues[nProp] >>= aStr )
+ m_aCurrencyString = aStr;
+ else
+ {
+ SAL_WARN( "unotools.config", "Wrong property type!" );
+ }
+ m_bROCurrency = pROStates[nProp];
+ }
+ break;
+ case PROPERTYHANDLE_DECIMALSEPARATOR:
+ {
+ bool bValue = false;
+ if ( pValues[nProp] >>= bValue )
+ m_bDecimalSeparator = bValue;
+ else
+ {
+ SAL_WARN( "unotools.config", "Wrong property type!" );
+ }
+ m_bRODecimalSeparator = pROStates[nProp];
+ }
+ break;
+ case PROPERTYHANDLE_DATEPATTERNS :
+ {
+ OUString aStr;
+ if ( pValues[nProp] >>= aStr )
+ m_aDatePatternsString = aStr;
+ else
+ {
+ SAL_WARN( "unotools.config", "Wrong property type!" );
+ }
+ m_bRODatePatterns = pROStates[nProp];
+ }
+ break;
+ case PROPERTYHANDLE_IGNORELANGCHANGE :
+ {
+ bool bValue = false;
+ if ( pValues[nProp] >>= bValue )
+ m_bIgnoreLanguageChange = bValue;
+ else
+ {
+ SAL_WARN( "unotools.config", "Wrong property type!" );
+ }
+ m_bROIgnoreLanguageChange = pROStates[nProp];
}
+ break;
+ default:
+ SAL_WARN( "unotools.config", "Wrong property type!" );
}
}
}
- EnableNotification( aNames );
}
+ EnableNotification( aNames );
MakeRealLocale();
MakeRealUILocale();
diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx
index 9b6dcdd2eed9..75ea7eb39034 100644
--- a/vcl/source/gdi/configsettings.cxx
+++ b/vcl/source/gdi/configsettings.cxx
@@ -61,9 +61,6 @@ SettingsConfigItem::~SettingsConfigItem()
void SettingsConfigItem::Commit()
{
- if( ! IsValidConfigMgr() )
- return;
-
boost::unordered_map< OUString, SmallOUStrMap, OUStringHash >::const_iterator group;
for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group )
@@ -96,9 +93,6 @@ void SettingsConfigItem::Notify( const Sequence< OUString >& )
void SettingsConfigItem::getValues()
{
- if( ! IsValidConfigMgr() )
- return;
-
m_aSettings.clear();
Sequence< OUString > aNames( GetNodeNames( OUString() ) );
diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx
index 05a7d678ed00..a359dc77a921 100644
--- a/vcl/unx/generic/dtrans/config.cxx
+++ b/vcl/unx/generic/dtrans/config.cxx
@@ -71,42 +71,35 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
CONFIG_MODE_DELAYED_UPDATE ),
m_nSelectionTimeout( 3 )
{
- if( IsValidConfigMgr() )
- {
- Sequence< OUString > aKeys( 1 );
- aKeys.getArray()[0] = OUString( SELECTION_PROPERTY );
- Sequence< Any > aValues = GetProperties( aKeys );
+ Sequence< OUString > aKeys( 1 );
+ aKeys.getArray()[0] = OUString( SELECTION_PROPERTY );
+ Sequence< Any > aValues = GetProperties( aKeys );
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
+ fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
#endif
- Any* pValue = aValues.getArray();
- for( int i = 0; i < aValues.getLength(); i++, pValue++ )
+ Any* pValue = aValues.getArray();
+ for( int i = 0; i < aValues.getLength(); i++, pValue++ )
+ {
+ if( pValue->getValueTypeClass() == TypeClass_STRING )
{
- if( pValue->getValueTypeClass() == TypeClass_STRING )
+ const OUString* pLine = (const OUString*)pValue->getValue();
+ if( !pLine->isEmpty() )
{
- const OUString* pLine = (const OUString*)pValue->getValue();
- if( !pLine->isEmpty() )
- {
- m_nSelectionTimeout = pLine->toInt32();
- if( m_nSelectionTimeout < 1 )
- m_nSelectionTimeout = 1;
- }
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "found SelectionTimeout \"%s\"\n",
- OUStringToOString( *pLine, osl_getThreadTextEncoding() ).getStr() );
-#endif
+ m_nSelectionTimeout = pLine->toInt32();
+ if( m_nSelectionTimeout < 1 )
+ m_nSelectionTimeout = 1;
}
#if OSL_DEBUG_LEVEL > 1
- else
- fprintf( stderr, "found SelectionTimeout of type \"%s\"\n",
- OUStringToOString( pValue->getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() );
+ fprintf( stderr, "found SelectionTimeout \"%s\"\n",
+ OUStringToOString( *pLine, osl_getThreadTextEncoding() ).getStr() );
#endif
}
- }
#if OSL_DEBUG_LEVEL > 1
- else
- fprintf( stderr, "no valid configmanager, could not read timeout setting\n" );
+ else
+ fprintf( stderr, "found SelectionTimeout of type \"%s\"\n",
+ OUStringToOString( pValue->getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() );
#endif
+ }
}
/*