summaryrefslogtreecommitdiff
path: root/cui/source/customize
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-03-31 22:54:23 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-04-04 07:04:19 +0000
commitedc63d3abb5c4dae223f745f6384e7d0e5fc717e (patch)
tree62c6c8c0f20dd4364ee2725c5fe2084b2e0918b3 /cui/source/customize
parent3dd9a3027d39ee9932b26abcde12363c881bff6a (diff)
tdf#45129 Customize Toolbars: Add category "All categories"
- added string "All commands" to resources - moved code responsible for flling functions list to a function - defined SVX_CFGGROUP_ALLFUNCTIONS - added "All categories" category Change-Id: I4f03c8bc0af44dba2ef89ddd64b3fac67c5f2695 Reviewed-on: https://gerrit.libreoffice.org/23572 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'cui/source/customize')
-rw-r--r--cui/source/customize/selector.cxx178
1 files changed, 104 insertions, 74 deletions
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index 21d58e05fcf3..01d4f4246b37 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -468,6 +468,14 @@ void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame
if ( xModuleCategories.is() )
{
+ SvTreeListEntry *pEntry = InsertEntry( CUI_RES(RID_SVXSTR_ALLFUNCTIONS) );
+
+ SvxGroupInfo_Impl *pInfo =
+ new SvxGroupInfo_Impl( SVX_CFGGROUP_ALLFUNCTIONS, 0 );
+ aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
+
+ pEntry->SetUserData( pInfo );
+
Sequence< sal_Int16 > gids =
xDIP->getSupportedCommandGroups();
@@ -500,10 +508,9 @@ void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame
{
}
- SvTreeListEntry *pEntry = InsertEntry( group );
+ pEntry = InsertEntry( group );
- SvxGroupInfo_Impl *pInfo =
- new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
+ pInfo = new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
pEntry->SetUserData( pInfo );
@@ -636,6 +643,72 @@ SvxConfigGroupListBox::getDocumentModel(
return xModel;
}
+void SvxConfigGroupListBox::fillFunctionList(const Sequence< frame::DispatchInformation >& commands)
+{
+ for ( sal_Int32 i = 0; i < commands.getLength(); ++i )
+ {
+ if ( commands[i].Command.isEmpty() )
+ {
+ continue;
+ }
+
+ Image aImage;
+
+ OUString aCmdURL( commands[i].Command );
+
+ if ( m_pImageProvider )
+ {
+ aImage = m_pImageProvider->GetImage( aCmdURL );
+ }
+
+ OUString aLabel;
+ try
+ {
+ Any a = m_xModuleCommands->getByName( aCmdURL );
+ Sequence< beans::PropertyValue > aPropSeq;
+
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 k = 0; k < aPropSeq.getLength(); ++k )
+ {
+ if ( aPropSeq[k].Name == "Name" )
+ {
+ aPropSeq[k].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+
+ if ( aLabel.isEmpty() )
+ {
+ aLabel = commands[i].Command;
+ }
+
+ SvTreeListEntry* pFuncEntry = nullptr;
+ if ( !!aImage )
+ {
+ pFuncEntry = pFunctionListBox->InsertEntry(
+ aLabel, aImage, aImage );
+ }
+ else
+ {
+ pFuncEntry = pFunctionListBox->InsertEntry(
+ aLabel );
+ }
+
+ SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl(
+ SVX_CFGFUNCTION_SLOT, 123, aCmdURL, OUString() );
+
+ pFunctionListBox->aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(_pGroupInfo) );
+
+ pFuncEntry->SetUserData( _pGroupInfo );
+ }
+}
+
void SvxConfigGroupListBox::GroupSelected()
{
SvTreeListEntry *pEntry = FirstSelected();
@@ -643,7 +716,8 @@ void SvxConfigGroupListBox::GroupSelected()
pFunctionListBox->SetUpdateMode(false);
pFunctionListBox->ClearAll();
if ( pInfo->nKind != SVX_CFGGROUP_FUNCTION &&
- pInfo->nKind != SVX_CFGGROUP_SCRIPTCONTAINER )
+ pInfo->nKind != SVX_CFGGROUP_SCRIPTCONTAINER &&
+ pInfo->nKind != SVX_CFGGROUP_ALLFUNCTIONS )
{
pFunctionListBox->SetUpdateMode(true);
return;
@@ -651,90 +725,46 @@ void SvxConfigGroupListBox::GroupSelected()
switch ( pInfo->nKind )
{
- case SVX_CFGGROUP_FUNCTION :
+ case SVX_CFGGROUP_FUNCTION:
{
- SvTreeListEntry *_pEntry = FirstSelected();
- if ( _pEntry != nullptr )
+ Reference< frame::XDispatchInformationProvider > xDIP( m_xFrame, UNO_QUERY );
+ Sequence< frame::DispatchInformation > commands;
+ try
{
- SvxGroupInfo_Impl *_pInfo =
- static_cast<SvxGroupInfo_Impl*>(_pEntry->GetUserData());
-
- Reference< frame::XDispatchInformationProvider > xDIP(
- m_xFrame, UNO_QUERY );
+ commands = xDIP->getConfigurableDispatchInformation( pInfo->nOrd );
+ fillFunctionList(commands);
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
- Sequence< frame::DispatchInformation > commands;
- try
- {
- commands = xDIP->getConfigurableDispatchInformation(
- _pInfo->nOrd );
- }
- catch ( container::NoSuchElementException& )
- {
- }
+ break;
+ }
- for ( sal_Int32 i = 0; i < commands.getLength(); ++i )
+ case SVX_CFGGROUP_ALLFUNCTIONS:
+ {
+ Reference< frame::XDispatchInformationProvider > xDIP( m_xFrame, UNO_QUERY );
+ SvTreeListEntry *pCurrEntry = First();
+ while( pCurrEntry )
+ {
+ SvxGroupInfo_Impl *pCurrentInfo = static_cast<SvxGroupInfo_Impl*>(pCurrEntry->GetUserData());
+ if (pCurrentInfo->nKind == SVX_CFGGROUP_FUNCTION)
{
- if ( commands[i].Command.isEmpty() )
- {
- continue;
- }
-
- Image aImage;
- OUString aCmdURL( commands[i].Command );
- if ( m_pImageProvider )
- {
- aImage = m_pImageProvider->GetImage( aCmdURL );
- }
-
- OUString aLabel;
+ Sequence< frame::DispatchInformation > commands;
try
{
- Any a = m_xModuleCommands->getByName( aCmdURL );
- Sequence< beans::PropertyValue > aPropSeq;
-
- if ( a >>= aPropSeq )
- {
- for ( sal_Int32 k = 0; k < aPropSeq.getLength(); ++k )
- {
- if ( aPropSeq[k].Name == "Name" )
- {
- aPropSeq[k].Value >>= aLabel;
- break;
- }
- }
- }
+ commands = xDIP->getConfigurableDispatchInformation( pCurrentInfo->nOrd );
+ fillFunctionList(commands);
}
catch ( container::NoSuchElementException& )
{
}
-
- if ( aLabel.isEmpty() )
- {
- aLabel = commands[i].Command;
- }
-
- SvTreeListEntry* pFuncEntry = nullptr;
- if ( !!aImage )
- {
- pFuncEntry = pFunctionListBox->InsertEntry(
- aLabel, aImage, aImage );
- }
- else
- {
- pFuncEntry = pFunctionListBox->InsertEntry(
- aLabel );
- }
-
- SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl(
- SVX_CFGFUNCTION_SLOT, 123, aCmdURL, OUString() );
-
- pFunctionListBox->aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(_pGroupInfo) );
-
- pFuncEntry->SetUserData( _pGroupInfo );
}
- }
+ pCurrEntry = Next( pCurrEntry );
+ };
+
break;
}