diff options
-rw-r--r-- | include/sfx2/tabdlg.hxx | 4 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 5 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 4 | ||||
-rw-r--r-- | sw/inc/swabstdlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/num.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/misc/outline.cxx | 94 | ||||
-rw-r--r-- | sw/source/uibase/inc/num.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/inc/outline.hxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 2 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/outlinenumbering.ui | 268 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/outlinenumberingpage.ui | 5 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/outlinepositionpage.ui | 20 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 20 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 174 |
18 files changed, 379 insertions, 266 deletions
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 2d9b449112d5..cf7ecc4022bb 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -279,6 +279,8 @@ public: void RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui void SetCurPageId(const OString& rName); + OString GetCurPageId() const; + SfxTabPage* GetCurTabPage() const { return GetTabPage(GetCurPageId()); } // may provide local slots converted by Map const sal_uInt16* GetInputRanges( const SfxItemPool& ); @@ -287,6 +289,8 @@ public: const weld::Button& GetOKButton() const { return *m_xOKBtn; } weld::Button& GetOKButton() { return *m_xOKBtn; } + const weld::Button& GetCancelButton() const { return *m_xCancelBtn; } + weld::Button& GetCancelButton() { return *m_xCancelBtn; } const weld::Button* GetUserButton() const { return m_xUserBtn.get(); } weld::Button* GetUserButton() { return m_xUserBtn.get(); } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 6c1078a04457..448a592fb15c 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -365,8 +365,10 @@ protected: public: void connect_selected(const Link<const OString&, void>& rLink) { m_aSelectHdl = rLink; } - - virtual void set_active(const OString& rIdent, bool bActive) = 0; + virtual void set_item_active(const OString& rIdent, bool bActive) = 0; + virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0; + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0; + virtual OString get_item_help_id(const OString& rIdent) const = 0; }; class VCL_DLLPUBLIC ToggleButton : virtual public Button diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 8c4e04983358..160af8d6af54 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -2015,6 +2015,11 @@ void SfxTabDialogController::SetCurPageId(const OString& rIdent) m_xTabCtrl->set_current_page(rIdent); } +OString SfxTabDialogController::GetCurPageId() const +{ + return m_xTabCtrl->get_current_page_ident(); +} + short SfxTabDialogController::execute() { Start_Impl(); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 7713cd475b05..6843cebfaea8 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -725,7 +725,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory) if (nActiveCategory == 5) bScaleAllBrackets = m_xCheckBox1->get_active(); - m_xMenuButton->set_active("menuitem" + OString::number(nActiveCategory + 1), false); + m_xMenuButton->set_item_active("menuitem" + OString::number(nActiveCategory + 1), false); } // activation/deactivation of the associated controls depending on the chosen category @@ -784,7 +784,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory) m_xMetricField4->set_sensitive( bChecked ); } - m_xMenuButton->set_active("menuitem" + OString::number(nCategory + 1), true); + m_xMenuButton->set_item_active("menuitem" + OString::number(nCategory + 1), true); m_xFrame->set_label(Categories[nCategory]->GetName()); nActiveCategory = nCategory; diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 3ed9b295a0b3..67aecd817661 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -463,7 +463,7 @@ public: virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(vcl::Window* pParent) = 0; virtual VclPtr<AbstractMailMergeFieldConnectionsDlg> CreateMailMergeFieldConnectionsDlg(vcl::Window* pParent) = 0; virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) = 0; - virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(vcl::Window* pParent, + virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(vcl::Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 60485e2137e4..c569a59652c0 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1007,12 +1007,11 @@ VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSvxNumBulletTab return VclPtr<AbstractTabDialog_Impl>::Create( pDlg ); } -VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateOutlineTabDialog(vcl::Window* pParent, +VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell & rWrtSh ) { - VclPtr<SfxTabDialog> pDlg = VclPtr<SwOutlineTabDialog>::Create(pParent, pSwItemSet, rWrtSh); - return VclPtr<AbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractTabController_Impl>::Create(new SwOutlineTabDialog(pParent, pSwItemSet, rWrtSh)); } VclPtr<AbstractMultiTOXTabDialog> SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialog( diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index f2f10176493f..dd6147e22c1c 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -636,7 +636,7 @@ public: virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(vcl::Window* pParent) override; virtual VclPtr<AbstractMailMergeFieldConnectionsDlg> CreateMailMergeFieldConnectionsDlg(vcl::Window* pParent) override; virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) override; - virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* pSwItemSet, + virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) override; virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(vcl::Window* pParent, const SfxItemSet* pSwItemSet, diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 28b4ba9ca185..906d46d580f0 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -142,7 +142,7 @@ SwNumPositionTabPage::~SwNumPositionTabPage() void SwNumPositionTabPage::dispose() { delete pActNum; - pOutlineDlg.clear(); + pOutlineDlg = nullptr; SfxTabPage::dispose(); } @@ -155,9 +155,9 @@ void SwNumPositionTabPage::InitControls() USHRT_MAX != nActNumLvl; m_xDistBorderMF->set_sensitive( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg.get() != nullptr ) ); + ( bSingleSelection || bRelative || pOutlineDlg != nullptr ) ); m_xDistBorderFT->set_sensitive( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg.get() != nullptr ) ); + ( bSingleSelection || bRelative || pOutlineDlg != nullptr ) ); bool bSetDistEmpty = false; bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; @@ -349,7 +349,7 @@ void SwNumPositionTabPage::ActivatePage(const SfxItemSet& ) const SfxPoolItem* pItem; sal_uInt16 nTmpNumLvl = pOutlineDlg ? SwOutlineTabDialog::GetActNumLevel() : 0; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); + const SfxItemSet* pExampleSet = GetDialogController()->GetExampleSet(); if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, false, &pItem) != SfxItemState::UNKNOWN) { bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue(); diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 6baa4cc17535..8f225ec20ba2 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -124,7 +124,6 @@ SwNumNamesDlg::SwNumNamesDlg(weld::Window *pParent) m_xFormBox->connect_changed(LINK(this, SwNumNamesDlg, SelectHdl)); m_xFormBox->connect_row_activated(LINK(this, SwNumNamesDlg, DoubleClickHdl)); m_xFormBox->set_size_request(-1, m_xFormBox->get_height_rows(9)); - SelectHdl(*m_xFormBox); } static sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel) @@ -138,23 +137,22 @@ static sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel) sal_uInt16 SwOutlineTabDialog::nNumLevel = 1; -SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* pSwItemSet, +SwOutlineTabDialog::SwOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &rSh) - : SfxTabDialog(pParent, "OutlineNumberingDialog", - "modules/swriter/ui/outlinenumbering.ui", pSwItemSet) + : SfxTabDialogController(pParent, "modules/swriter/ui/outlinenumbering.ui", "OutlineNumberingDialog", pSwItemSet) , rWrtSh(rSh) , pChapterNumRules(SW_MOD()->GetChapterNumRules()) , bModified(rWrtSh.IsModified()) + , m_xMenuButton(m_xBuilder->weld_menu_button("format")) { - PushButton* pUserButton = GetUserButton(); - pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl)); - pUserButton->SetAccessibleRole( css::accessibility::AccessibleRole::BUTTON_MENU ); + m_xMenuButton->connect_clicked(LINK(this, SwOutlineTabDialog, FormHdl)); + m_xMenuButton->connect_selected(LINK(this, SwOutlineTabDialog, MenuSelectHdl)); xNumRule.reset(new SwNumRule(*rSh.GetOutlineNumRule())); - GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl)); + GetCancelButton().connect_clicked(LINK(this, SwOutlineTabDialog, CancelHdl)); - m_nNumPosId = AddTabPage("position", &SwNumPositionTabPage::Create, nullptr); - m_nOutlineId = AddTabPage("numbering", &SwOutlineSettingsTabPage::Create, nullptr); + AddTabPage("position", &SwNumPositionTabPage::Create, nullptr); + AddTabPage("numbering", &SwOutlineSettingsTabPage::Create, nullptr); OUString sHeadline; sal_uInt16 i; @@ -186,82 +184,71 @@ SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* p SwOutlineTabDialog::~SwOutlineTabDialog() { - disposeOnce(); -} - -void SwOutlineTabDialog::dispose() -{ - xNumRule.reset(); - SfxTabDialog::dispose(); } -void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) +void SwOutlineTabDialog::PageCreated(const OString& rPageId, SfxTabPage& rPage) { - if (nPageId == m_nNumPosId) + if (rPageId == "position") { static_cast<SwNumPositionTabPage&>(rPage).SetWrtShell(&rWrtSh); static_cast<SwNumPositionTabPage&>(rPage).SetOutlineTabDialog(this); } - else if (nPageId == m_nOutlineId) + else if (rPageId == "numbering") { static_cast<SwOutlineSettingsTabPage&>(rPage).SetWrtShell(&rWrtSh); } } -IMPL_LINK_NOARG(SwOutlineTabDialog, CancelHdl, Button*, void) +IMPL_LINK_NOARG(SwOutlineTabDialog, CancelHdl, weld::Button&, void) { if (!bModified) rWrtSh.ResetModified(); - EndDialog(); + m_xDialog->response(RET_CANCEL); } -IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn, void ) +IMPL_LINK_NOARG(SwOutlineTabDialog, FormHdl, weld::Button&, void) { - PopupMenu *pFormMenu = get_menu("form"); // fill PopupMenu - for( sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i ) + for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i) { const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i); - if( pRules ) - pFormMenu->SetItemText(pFormMenu->GetItemId(i), pRules->GetName()); + if (!pRules) + continue; + m_xMenuButton->set_item_label("form" + OString::number(i + 1), pRules->GetName()); } - OString sHelpId(pFormMenu->GetHelpId(pFormMenu->GetItemId("form1"))); + OString sHelpId(m_xMenuButton->get_item_help_id("form1")); for (sal_Int32 i = 2; i <= 9; ++i) { - pFormMenu->SetHelpId(pFormMenu->GetItemId("form" + OString::number(i)), sHelpId); + m_xMenuButton->set_item_help_id("form" + OString::number(i), sHelpId); } - - pFormMenu->SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl)); - pFormMenu->Execute(pBtn, tools::Rectangle(Point(0,0), pBtn->GetSizePixel()), PopupMenuFlags::ExecuteDown); } -IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool ) +IMPL_LINK(SwOutlineTabDialog, MenuSelectHdl, const OString&, rIdent, void) { sal_uInt8 nLevelNo = 0; - OString sIdent = pMenu->GetCurItemIdent(); - if (sIdent == "form1") + if (rIdent == "form1") nLevelNo = 1; - else if (sIdent == "form2") + else if (rIdent == "form2") nLevelNo = 2; - else if (sIdent == "form3") + else if (rIdent == "form3") nLevelNo = 3; - else if (sIdent == "form4") + else if (rIdent == "form4") nLevelNo = 4; - else if (sIdent == "form5") + else if (rIdent == "form5") nLevelNo = 5; - else if (sIdent == "form6") + else if (rIdent == "form6") nLevelNo = 6; - else if (sIdent == "form7") + else if (rIdent == "form7") nLevelNo = 7; - else if (sIdent == "form8") + else if (rIdent == "form8") nLevelNo = 8; - else if (sIdent == "form9") + else if (rIdent == "form9") nLevelNo = 9; - else if (sIdent == "saveas") + else if (rIdent == "saveas") { - SwNumNamesDlg aDlg(GetFrameWeld()); + SwNumNamesDlg aDlg(m_xDialog.get()); const OUString *aStrArr[SwChapterNumRules::nMaxRules]; for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i) { @@ -277,9 +264,9 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool ) const OUString aName(aDlg.GetName()); pChapterNumRules->ApplyNumRules( SwNumRulesWithName( *xNumRule, aName ), aDlg.GetCurEntryPos() ); - pMenu->SetItemText(pMenu->GetItemId(aDlg.GetCurEntryPos()), aName); + m_xMenuButton->set_item_label("form" + OString::number(aDlg.GetCurEntryPos() + 1), aName); } - return false; + return; } if( nLevelNo-- ) @@ -289,7 +276,7 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool ) { xNumRule.reset(pRules->MakeNumRule(rWrtSh)); xNumRule->SetRuleType( OUTLINE_RULE ); - SfxTabPage* pOutlinePage = GetTabPage(m_nOutlineId); + SfxTabPage* pOutlinePage = GetTabPage("numbering"); assert(pOutlinePage); static_cast<SwOutlineSettingsTabPage*>(pOutlinePage)->SetNumRule(xNumRule.get()); } @@ -297,11 +284,8 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool ) *xNumRule = *rWrtSh.GetOutlineNumRule(); } - sal_uInt16 nPageId = GetCurPageId(); - SfxTabPage* pPage = GetTabPage( nPageId ); + SfxTabPage* pPage = GetCurTabPage(); pPage->Reset(GetOutputItemSet()); - - return false; } sal_uInt16 SwOutlineTabDialog::GetLevel(const OUString &rFormatName) const @@ -316,7 +300,7 @@ sal_uInt16 SwOutlineTabDialog::GetLevel(const OUString &rFormatName) const short SwOutlineTabDialog::Ok() { - SfxTabDialog::Ok(); + SfxTabDialogController::Ok(); // set levels for all created templates; has to be done in order to // delete possibly cancelled assignments again. @@ -736,8 +720,8 @@ void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell) { pSh = pShell; // query this document's NumRules - pNumRule = static_cast<SwOutlineTabDialog*>(GetTabDialog())->GetNumRule(); - pCollNames = static_cast<SwOutlineTabDialog*>(GetTabDialog())->GetCollNames(); + pNumRule = static_cast<SwOutlineTabDialog*>(GetDialogController())->GetNumRule(); + pCollNames = static_cast<SwOutlineTabDialog*>(GetDialogController())->GetCollNames(); m_xPreviewWIN->SetNumRule(pNumRule); m_xPreviewWIN->SetOutlineNames(pCollNames); diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index 5d0817cd273e..6bedc870255f 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -41,8 +41,8 @@ class SwNumPositionTabPage : public SfxTabPage SwNumRule* pSaveNum; SwWrtShell* pWrtSh; - VclPtr<SwOutlineTabDialog> pOutlineDlg; - sal_uInt16 nActNumLvl; + SwOutlineTabDialog* pOutlineDlg; + sal_uInt16 nActNumLvl; bool bModified : 1; bool bPreset : 1; diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx index e788738a2c9e..da5c0e94fddf 100644 --- a/sw/source/uibase/inc/outline.hxx +++ b/sw/source/uibase/inc/outline.hxx @@ -43,13 +43,10 @@ class SwWrtShell; class SwNumRule; class SwChapterNumRules; -class SwOutlineTabDialog final : public SfxTabDialog +class SwOutlineTabDialog final : public SfxTabDialogController { static sal_uInt16 nNumLevel; - sal_uInt16 m_nNumPosId; - sal_uInt16 m_nOutlineId; - OUString aCollNames[MAXLEVEL]; SwWrtShell& rWrtSh; @@ -58,19 +55,18 @@ class SwOutlineTabDialog final : public SfxTabDialog bool bModified : 1; - DECL_LINK(CancelHdl, Button*, void); - DECL_LINK( FormHdl, Button *, void ); - DECL_LINK( MenuSelectHdl, Menu *, bool ); + std::unique_ptr<weld::MenuButton> m_xMenuButton; + + DECL_LINK(CancelHdl, weld::Button&, void); + DECL_LINK(FormHdl, weld::Button&, void); + DECL_LINK(MenuSelectHdl, const OString&, void); - virtual void PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) override; + virtual void PageCreated(const OString& rPageId, SfxTabPage& rPage) override; virtual short Ok() override; public: - SwOutlineTabDialog(vcl::Window* pParent, - const SfxItemSet* pSwItemSet, - SwWrtShell &); + SwOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); virtual ~SwOutlineTabDialog() override; - virtual void dispose() override; SwNumRule* GetNumRule() { return xNumRule.get(); } sal_uInt16 GetLevel(const OUString &rFormatName) const; diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 4b7694b49584..f4913d84c9b9 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -610,7 +610,7 @@ void SwView::ExecNumberingOutline(SfxItemPool & rPool) SfxItemSet aTmp(rPool, svl::Items<FN_PARAM_1, FN_PARAM_1>{}); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateOutlineTabDialog(GetWindow(), &aTmp, GetWrtShell())); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateOutlineTabDialog(GetFrameWeld(), &aTmp, GetWrtShell())); assert(pDlg && "Dialog creation failed!"); pDlg->Execute(); } diff --git a/sw/uiconfig/swriter/ui/outlinenumbering.ui b/sw/uiconfig/swriter/ui/outlinenumbering.ui index ffb495c9280f..ae5abdf63a8f 100644 --- a/sw/uiconfig/swriter/ui/outlinenumbering.ui +++ b/sw/uiconfig/swriter/ui/outlinenumbering.ui @@ -1,13 +1,105 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> + <object class="GtkMenu" id="form"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="form1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form1">Untitled 1</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form2">Untitled 2</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form3">Untitled 3</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form4">Untitled 4</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form5">Untitled 5</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form6">Untitled 6</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form7">Untitled 7</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form8">Untitled 8</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="form9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|form9">Untitled 9</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem" id="menuitem10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="saveas"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="outlinenumbering|saveas">Save _As...</property> + <property name="use_underline">True</property> + </object> + </child> + </object> <object class="GtkDialog" id="OutlineNumberingDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="outlinenumbering|OutlineNumberingDialog">Chapter Numbering</property> <property name="resizable">False</property> <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -19,14 +111,16 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkMenuButton" id="format"> + <property name="label" translatable="yes" context="outlinenumbering|user">_Format</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="use_underline">True</property> + <property name="popup">form</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -35,12 +129,12 @@ </packing> </child> <child> - <object class="GtkButton" id="user"> - <property name="label" translatable="yes" context="outlinenumbering|user">_Format</property> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> @@ -49,10 +143,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -63,8 +159,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -74,12 +170,11 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label">gtk-revert-to-saved</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -89,6 +184,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">4</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -112,6 +208,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -131,6 +251,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -157,101 +301,13 @@ </object> </child> <action-widgets> + <action-widget response="0">reset</action-widget> <action-widget response="-5">ok</action-widget> - <action-widget response="0">user</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="0">reset</action-widget> </action-widgets> - </object> - <object class="GtkMenu" id="form"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuItem" id="form1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form1">Untitled 1</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form2">Untitled 2</property> - <property name="use_underline">True</property> - </object> - </child> <child> - <object class="GtkMenuItem" id="form3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form3">Untitled 3</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form4">Untitled 4</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form5">Untitled 5</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form6">Untitled 6</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form7"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form7">Untitled 7</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form8"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form8">Untitled 8</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="form9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|form9">Untitled 9</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkSeparatorMenuItem" id="menuitem10"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="saveas"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="outlinenumbering|saveas">Save _As...</property> - <property name="use_underline">True</property> - </object> + <placeholder/> </child> </object> </interface> diff --git a/sw/uiconfig/swriter/ui/outlinenumberingpage.ui b/sw/uiconfig/swriter/ui/outlinenumberingpage.ui index a85ac72b6cc7..63ca632a366b 100644 --- a/sw/uiconfig/swriter/ui/outlinenumberingpage.ui +++ b/sw/uiconfig/swriter/ui/outlinenumberingpage.ui @@ -2,7 +2,6 @@ <!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">999</property> <property name="step_increment">1</property> @@ -26,6 +25,8 @@ <object class="GtkBox" id="OutlineNumberingPage"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="spacing">12</property> <child> @@ -44,8 +45,6 @@ <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> <object class="GtkTreeView" id="level"> diff --git a/sw/uiconfig/swriter/ui/outlinepositionpage.ui b/sw/uiconfig/swriter/ui/outlinepositionpage.ui index b310ef8bfa19..d0f356a36a33 100644 --- a/sw/uiconfig/swriter/ui/outlinepositionpage.ui +++ b/sw/uiconfig/swriter/ui/outlinepositionpage.ui @@ -18,6 +18,21 @@ <property name="step_increment">0.050000000000000003</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="upper">100</property> + <property name="step_increment">0.01</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment5"> + <property name="upper">100</property> + <property name="step_increment">0.01</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="upper">100</property> + <property name="step_increment">0.01</property> + <property name="page_increment">1</property> + </object> <object class="GtkListStore" id="liststore1"> <columns> <!-- column-name text --> @@ -49,8 +64,6 @@ <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> <object class="GtkTreeView" id="levellb"> @@ -275,6 +288,7 @@ numbering and text:</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="activates_default">True</property> + <property name="adjustment">adjustment6</property> <property name="digits">2</property> </object> <packing> @@ -325,6 +339,7 @@ numbering and text:</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="activates_default">True</property> + <property name="adjustment">adjustment4</property> <property name="digits">2</property> </object> <packing> @@ -351,6 +366,7 @@ numbering and text:</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="activates_default">True</property> + <property name="adjustment">adjustment5</property> <property name="digits">2</property> </object> <packing> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 0ff54771656b..a2dfb0f45e41 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -915,12 +915,30 @@ public: m_xMenuButton->SetSelectHdl(LINK(this, SalInstanceMenuButton, MenuSelectHdl)); } - virtual void set_active(const OString& rIdent, bool bActive) override + virtual void set_item_active(const OString& rIdent, bool bActive) override { PopupMenu* pMenu = m_xMenuButton->GetPopupMenu(); pMenu->CheckItem(pMenu->GetItemId(rIdent), bActive); } + virtual void set_item_label(const OString& rIdent, const OUString& rText) override + { + PopupMenu* pMenu = m_xMenuButton->GetPopupMenu(); + pMenu->SetItemText(pMenu->GetItemId(rIdent), rText); + } + + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override + { + PopupMenu* pMenu = m_xMenuButton->GetPopupMenu(); + pMenu->SetHelpId(pMenu->GetItemId(rIdent), rHelpId); + } + + virtual OString get_item_help_id(const OString& rIdent) const override + { + PopupMenu* pMenu = m_xMenuButton->GetPopupMenu(); + return pMenu->GetHelpId(pMenu->GetItemId(rIdent)); + } + virtual ~SalInstanceMenuButton() override { m_xMenuButton->SetSelectHdl(Link<::MenuButton*, void>()); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 65e31948aa0b..1b6b7726cf38 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -8,6 +8,7 @@ */ #include <memory> +#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <i18nutil/unicode.hxx> @@ -1426,6 +1427,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & assert(!sMenu.isEmpty()); m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu); xButton->SetImageAlign(ImageAlign::Left); //default to left + xButton->SetAccessibleRole(css::accessibility::AccessibleRole::BUTTON_MENU); setupFromActionName(xButton, rMap, m_xFrame); xWindow = xButton; } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 845e15ad15e4..d881155c7d40 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1449,6 +1449,75 @@ public: } }; +namespace +{ + OString MapToGtkAccelerator(const OUString &rStr) + { + return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8); + } + + OUString get_label(GtkLabel* pLabel) + { + const gchar* pStr = gtk_label_get_label(pLabel); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_label(GtkLabel* pLabel, const OUString& rText) + { + gtk_label_set_label(pLabel, MapToGtkAccelerator(rText).getStr()); + } + + OUString get_label(GtkButton* pButton) + { + const gchar* pStr = gtk_button_get_label(pButton); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_label(GtkButton* pButton, const OUString& rText) + { + gtk_button_set_label(pButton, MapToGtkAccelerator(rText).getStr()); + } + + OUString get_title(GtkWindow* pWindow) + { + const gchar* pStr = gtk_window_get_title(pWindow); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_title(GtkWindow* pWindow, const OUString& rTitle) + { + gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr()); + } + + OUString get_primary_text(GtkMessageDialog* pMessageDialog) + { + gchar* pText = nullptr; + g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr); + return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) + { + g_object_set(G_OBJECT(pMessageDialog), "text", + OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), + nullptr); + } + + void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) + { + g_object_set(G_OBJECT(pMessageDialog), "secondary-text", + OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), + nullptr); + } + + OUString get_secondary_text(GtkMessageDialog* pMessageDialog) + { + gchar* pText = nullptr; + g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr); + return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); + } +} + class MenuHelper { protected: @@ -1519,6 +1588,21 @@ public: enable_item_notify_events(); } + void set_item_label(const OString& rIdent, const OUString& rText) + { + gtk_menu_item_set_label(m_aMap[rIdent], MapToGtkAccelerator(rText).getStr()); + } + + void set_item_help_id(const OString& rIdent, const OString& rHelpId) + { + set_help_id(GTK_WIDGET(m_aMap[rIdent]), rHelpId); + } + + OString get_item_help_id(const OString& rIdent) const + { + return get_help_id(GTK_WIDGET(m_aMap.find(rIdent)->second)); + } + void show_item(const OString& rIdent, bool bShow) { GtkWidget* pWidget = GTK_WIDGET(m_aMap[rIdent]); @@ -1666,75 +1750,6 @@ weld::Container* GtkInstanceWidget::weld_parent() const return pParent ? new GtkInstanceContainer(GTK_CONTAINER(pParent), false) : nullptr; } -namespace -{ - OString MapToGtkAccelerator(const OUString &rStr) - { - return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8); - } - - OUString get_label(GtkLabel* pLabel) - { - const gchar* pStr = gtk_label_get_label(pLabel); - return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_label(GtkLabel* pLabel, const OUString& rText) - { - gtk_label_set_label(pLabel, MapToGtkAccelerator(rText).getStr()); - } - - OUString get_label(GtkButton* pButton) - { - const gchar* pStr = gtk_button_get_label(pButton); - return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_label(GtkButton* pButton, const OUString& rText) - { - gtk_button_set_label(pButton, MapToGtkAccelerator(rText).getStr()); - } - - OUString get_title(GtkWindow* pWindow) - { - const gchar* pStr = gtk_window_get_title(pWindow); - return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_title(GtkWindow* pWindow, const OUString& rTitle) - { - gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr()); - } - - OUString get_primary_text(GtkMessageDialog* pMessageDialog) - { - gchar* pText = nullptr; - g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr); - return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) - { - g_object_set(G_OBJECT(pMessageDialog), "text", - OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), - nullptr); - } - - void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) - { - g_object_set(G_OBJECT(pMessageDialog), "secondary-text", - OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), - nullptr); - } - - OUString get_secondary_text(GtkMessageDialog* pMessageDialog) - { - gchar* pText = nullptr; - g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr); - return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); - } -} - class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Window { private: @@ -2578,9 +2593,24 @@ public: { } - virtual void set_active(const OString& rIdent, bool bActive) override + virtual void set_item_active(const OString& rIdent, bool bActive) override { - set_item_active(rIdent, bActive); + MenuHelper::set_item_active(rIdent, bActive); + } + + virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override + { + MenuHelper::set_item_label(rIdent, rLabel); + } + + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override + { + MenuHelper::set_item_help_id(rIdent, rHelpId); + } + + virtual OString get_item_help_id(const OString& rIdent) const override + { + return MenuHelper::get_item_help_id(rIdent); } virtual void signal_activate(GtkMenuItem* pItem) override @@ -3211,7 +3241,9 @@ public: virtual void set_selection_mode(bool bMultiple) override { + disable_notify_events(); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(m_pTreeView), bMultiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE); + enable_notify_events(); } virtual int count_selected_rows() const override |