Kaydet (Commit) aebf5bf2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#52232 ConfigurationSet wrapper unusable for localized properties

The comphelper::ConfigurationSet wrapper, used by the automatically generated
headers to access the configuration data from C++, is based on
com.sun.star.configuration.ReadOnlyAccess/ReadWriteAcess that provide an all-
locales view of the configuration data, i.e., a localized property is represented as a UNO object implementing various container interfaces (to access the per-locale values) instead of a plain value.

Hence,

  xLeaveAccess->getByName(C2U("Label")) >>= sLeafLabel;

silently changed its meaning, now silently failing to extract a string and
leaving sLeafLabel empty, which in turn causes the labels of extension option
pages to disappear from the "Tools - Options..." dialog.

This partially reverts commit 161c3f17 "Some
more comphelper/configurationhelper clean up."

Change-Id: I584c682ea6a7c8b9444b34f1867cc553ad160802
üst ea968972
...@@ -138,6 +138,7 @@ struct LastPageSaver ...@@ -138,6 +138,7 @@ struct LastPageSaver
// class OfaTreeOptionsDialog -------------------------------------------- // class OfaTreeOptionsDialog --------------------------------------------
namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } } namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } } } }
namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } } namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } }
...@@ -191,8 +192,12 @@ private: ...@@ -191,8 +192,12 @@ private:
com::sun::star::lang::XMultiServiceFactory >& xMFac, com::sun::star::lang::XMultiServiceFactory >& xMFac,
const com::sun::star::uno::Reference< const com::sun::star::uno::Reference<
com::sun::star::frame::XFrame >& xFrame ); com::sun::star::frame::XFrame >& xFrame );
Module* LoadModule( const rtl::OUString& rModuleIdentifier ); Module* LoadModule( const rtl::OUString& rModuleIdentifier,
void LoadNodes( Module* pModule, const com::sun::star::uno::Reference<
com::sun::star::container::XNameAccess >& xRoot );
void LoadNodes( const com::sun::star::uno::Reference<
com::sun::star::container::XNameAccess >& xRoot,
Module* pModule,
const rtl::OUString& rExtensionId, const rtl::OUString& rExtensionId,
VectorOfNodes& rOutNodeList ); VectorOfNodes& rOutNodeList );
void InsertNodes( const VectorOfNodes& rNodeList ); void InsertNodes( const VectorOfNodes& rNodeList );
......
...@@ -67,11 +67,11 @@ ...@@ -67,11 +67,11 @@
#include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/loader/CannotActivateFactoryException.hpp> #include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/util/XMacroExpander.hpp>
#include <comphelper/configurationhelper.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <editeng/optitems.hxx> #include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx> #include <editeng/unolingu.hxx>
#include <linguistic/misc.hxx> #include <linguistic/misc.hxx>
#include <officecfg/Office/OptionsDialog.hxx>
#include <osl/module.hxx> #include <osl/module.hxx>
#include <osl/process.h> #include <osl/process.h>
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
...@@ -1927,12 +1927,18 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension ...@@ -1927,12 +1927,18 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension
{ {
Module* pModule = NULL; Module* pModule = NULL;
Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory(); Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory();
// open optionsdialog.xcu
Reference< XNameAccess > xRoot(
::comphelper::ConfigurationHelper::openConfig(
xMSFac, C2U("org.openoffice.Office.OptionsDialog"),
::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY );
DBG_ASSERT( xRoot.is(), "OfaTreeOptionsDialog::LoadExtensionOptions(): no config" );
// when called by Tools - Options then load nodes of active module // when called by Tools - Options then load nodes of active module
if ( rExtensionId.isEmpty() ) if ( rExtensionId.isEmpty() )
pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ) ); pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot );
VectorOfNodes aNodeList; VectorOfNodes aNodeList;
LoadNodes( pModule, rExtensionId, aNodeList ); LoadNodes( xRoot, pModule, rExtensionId, aNodeList );
InsertNodes( aNodeList ); InsertNodes( aNodeList );
} }
...@@ -1971,12 +1977,16 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( ...@@ -1971,12 +1977,16 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
} }
Module* OfaTreeOptionsDialog::LoadModule( Module* OfaTreeOptionsDialog::LoadModule(
const rtl::OUString& rModuleIdentifier ) const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot )
{ {
Module* pModule = NULL; Module* pModule = NULL;
Reference< XNameAccess > xSet( Reference< XNameAccess > xSet;
officecfg::Office::OptionsDialog::Modules::get());
if ( xRoot->hasByName( C2U("Modules") ) )
{
xRoot->getByName( C2U("Modules") ) >>= xSet;
if ( xSet.is() )
{
Sequence< rtl::OUString > seqNames = xSet->getElementNames(); Sequence< rtl::OUString > seqNames = xSet->getElementNames();
for ( int i = 0; i < seqNames.getLength(); ++i ) for ( int i = 0; i < seqNames.getLength(); ++i )
{ {
...@@ -2030,15 +2040,21 @@ Module* OfaTreeOptionsDialog::LoadModule( ...@@ -2030,15 +2040,21 @@ Module* OfaTreeOptionsDialog::LoadModule(
} }
} }
} }
}
}
return pModule; return pModule;
} }
void OfaTreeOptionsDialog::LoadNodes( void OfaTreeOptionsDialog::LoadNodes(
Module* pModule, const rtl::OUString& rExtensionId, const Reference< XNameAccess >& xRoot, Module* pModule,
VectorOfNodes& rOutNodeList ) const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList )
{ {
Reference< XNameAccess > xSet( Reference< XNameAccess > xSet;
officecfg::Office::OptionsDialog::Nodes::get()); if ( xRoot->hasByName( C2U("Nodes") ) )
{
xRoot->getByName( C2U("Nodes") ) >>= xSet;
if ( xSet.is() )
{
VectorOfNodes aNodeList; VectorOfNodes aNodeList;
Sequence< rtl::OUString > seqNames = xSet->getElementNames(); Sequence< rtl::OUString > seqNames = xSet->getElementNames();
...@@ -2174,6 +2190,8 @@ void OfaTreeOptionsDialog::LoadNodes( ...@@ -2174,6 +2190,8 @@ void OfaTreeOptionsDialog::LoadNodes(
for ( i = 0; i < aNodeList.size(); ++i ) for ( i = 0; i < aNodeList.size(); ++i )
rOutNodeList.push_back( aNodeList[i] ); rOutNodeList.push_back( aNodeList[i] );
} }
}
}
} }
sal_uInt16 lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB ) sal_uInt16 lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment