diff options
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/CommandCategoryListBox.cxx | 29 | ||||
-rw-r--r-- | cui/source/customize/SvxMenuConfigPage.cxx | 22 | ||||
-rw-r--r-- | cui/source/customize/SvxToolbarConfigPage.cxx | 32 | ||||
-rw-r--r-- | cui/source/customize/acccfg.cxx | 8 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 60 | ||||
-rw-r--r-- | cui/source/customize/cfgutil.cxx | 50 | ||||
-rw-r--r-- | cui/source/dialogs/hangulhanjadlg.cxx | 2 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 10 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/CommandCategoryListBox.hxx | 3 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 11 | ||||
-rw-r--r-- | cui/source/inc/cfgutil.hxx | 19 |
12 files changed, 113 insertions, 135 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(); } diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index 501a14c032d7..633154b2ecdb 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -227,7 +227,7 @@ namespace svx }; RubyRadioButton::RubyRadioButton(std::unique_ptr<weld::RadioButton> xControl) - : m_xVirDev(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT)) + : m_xVirDev(xControl->create_virtual_device()) , m_xControl(std::move(xControl)) { // expand the point size of the desired font to the equivalent pixel size diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 11ee06af964d..9e342f482353 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1012,15 +1012,13 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateAutoCorrTabDialog return VclPtr<CuiAbstractTabController_Impl>::Create(std::make_unique<OfaAutoCorrDlg>(pParent, pAttrSet)); } -VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateCustomizeTabDialog( +VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateCustomizeTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet, const Reference< frame::XFrame >& xViewFrame ) { - VclPtr<SfxTabDialog> pDlg; - VclPtrInstance<SvxConfigDialog> pDlg1( nullptr, pAttrSet ); - pDlg1->SetFrame(xViewFrame); - pDlg.reset(pDlg1); - return VclPtr<CuiAbstractTabDialog_Impl>::Create( pDlg ); + std::unique_ptr<SvxConfigDialog> xDlg1(new SvxConfigDialog(pParent, pAttrSet)); + xDlg1->SetFrame(xViewFrame); + return VclPtr<CuiAbstractTabController_Impl>::Create(std::move(xDlg1)); } // TabDialog that use functionality of the drawing layer diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index ea21cfd90575..021cbc0ba1de 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -692,7 +692,7 @@ public: sal_uInt32 nResId, const OUString& rParameter ) override; virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) override; - virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog( + virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet, const css::uno::Reference< css::frame::XFrame >& xViewFrame ) override; virtual VclPtr<SfxAbstractTabDialog> CreateTextTabDialog( weld::Window* pParent, diff --git a/cui/source/inc/CommandCategoryListBox.hxx b/cui/source/inc/CommandCategoryListBox.hxx index 4af8c9acdc17..63dfedead272 100644 --- a/cui/source/inc/CommandCategoryListBox.hxx +++ b/cui/source/inc/CommandCategoryListBox.hxx @@ -72,7 +72,8 @@ public: // Adds children of the given macro group to the functions list void addChildren( weld::TreeIter* parentEntry, const css::uno::Reference<com::sun::star::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); }; #endif // INCLUDED_CUI_SOURCE_INC_COMMANDCATEGORYLISTBOX_HXX diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 8d89aafd84ae..3ac0d4904384 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -73,20 +73,15 @@ class SvxConfigPage; typedef std::vector< SvxConfigEntry* > SvxEntries; -class SvxConfigDialog : public SfxTabDialog +class SvxConfigDialog : public SfxTabDialogController { private: css::uno::Reference< css::frame::XFrame > m_xFrame; - sal_uInt16 m_nMenusPageId; - sal_uInt16 m_nToolbarsPageId; - sal_uInt16 m_nContextMenusPageId; - sal_uInt16 m_nKeyboardPageId; - sal_uInt16 m_nEventsPageId; public: - SvxConfigDialog( vcl::Window*, const SfxItemSet* ); + SvxConfigDialog(weld::Window*, const SfxItemSet*); - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); }; diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx index 9a8eb7382514..a55015a52f59 100644 --- a/cui/source/inc/cfgutil.hxx +++ b/cui/source/inc/cfgutil.hxx @@ -123,10 +123,10 @@ public: { m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, nullptr); } - std::unique_ptr<weld::TreeIter> append_ondemand(const OUString& rId, const OUString& rStr, weld::TreeIter* pParent = nullptr) + std::unique_ptr<weld::TreeIter> tree_append(const OUString& rId, const OUString& rStr, weld::TreeIter* pParent = nullptr) { std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator()); - m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, true, xIter.get()); + m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, xIter.get()); return xIter; } void append(const OUString& rId, const OUString& rStr, const OUString& rImage, weld::TreeIter* pParent = nullptr) @@ -139,6 +139,7 @@ public: m_xTreeView->set_image(*m_xScratchIter, rImage, -1); } void remove(int nPos) { m_xTreeView->remove(nPos); } + void scroll_to_row(int pos) { m_xTreeView->scroll_to_row(pos); } void remove(weld::TreeIter& rIter) { m_xTreeView->remove(rIter); } void expand_row(weld::TreeIter& rIter) { m_xTreeView->expand_row(rIter); } int n_children() const { return m_xTreeView->n_children(); } @@ -153,9 +154,19 @@ public: OUString get_id(const weld::TreeIter& rIter) const { return m_xTreeView->get_id(rIter); } OUString get_id(int nPos) const { return m_xTreeView->get_id(nPos); } bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); } - OUString get_selected_text() const { return m_xTreeView->get_selected_text(); } + OUString get_selected_text() const + { + if (!m_xTreeView->get_selected(m_xScratchIter.get())) + return OUString(); + return m_xTreeView->get_text(*m_xScratchIter); + } + OUString get_selected_id() const + { + if (!m_xTreeView->get_selected(m_xScratchIter.get())) + return OUString(); + return m_xTreeView->get_id(*m_xScratchIter); + } int get_selected_index() const { return m_xTreeView->get_selected_index(); } - void scroll_to_row(int nRow) { return m_xTreeView->scroll_to_row(nRow); } void select(const weld::TreeIter& rIter) { m_xTreeView->select(rIter); } void select(int pos) { m_xTreeView->select(pos); } void set_size_request(int nWidth, int nHeight) { m_xTreeView->set_size_request(nWidth, nHeight); } |