summaryrefslogtreecommitdiff
path: root/cui/source/customize
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/customize')
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx29
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx22
-rw-r--r--cui/source/customize/SvxToolbarConfigPage.cxx32
-rw-r--r--cui/source/customize/acccfg.cxx8
-rw-r--r--cui/source/customize/cfg.cxx60
-rw-r--r--cui/source/customize/cfgutil.cxx50
6 files changed, 87 insertions, 114 deletions
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 2f9a9a451512..110a1d1eb322 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -273,9 +273,10 @@ OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
}
void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctionListBox,
- const OUString& filterTerm , SaveInData *pCurrentSaveInData)
+ const OUString& filterTerm, SaveInData *pCurrentSaveInData)
{
SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_active_id().toInt64());
+ std::vector<std::unique_ptr<weld::TreeIter>> aNodesToExpand;
pFunctionListBox->freeze();
pFunctionListBox->ClearAll();
@@ -292,6 +293,9 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
SfxGroupInfo_Impl *pCurrentInfo =
reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos).toInt64());
+ if (!pCurrentInfo) //seperator
+ continue;
+
if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
{
css::uno::Sequence< css::frame::DispatchInformation > lCommands;
@@ -376,10 +380,10 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0 ) );
- std::unique_ptr<weld::TreeIter> xMacroGroup(pFunctionListBox->append_ondemand(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName));
+ std::unique_ptr<weld::TreeIter> xMacroGroup(pFunctionListBox->tree_append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName));
//Add the children and the grand children
- addChildren(xMacroGroup.get(), childGroup, pFunctionListBox, filterTerm, pCurrentSaveInData);
+ addChildren(xMacroGroup.get(), childGroup, pFunctionListBox, filterTerm, pCurrentSaveInData, aNodesToExpand);
// Remove the main group if empty
if (!pFunctionListBox->iter_has_child(*xMacroGroup))
@@ -388,7 +392,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
}
else if (!filterTerm.isEmpty())
{
- pFunctionListBox->expand_row(*xMacroGroup);
+ aNodesToExpand.emplace_back(std::move(xMacroGroup));
}
}
}
@@ -410,7 +414,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0 ) );
// pIt.sLabel is Name of the style family
- std::unique_ptr<weld::TreeIter> xFuncEntry(pFunctionListBox->append_ondemand(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), pIt.sLabel));
+ std::unique_ptr<weld::TreeIter> xFuncEntry(pFunctionListBox->tree_append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), pIt.sLabel));
const std::vector< SfxStyleInfo_Impl > lStyles = pStylesInfo->getStyles(pIt.sFamily);
@@ -451,7 +455,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
}
else if (!filterTerm.isEmpty())
{
- pFunctionListBox->expand_row(*xFuncEntry);
+ aNodesToExpand.emplace_back(std::move(xFuncEntry));
}
}
@@ -467,6 +471,10 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
if (pFunctionListBox->n_children())
pFunctionListBox->select(0);
+
+ //post freeze
+ for (const auto& it : aNodesToExpand)
+ pFunctionListBox->expand_row(*it);
}
void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
@@ -476,7 +484,8 @@ void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
void CommandCategoryListBox::addChildren(
weld::TreeIter* parentEntry, const css::uno::Reference< css::script::browse::XBrowseNode > &parentNode,
- CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm , SaveInData *pCurrentSaveInData)
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm , SaveInData *pCurrentSaveInData,
+ std::vector<std::unique_ptr<weld::TreeIter>> &rNodesToExpand)
{
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
@@ -493,15 +502,15 @@ void CommandCategoryListBox::addChildren(
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
0, static_cast<void *>( child.get())));
- std::unique_ptr<weld::TreeIter> xNewEntry(pFunctionListBox->append_ondemand(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, parentEntry));
+ std::unique_ptr<weld::TreeIter> xNewEntry(pFunctionListBox->tree_append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, parentEntry));
- addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, pCurrentSaveInData);
+ addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, pCurrentSaveInData, rNodesToExpand);
// Remove the group if empty
if (!pFunctionListBox->iter_has_child(*xNewEntry))
pFunctionListBox->remove(*xNewEntry);
else
- pFunctionListBox->expand_row(*xNewEntry);
+ rNodesToExpand.emplace_back(std::move(xNewEntry));
}
else if ( child.get()->getType() == css::script::browse::BrowseNodeTypes::SCRIPT )
{
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index 8e8adf5ed598..28f340a2a695 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -100,14 +100,14 @@ SvxMenuConfigPage::SvxMenuConfigPage(TabPageParent pParent, const SfxItemSet& rS
: SvxConfigPage(pParent, rSet)
, m_bIsMenuBar(bIsMenuBar)
{
+ m_xGearBtn = m_xBuilder->weld_menu_button("menugearbtn");
+ m_xGearBtn->show();
m_xContentsListBox.reset(new SvxMenuEntriesListBox(m_xBuilder->weld_tree_view("menucontents"), this));
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
rTreeView.connect_size_allocate(LINK(this, SvxMenuConfigPage, MenuEntriesSizeAllocHdl));
Size aSize(m_xFunctions->get_size_request());
rTreeView.set_size_request(aSize.Width(), aSize.Height());
MenuEntriesSizeAllocHdl(aSize);
- rTreeView.set_grid_left_attach(0);
- rTreeView.set_grid_top_attach(0);
rTreeView.set_hexpand(true);
rTreeView.set_vexpand(true);
rTreeView.show();
@@ -139,10 +139,6 @@ SvxMenuConfigPage::SvxMenuConfigPage(TabPageParent pParent, const SfxItemSet& rS
m_xModifyBtn->remove_item("resetIcon");
m_xModifyBtn->remove_item("restoreItem");
- m_xGearBtn->remove_item("gear_iconAndText");
- m_xGearBtn->remove_item("gear_iconOnly");
- m_xGearBtn->remove_item("gear_textOnly");
-
if ( !bIsMenuBar )
{
//TODO: Remove this when the gear button is implemented for context menus
@@ -242,9 +238,9 @@ void SvxMenuConfigPage::UpdateButtonStates()
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
// Add option (gear_add) will always be enabled
- m_xGearBtn->set_item_sensitive( "gear_delete", pMenuData->IsDeletable() );
- m_xGearBtn->set_item_sensitive( "gear_rename", pMenuData->IsRenamable() );
- m_xGearBtn->set_item_sensitive( "gear_move", pMenuData->IsMovable() );
+ m_xGearBtn->set_item_sensitive( "menu_gear_delete", pMenuData->IsDeletable() );
+ m_xGearBtn->set_item_sensitive( "menu_gear_rename", pMenuData->IsRenamable() );
+ m_xGearBtn->set_item_sensitive( "menu_gear_move", pMenuData->IsMovable() );
}
}
@@ -335,7 +331,7 @@ void SvxMenuConfigPage::SelectElement()
IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
{
- if (rIdent == "gear_add")
+ if (rIdent == "menu_gear_add")
{
SvxMainMenuOrganizerDialog aDialog(GetDialogFrameWeld(),
GetSaveInData()->GetEntries(), nullptr, true );
@@ -347,11 +343,11 @@ IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
GetSaveInData()->SetModified();
}
}
- else if (rIdent == "gear_delete")
+ else if (rIdent == "menu_gear_delete")
{
DeleteSelectedTopLevel();
}
- else if (rIdent == "gear_rename")
+ else if (rIdent == "menu_gear_rename")
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
@@ -376,7 +372,7 @@ IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
GetSaveInData()->SetModified();
}
}
- else if (rIdent == "gear_move")
+ else if (rIdent == "menu_gear_move")
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 252efe5bb7ba..66a4d7278264 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -99,6 +99,8 @@
SvxToolbarConfigPage::SvxToolbarConfigPage(TabPageParent pParent, const SfxItemSet& rSet)
: SvxConfigPage(pParent, rSet)
{
+ m_xGearBtn = m_xBuilder->weld_menu_button("toolbargearbtn");
+ m_xGearBtn->show();
m_xContainer->set_help_id(HID_SVX_CONFIG_TOOLBAR);
m_xContentsListBox.reset(new SvxToolbarEntriesListBox(m_xBuilder->weld_tree_view("toolcontents"), this));
@@ -109,8 +111,6 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(TabPageParent pParent, const SfxItemS
aWidths.push_back(rTreeView.get_checkbox_column_width());
aWidths.push_back(rTreeView.get_checkbox_column_width());
rTreeView.set_column_fixed_widths(aWidths);
- rTreeView.set_grid_left_attach(0);
- rTreeView.set_grid_top_attach(0);
rTreeView.set_hexpand(true);
rTreeView.set_vexpand(true);
rTreeView.set_help_id( HID_SVX_CONFIG_TOOLBAR_CONTENTS );
@@ -154,7 +154,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(TabPageParent pParent, const SfxItemS
m_xInsertBtn->remove_item("insertsubmenu");
// Gear menu's "Move" action is irrelevant to the toolbars
- m_xGearBtn->set_item_sensitive("gear_move", false);
+ m_xGearBtn->set_item_sensitive("toolbar_gear_move", false);
// default toolbar to select is standardbar unless a different one
// has been passed in
@@ -358,7 +358,7 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
{
SvxConfigEntry* pCurrentToolbar = GetTopLevelSelection();
- if (rIdent == "gear_add")
+ if (rIdent == "toolbar_gear_add")
{
OUString prefix = CuiResId( RID_SVXSTR_NEW_TOOLBAR );
@@ -409,7 +409,7 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
pData->SetModified();
}
}
- else if (rIdent == "gear_delete")
+ else if (rIdent == "toolbar_gear_delete")
{
if ( pCurrentToolbar && pCurrentToolbar->IsDeletable() )
{
@@ -417,7 +417,7 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
UpdateButtonStates();
}
}
- else if (rIdent == "gear_rename")
+ else if (rIdent == "toolbar_gear_rename")
{
sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
SvxConfigEntry* pToolbar =
@@ -449,7 +449,7 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
m_xTopLevelListBox->set_active_id(sId);
}
}
- else if (rIdent == "gear_iconOnly" || rIdent == "gear_textOnly" || rIdent == "gear_iconAndText")
+ else if (rIdent == "toolbar_gear_iconOnly" || rIdent == "toolbar_gear_textOnly" || rIdent == "toolbar_gear_iconAndText")
{
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
@@ -460,11 +460,11 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
}
sal_Int32 nStyle = 0;
- if (rIdent == "gear_iconOnly")
+ if (rIdent == "toolbar_gear_iconOnly")
nStyle = 0;
- else if (rIdent == "gear_textOnly")
+ else if (rIdent == "toolbar_gear_textOnly")
nStyle = 1;
- else if (rIdent == "gear_iconAndText")
+ else if (rIdent == "toolbar_gear_iconAndText")
nStyle = 2;
pCurrentToolbar->SetStyle( nStyle );
@@ -768,9 +768,9 @@ void SvxToolbarConfigPage::UpdateButtonStates()
m_xModifyBtn->set_sensitive( bIsValidSelection && !bIsSeparator );
// Handle the gear button
- // "gear_add" option is always enabled
- m_xGearBtn->set_item_sensitive("gear_delete", pToolbar && pToolbar->IsDeletable());
- m_xGearBtn->set_item_sensitive("gear_rename", pToolbar && pToolbar->IsRenamable());
+ // "toolbar_gear_add" option is always enabled
+ m_xGearBtn->set_item_sensitive("toolbar_gear_delete", pToolbar && pToolbar->IsDeletable());
+ m_xGearBtn->set_item_sensitive("toolbar_gear_rename", pToolbar && pToolbar->IsRenamable());
}
short SvxToolbarConfigPage::QueryReset()
@@ -812,17 +812,17 @@ void SvxToolbarConfigPage::SelectElement()
{
case 0:
{
- m_xGearBtn->set_item_active("gear_iconOnly", true);
+ m_xGearBtn->set_item_active("toolbar_gear_iconOnly", true);
break;
}
case 1:
{
- m_xGearBtn->set_item_active("gear_textOnly", true);
+ m_xGearBtn->set_item_active("toolbar_gear_textOnly", true);
break;
}
case 2:
{
- m_xGearBtn->set_item_active("gear_iconAndText", true);
+ m_xGearBtn->set_item_active("toolbar_gear_iconAndText", true);
break;
}
}
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 40f15d588721..8d5e509ec1f7 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -1024,7 +1024,9 @@ void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfigu
continue;
TAccInfo* pEntry = new TAccInfo(i1, 0/*nListPos*/, aKey);
m_xEntriesBox->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), sKey);
- m_xEntriesBox->set_text(m_xEntriesBox->n_children() - 1, OUString(), 1);
+ int nPos = m_xEntriesBox->n_children() - 1;
+ m_xEntriesBox->set_text(nPos, OUString(), 1);
+ m_xEntriesBox->set_sensitive(nPos, true);
}
// Assign all commands to its shortcuts - reading the accelerator config.
@@ -1315,8 +1317,6 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, TimeOut_Impl, Timer*, void)
weld::TreeView& rTreeView = m_xGroupLBox->get_widget();
SelectHdl(rTreeView);
-
- SelectHdl(m_xFunctionBox->get_widget());
}
IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, void)
@@ -1522,7 +1522,7 @@ void SfxAcceleratorConfigPage::Reset( const SfxItemSet* rSet )
// change the description of the radio button, which switch to the module
// dependent accelerator configuration
OUString sButtonText = m_xModuleButton->get_label();
- sButtonText = sButtonText.replaceFirst("$(MODULE)", m_sModuleUIName);
+ sButtonText = m_xModuleButton->strip_mnemonic(sButtonText).replaceFirst("$(MODULE)", m_sModuleUIName);
m_xModuleButton->set_label(sButtonText);
if (m_xModule.is())
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 8f28bb77dc64..dc878953978c 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -206,22 +206,16 @@ static VclPtr<SfxTabPage> CreateSvxEventConfigPage( TabPageParent pParent, const
* key bindings.
*
*****************************************************************************/
-SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet)
- : SfxTabDialog(pParent, "CustomizeDialog",
- "cui/ui/customizedialog.ui", pInSet)
- , m_nMenusPageId(0)
- , m_nToolbarsPageId(0)
- , m_nContextMenusPageId(0)
- , m_nKeyboardPageId(0)
- , m_nEventsPageId(0)
+SvxConfigDialog::SvxConfigDialog(weld::Window * pParent, const SfxItemSet* pInSet)
+ : SfxTabDialogController(pParent, "cui/ui/customizedialog.ui", "CustomizeDialog", pInSet)
{
SvxConfigPageHelper::InitImageType();
- m_nMenusPageId = AddTabPage("menus", CreateSvxMenuConfigPage);
- m_nToolbarsPageId = AddTabPage("toolbars", CreateSvxToolbarConfigPage);
- m_nContextMenusPageId = AddTabPage("contextmenus", CreateSvxContextMenuConfigPage);
- m_nKeyboardPageId = AddTabPage("keyboard", CreateKeyboardConfigPage);
- m_nEventsPageId = AddTabPage("events", CreateSvxEventConfigPage);
+ AddTabPage("menus", CreateSvxMenuConfigPage, nullptr);
+ AddTabPage("toolbars", CreateSvxToolbarConfigPage, nullptr);
+ AddTabPage("contextmenus", CreateSvxContextMenuConfigPage, nullptr);
+ AddTabPage("keyboard", CreateKeyboardConfigPage, nullptr);
+ AddTabPage("events", CreateSvxEventConfigPage, nullptr);
const SfxPoolItem* pItem =
pInSet->GetItem( pInSet->GetPool()->GetWhich( SID_CONFIG ) );
@@ -232,7 +226,7 @@ SvxConfigDialog::SvxConfigDialog(vcl::Window * pParent, const SfxItemSet* pInSet
if (text.startsWith( ITEM_TOOLBAR_URL ) )
{
- SetCurPageId(m_nToolbarsPageId);
+ SetCurPageId("toolbars");
}
}
}
@@ -242,17 +236,17 @@ void SvxConfigDialog::SetFrame(const css::uno::Reference< css::frame::XFrame >&
m_xFrame = xFrame;
if (!SvxConfigPageHelper::showKeyConfigTabPage( xFrame ))
- RemoveTabPage(m_nKeyboardPageId);
+ RemoveTabPage("keyboard");
}
-void SvxConfigDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
+void SvxConfigDialog::PageCreated(const OString &rId, SfxTabPage& rPage)
{
- if (nId == m_nMenusPageId || nId == m_nKeyboardPageId ||
- nId == m_nToolbarsPageId || nId == m_nContextMenusPageId)
+ if (rId == "menus" || rId == "keyboard" ||
+ rId == "toolbars" || rId == "contextmenus")
{
rPage.SetFrame(m_xFrame);
}
- else if (nId == m_nEventsPageId)
+ else if (rId == "events")
{
dynamic_cast< SvxEventConfigPage& >( rPage ).LateInit( m_xFrame );
}
@@ -911,22 +905,12 @@ void ContextMenuSaveInData::ResetContextMenu( const SvxConfigEntry* pEntry )
void SvxMenuEntriesListBox::CreateDropDown()
{
- int nWidth = m_xControl->get_text_height();
+ int nWidth = m_xControl->get_text_height() / 2;
m_xDropDown->SetOutputSizePixel(Size(nWidth, nWidth));
-
- int nSize = nWidth / 2;
- int nHalfSize = nSize / 2;
- int nY = nHalfSize;
- int nX = 0;
-
- m_xDropDown->SetFillColor(COL_BLACK);
-
- int n = 0;
- while (n <= nHalfSize)
- {
- m_xDropDown->DrawRect(::tools::Rectangle(nX + n, nY + n, nX + n, nY + nSize - n));
- ++n;
- }
+ DecorationView aDecoView(m_xDropDown.get());
+ aDecoView.DrawSymbol(tools::Rectangle(Point(0, 0), Size(nWidth, nWidth)),
+ SymbolType::SPIN_RIGHT, m_xDropDown->GetTextColor(),
+ DrawSymbolFlags::NONE);
}
/******************************************************************************
@@ -939,7 +923,7 @@ void SvxMenuEntriesListBox::CreateDropDown()
*****************************************************************************/
SvxMenuEntriesListBox::SvxMenuEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPg)
: m_xControl(std::move(xControl))
- , m_xDropDown(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT))
+ , m_xDropDown(m_xControl->create_virtual_device())
, pPage(pPg)
, m_bIsInternalDrag( false )
{
@@ -994,7 +978,6 @@ SvxConfigPage::SvxConfigPage(TabPageParent pParent, const SfxItemSet& rSet)
, m_xDescriptionFieldLb(m_xBuilder->weld_label("descriptionlabel"))
, m_xDescriptionField(m_xBuilder->weld_text_view("desc"))
, m_xTopLevelListBox(m_xBuilder->weld_combo_box("toplevellist"))
- , m_xGearBtn(m_xBuilder->weld_menu_button("gearbtn"))
, m_xMoveUpButton(m_xBuilder->weld_button("up"))
, m_xMoveDownButton(m_xBuilder->weld_button("down"))
, m_xSaveInListBox(m_xBuilder->weld_combo_box("savein"))
@@ -1301,10 +1284,9 @@ OUString SvxConfigPage::GetScriptURL() const
{
OUString result;
- int nEntry = m_xFunctions->get_selected_index();
- if (nEntry != -1)
+ SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id().toInt64());
+ if (pData)
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_id(nEntry).toInt64());
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT ) ||
( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT ) ||
( pData->nKind == SfxCfgKind::GROUP_STYLES ) )
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index f8de79671425..c7252ad9e498 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -249,23 +249,19 @@ std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const OUString& s
OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
{
- int nSelected = m_xTreeView->get_selected_index();
- if (nSelected != -1)
+ SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ if (pData)
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(nSelected).toInt64());
- if (pData)
+ if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
{
- if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
- {
- if (bConsiderParent)
- return Application::GetHelp()->GetHelpText(pData->sCommand, m_xTreeView.get());
- else
- return Application::GetHelp()->GetHelpText(pData->sCommand, static_cast<weld::Widget*>(nullptr));
- }
- else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
- {
- return pData->sHelpText;
- }
+ if (bConsiderParent)
+ return Application::GetHelp()->GetHelpText(pData->sCommand, m_xTreeView.get());
+ else
+ return Application::GetHelp()->GetHelpText(pData->sCommand, static_cast<weld::Widget*>(nullptr));
+ }
+ else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
+ {
+ return pData->sHelpText;
}
}
return OUString();
@@ -273,22 +269,16 @@ OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
OUString CuiConfigFunctionListBox::GetCurCommand()
{
- int nSelected = m_xTreeView->get_selected_index();
- if (nSelected == -1)
- return OUString();
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(nSelected).toInt64());
- if (!pData)
+ SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ if (pData)
return OUString();
return pData->sCommand;
}
OUString CuiConfigFunctionListBox::GetCurLabel()
{
- int nSelected = m_xTreeView->get_selected_index();
- if (nSelected == -1)
- return OUString();
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(nSelected).toInt64());
- if (!pData)
+ SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ if (pData)
return OUString();
if (!pData->sLabel.isEmpty())
return pData->sLabel;
@@ -341,13 +331,9 @@ void CuiConfigFunctionListBox::ClearAll()
OUString CuiConfigFunctionListBox::GetSelectedScriptURI()
{
- int nSelected = m_xTreeView->get_selected_index();
- if (nSelected != -1)
- {
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(nSelected).toInt64());
- if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
- return *static_cast<OUString*>(pData->pObject);
- }
+ SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
+ return *static_cast<OUString*>(pData->pObject);
return OUString();
}