summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-12-06 10:39:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-12-06 16:53:55 +0100
commit7468f9b773d5a9a4cb3af57cf123c2a0e7e937fd (patch)
treea01fd61c62252306d7731db26f023d5854c68a73
parentc8e9a953636524ff3ac79859f3698491f775e10a (diff)
fdo#72125 - Expert config dialog takes too much time to come up
This is not a full fix, this just trims some of the fat in CuiAboutConfigTabPage::FillItems. Specifically - improve string handling - don't use catch/throw unnecessarily Change-Id: I5b4987407bd007fbbb18f76fcf26f4a33282c0c0 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>: reintroduced lost "/" into path of recursive FillItems calls
-rw-r--r--cui/source/options/optaboutconfig.cxx77
1 files changed, 29 insertions, 48 deletions
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 6f8a75780cf6..ad145de90b7c 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -26,6 +26,7 @@
#include <vector>
#include <boost/shared_ptr.hpp>
+#include <iostream>
using namespace svx;
using namespace ::com::sun::star;
@@ -209,37 +210,26 @@ sal_Bool CuiAboutConfigTabPage::FillItemSet(/* SfxItemSet&*/ )
void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAccess, const OUString& sPath)
{
- sal_Bool bIsLeafNode;
-
- Reference< XHierarchicalNameAccess > xHierarchicalNameAccess( xNameAccess, uno::UNO_QUERY_THROW );
-
uno::Sequence< OUString > seqItems = xNameAccess->getElementNames();
for( sal_Int16 i = 0; i < seqItems.getLength(); ++i )
{
- Any aNode = xHierarchicalNameAccess->getByHierarchicalName( seqItems[i] );
-
- bIsLeafNode = sal_True;
-
- try
- {
- Reference< XHierarchicalNameAccess >xNextHierarchicalNameAccess( aNode, uno::UNO_QUERY_THROW );
- Reference< XNameAccess > xNextNameAccess( xNextHierarchicalNameAccess, uno::UNO_QUERY_THROW );
- FillItems( xNextNameAccess, sPath + OUString("/") + seqItems[i] );
- bIsLeafNode = sal_False;
+ Any aNode = xNameAccess->getByName( seqItems[i] );
- }
- catch( uno::Exception& )
+ Reference< XNameAccess > xNextNameAccess( aNode, uno::UNO_QUERY );
+ if( xNextNameAccess.is() )
{
+ // not leaf node
+ FillItems( xNextNameAccess, sPath + "/" + seqItems[i] );
}
-
- if( bIsLeafNode )
+ else
{
- Any aProp = xHierarchicalNameAccess->getByHierarchicalName(seqItems[i]);
+ // leaf node
+ OUString sType = aNode.getValueTypeName();
OUString sValue;
- if( aProp.hasValue() )
+ if( aNode.hasValue() )
{
- switch( aProp.getValueType().getTypeClass() )
+ switch( aNode.getValueType().getTypeClass() )
{
case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT :
case ::com::sun::star::uno::TypeClass_SHORT :
@@ -248,10 +238,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
//case ::com::sun::star::uno::TypeClass_INT :
{
sal_Int32 nVal = 0;
- if(aProp >>= nVal)
+ if(aNode >>= nVal)
{
- OUString aNumber( OUString::number( nVal ) );
- sValue = aNumber;
+ sValue = OUString::number( nVal );
}
}
break;
@@ -259,10 +248,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
case ::com::sun::star::uno::TypeClass_BOOLEAN :
{
sal_Bool bVal = sal_False;
- if(aProp >>= bVal )
+ if(aNode >>= bVal )
{
- OUString sBoolean( OUString::boolean( bVal ) );
- sValue = sBoolean;
+ sValue = OUString::boolean( bVal );
}
}
break;
@@ -270,7 +258,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
case ::com::sun::star::uno::TypeClass_STRING :
{
OUString sString;
- if(aProp >>= sString)
+ if(aNode >>= sString)
{
sValue = sString;
}
@@ -282,43 +270,38 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
//case ::com::sun::star::uno::TypeClass_ARRAY :
{
sValue = "";
- if( OUString("[]long") ==aProp.getValueTypeName() ||
- OUString("[]short")==aProp.getValueTypeName() )
+ if( "[]long" == sType || "[]short"== sType )
{
uno::Sequence<sal_Int32> seqLong;
- if( aProp >>= seqLong )
+ if( aNode >>= seqLong )
{
for(int nInd=0; nInd < seqLong.getLength(); ++nInd)
{
- OUString sNumber( OUString::number(seqLong[nInd]) );
- sValue += sNumber;
- sValue += ",";
+ sValue += OUString::number(seqLong[nInd]) + ",";
}
}
}
- if( OUString("[]string") == aProp.getValueTypeName() )
+ if( "[]string" == sType )
{
uno::Sequence< OUString > seqOUString;
- if( aProp >>= seqOUString )
+ if( aNode >>= seqOUString )
{
for( sal_Int16 nInd=0; nInd < seqOUString.getLength(); ++nInd )
{
- sValue += seqOUString[nInd] + OUString(",");
+ sValue += seqOUString[nInd] + ",";
}
}
}
- if( OUString("[]hyper") == aProp.getValueTypeName() )
+ if( "[]hyper" == sType )
{
uno::Sequence< sal_Int64 > seqHyp;
- if( aProp >>= seqHyp )
+ if( aNode >>= seqHyp )
{
for(int nInd = 0; nInd < seqHyp.getLength(); ++nInd)
{
- OUString sHyper( OUString::number( seqHyp[nInd] ) );
- sValue += sHyper;
- sValue += ",";
+ sValue += OUString::number( seqHyp[nInd] ) + ",";
}
}
}
@@ -327,13 +310,12 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
default:
{
- if( OUString("hyper") == aProp.getValueTypeName() )
+ if( "hyper" == sType )
{
sal_Int64 nHyp = 0;
- if(aProp >>= nHyp)
+ if(aNode >>= nHyp)
{
- OUString aHyp( OUString::number( nHyp ) );
- sValue = aHyp;
+ sValue = OUString::number( nHyp );
}
}else
sValue = "";
@@ -341,8 +323,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
}
}
- OUString sType = aProp.getValueTypeName();
- InsertEntry( sPath, seqItems [ i ], sType, sValue);
+ InsertEntry( sPath, seqItems[i], sType, sValue);
}
}
}