summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-07-25 19:06:42 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-07-25 19:10:20 +0200
commitcef66a3eed301ab77e02be6d6ba148142051e13d (patch)
treee5efad57389ba1e2b0c88268c867aef26c324c48 /cui
parentcf7c9599e776eba8e14614cecb528d3da5778190 (diff)
Revert "fdo#52232 ConfigurationSet wrapper unusable for localized properties"
This reverts commit aebf5bf22304c73e121b16dc0b51f909c5f34c28, now that e397a9cfabc2928cd5571309f5b634a7e78098ec "Make comphelper/configuration.hxx work for localized properties" fixes the original problem. Change-Id: If4e187b911510d5932d52cec08d43cb73f6e339c
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/treeopt.hxx9
-rw-r--r--cui/source/options/treeopt.cxx318
2 files changed, 152 insertions, 175 deletions
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 64d2b9b38a55..38700e684d24 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -138,7 +138,6 @@ struct LastPageSaver
// class OfaTreeOptionsDialog --------------------------------------------
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 awt { class XContainerWindowProvider; } } } }
@@ -192,12 +191,8 @@ private:
com::sun::star::lang::XMultiServiceFactory >& xMFac,
const com::sun::star::uno::Reference<
com::sun::star::frame::XFrame >& xFrame );
- Module* LoadModule( const rtl::OUString& rModuleIdentifier,
- 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,
+ Module* LoadModule( const rtl::OUString& rModuleIdentifier );
+ void LoadNodes( Module* pModule,
const rtl::OUString& rExtensionId,
VectorOfNodes& rOutNodeList );
void InsertNodes( const VectorOfNodes& rNodeList );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index ce3408312fe3..9db1841150b5 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -67,11 +67,11 @@
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
-#include <comphelper/configurationhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx>
#include <linguistic/misc.hxx>
+#include <officecfg/Office/OptionsDialog.hxx>
#include <osl/module.hxx>
#include <osl/process.h>
#include <rtl/bootstrap.hxx>
@@ -1927,18 +1927,12 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension
{
Module* pModule = NULL;
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
if ( rExtensionId.isEmpty() )
- pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot );
+ pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ) );
VectorOfNodes aNodeList;
- LoadNodes( xRoot, pModule, rExtensionId, aNodeList );
+ LoadNodes( pModule, rExtensionId, aNodeList );
InsertNodes( aNodeList );
}
@@ -1977,64 +1971,58 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
}
Module* OfaTreeOptionsDialog::LoadModule(
- const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot )
+ const rtl::OUString& rModuleIdentifier )
{
Module* pModule = NULL;
- Reference< XNameAccess > xSet;
+ Reference< XNameAccess > xSet(
+ officecfg::Office::OptionsDialog::Modules::get());
- if ( xRoot->hasByName( C2U("Modules") ) )
+ Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+ for ( int i = 0; i < seqNames.getLength(); ++i )
{
- xRoot->getByName( C2U("Modules") ) >>= xSet;
- if ( xSet.is() )
+ rtl::OUString sModule( seqNames[i] );
+ if ( rModuleIdentifier == sModule )
{
- Sequence< rtl::OUString > seqNames = xSet->getElementNames();
- for ( int i = 0; i < seqNames.getLength(); ++i )
+ // current active module found
+ pModule = new Module( sModule );
+ pModule->m_bActive = true;
+
+ Reference< XNameAccess > xModAccess;
+ xSet->getByName( seqNames[i] ) >>= xModAccess;
+ if ( xModAccess.is() )
{
- rtl::OUString sModule( seqNames[i] );
- if ( rModuleIdentifier == sModule )
+ // load the nodes of this module
+ Reference< XNameAccess > xNodeAccess;
+ xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess;
+ if ( xNodeAccess.is() )
{
- // current active module found
- pModule = new Module( sModule );
- pModule->m_bActive = true;
-
- Reference< XNameAccess > xModAccess;
- xSet->getByName( seqNames[i] ) >>= xModAccess;
- if ( xModAccess.is() )
+ Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames();
+ Reference< XNameAccess > xAccess;
+ sal_Int32 nIndex = -1;
+ for ( int x = 0; x < xTemp.getLength(); ++x )
{
- // load the nodes of this module
- Reference< XNameAccess > xNodeAccess;
- xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess;
- if ( xNodeAccess.is() )
+ xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
+ if ( xAccess.is() )
{
- Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames();
- Reference< XNameAccess > xAccess;
- sal_Int32 nIndex = -1;
- for ( int x = 0; x < xTemp.getLength(); ++x )
+ xAccess->getByName( C2U("Index") ) >>= nIndex;
+ if ( nIndex < 0 )
+ // append nodes with index < 0
+ pModule->m_aNodeList.push_back(
+ new OrderedEntry( nIndex, xTemp[x] ) );
+ else
{
- xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
- if ( xAccess.is() )
+ // search position of the node
+ sal_uInt32 y = 0;
+ for ( ; y < pModule->m_aNodeList.size(); ++y )
{
- xAccess->getByName( C2U("Index") ) >>= nIndex;
- if ( nIndex < 0 )
- // append nodes with index < 0
- pModule->m_aNodeList.push_back(
- new OrderedEntry( nIndex, xTemp[x] ) );
- else
- {
- // search position of the node
- sal_uInt32 y = 0;
- for ( ; y < pModule->m_aNodeList.size(); ++y )
- {
- sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
- if ( nNodeIdx < 0 || nNodeIdx > nIndex )
- break;
- }
- // and insert the node on this position
- pModule->m_aNodeList.insert(
- pModule->m_aNodeList.begin() + y,
- new OrderedEntry( nIndex, xTemp[x] ) );
- }
+ sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
+ if ( nNodeIdx < 0 || nNodeIdx > nIndex )
+ break;
}
+ // and insert the node on this position
+ pModule->m_aNodeList.insert(
+ pModule->m_aNodeList.begin() + y,
+ new OrderedEntry( nIndex, xTemp[x] ) );
}
}
}
@@ -2046,151 +2034,145 @@ Module* OfaTreeOptionsDialog::LoadModule(
}
void OfaTreeOptionsDialog::LoadNodes(
- const Reference< XNameAccess >& xRoot, Module* pModule,
- const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList )
+ Module* pModule, const rtl::OUString& rExtensionId,
+ VectorOfNodes& rOutNodeList )
{
- Reference< XNameAccess > xSet;
- if ( xRoot->hasByName( C2U("Nodes") ) )
+ Reference< XNameAccess > xSet(
+ officecfg::Office::OptionsDialog::Nodes::get());
+ VectorOfNodes aNodeList;
+ Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+
+ for ( int i = 0; i < seqNames.getLength(); ++i )
{
- xRoot->getByName( C2U("Nodes") ) >>= xSet;
- if ( xSet.is() )
+ String sGroupName( seqNames[i] );
+ Reference< XNameAccess > xNodeAccess;
+ xSet->getByName( seqNames[i] ) >>= xNodeAccess;
+
+ if ( xNodeAccess.is() )
{
- VectorOfNodes aNodeList;
- Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+ rtl::OUString sNodeId, sLabel, sPageURL, sGroupId;
+ bool bAllModules = false;
+ sal_Int32 nGroupIndex = 0;
+
+ sNodeId = seqNames[i];
+ xNodeAccess->getByName( C2U("Label") ) >>= sLabel;
+ xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL;
+ xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules;
+ xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId;
+ xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex;
- for ( int i = 0; i < seqNames.getLength(); ++i )
+ if ( sLabel.isEmpty() )
+ sLabel = sGroupName;
+ String sTemp = getGroupName( sLabel, !rExtensionId.isEmpty() );
+ if ( sTemp.Len() > 0 )
+ sLabel = sTemp;
+ OptionsNode* pNode =
+ new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex );
+
+ if ( rExtensionId.isEmpty() && !isNodeActive( pNode, pModule ) )
{
- String sGroupName( seqNames[i] );
- Reference< XNameAccess > xNodeAccess;
- xSet->getByName( seqNames[i] ) >>= xNodeAccess;
+ delete pNode;
+ continue;
+ }
- if ( xNodeAccess.is() )
+ Reference< XNameAccess > xLeavesSet;
+ xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet;
+ if ( xLeavesSet.is() )
+ {
+ Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames();
+ for ( int j = 0; j < seqLeaves.getLength(); ++j )
{
- rtl::OUString sNodeId, sLabel, sPageURL, sGroupId;
- bool bAllModules = false;
- sal_Int32 nGroupIndex = 0;
-
- sNodeId = seqNames[i];
- xNodeAccess->getByName( C2U("Label") ) >>= sLabel;
- xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL;
- xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules;
- xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId;
- xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex;
-
- if ( sLabel.isEmpty() )
- sLabel = sGroupName;
- String sTemp = getGroupName( sLabel, !rExtensionId.isEmpty() );
- if ( sTemp.Len() > 0 )
- sLabel = sTemp;
- OptionsNode* pNode =
- new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex );
-
- if ( rExtensionId.isEmpty() && !isNodeActive( pNode, pModule ) )
- {
- delete pNode;
- continue;
- }
+ Reference< XNameAccess > xLeaveAccess;
+ xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
- Reference< XNameAccess > xLeavesSet;
- xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet;
- if ( xLeavesSet.is() )
+ if ( xLeaveAccess.is() )
{
- Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames();
- for ( int j = 0; j < seqLeaves.getLength(); ++j )
- {
- Reference< XNameAccess > xLeaveAccess;
- xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
+ rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
+ sal_Int32 nLeafGrpIdx = 0;
- if ( xLeaveAccess.is() )
- {
- rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
- sal_Int32 nLeafGrpIdx = 0;
+ xLeaveAccess->getByName( C2U("Id") ) >>= sId;
+ xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel;
+ xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL;
+ xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl;
+ xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId;
+ xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx;
- xLeaveAccess->getByName( C2U("Id") ) >>= sId;
- xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel;
- xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL;
- xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl;
- xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId;
- xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx;
+ if ( rExtensionId.isEmpty() || sId == rExtensionId )
+ {
+ OptionsLeaf* pLeaf = new OptionsLeaf(
+ sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
- if ( rExtensionId.isEmpty() || sId == rExtensionId )
+ if ( !sLeafGrpId.isEmpty() )
+ {
+ bool bAlreadyOpened = false;
+ if ( pNode->m_aGroupedLeaves.size() > 0 )
{
- OptionsLeaf* pLeaf = new OptionsLeaf(
- sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
-
- if ( !sLeafGrpId.isEmpty() )
+ for ( sal_uInt32 k = 0;
+ k < pNode->m_aGroupedLeaves.size(); ++k )
{
- bool bAlreadyOpened = false;
- if ( pNode->m_aGroupedLeaves.size() > 0 )
+ if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
+ pNode->m_aGroupedLeaves[k][0]->m_sGroupId
+ == sLeafGrpId )
{
- for ( sal_uInt32 k = 0;
- k < pNode->m_aGroupedLeaves.size(); ++k )
+ sal_uInt32 l = 0;
+ for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
{
- if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
- pNode->m_aGroupedLeaves[k][0]->m_sGroupId
- == sLeafGrpId )
- {
- sal_uInt32 l = 0;
- for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
- {
- if ( pNode->m_aGroupedLeaves[k][l]->
- m_nGroupIndex >= nLeafGrpIdx )
- break;
- }
- pNode->m_aGroupedLeaves[k].insert(
- pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
- bAlreadyOpened = true;
+ if ( pNode->m_aGroupedLeaves[k][l]->
+ m_nGroupIndex >= nLeafGrpIdx )
break;
- }
}
- }
- if ( !bAlreadyOpened )
- {
- VectorOfLeaves aGroupedLeaves;
- aGroupedLeaves.push_back( pLeaf );
- pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
+ pNode->m_aGroupedLeaves[k].insert(
+ pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
+ bAlreadyOpened = true;
+ break;
}
}
- else
- pNode->m_aLeaves.push_back(
- new OptionsLeaf(
- sId, sLeafLabel, sLeafURL,
- sEventHdl, sLeafGrpId, nLeafGrpIdx ) );
+ }
+ if ( !bAlreadyOpened )
+ {
+ VectorOfLeaves aGroupedLeaves;
+ aGroupedLeaves.push_back( pLeaf );
+ pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
}
}
+ else
+ pNode->m_aLeaves.push_back(
+ new OptionsLeaf(
+ sId, sLeafLabel, sLeafURL,
+ sEventHdl, sLeafGrpId, nLeafGrpIdx ) );
}
}
-
- // do not insert nodes without leaves
- if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
- {
- pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
- }
}
}
- if ( pModule && aNodeList.size() > 0 )
+ // do not insert nodes without leaves
+ if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
{
- sal_uInt32 i = 0, j = 0;
- for ( ; i < pModule->m_aNodeList.size(); ++i )
+ pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
+ }
+ }
+ }
+
+ if ( pModule && aNodeList.size() > 0 )
+ {
+ sal_uInt32 i = 0, j = 0;
+ for ( ; i < pModule->m_aNodeList.size(); ++i )
+ {
+ rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId;
+ for ( j = 0; j < aNodeList.size(); ++j )
+ {
+ OptionsNode* pNode = aNodeList[j];
+ if ( pNode->m_sId == sNodeId )
{
- rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId;
- for ( j = 0; j < aNodeList.size(); ++j )
- {
- OptionsNode* pNode = aNodeList[j];
- if ( pNode->m_sId == sNodeId )
- {
- rOutNodeList.push_back( pNode );
- aNodeList.erase( aNodeList.begin() + j );
- break;
- }
- }
+ rOutNodeList.push_back( pNode );
+ aNodeList.erase( aNodeList.begin() + j );
+ break;
}
-
- for ( i = 0; i < aNodeList.size(); ++i )
- rOutNodeList.push_back( aNodeList[i] );
}
}
+
+ for ( i = 0; i < aNodeList.size(); ++i )
+ rOutNodeList.push_back( aNodeList[i] );
}
}