diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-02 12:15:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-03 09:50:45 +0200 |
commit | ea7b290a691f33caa3327bd1cb57b97a92c94dc7 (patch) | |
tree | 8c8ebddc42674caac4b9cdef431306cccc0618d8 | |
parent | 2b402bbd34624c4759fa411c98bb60da1dd11e76 (diff) |
weld SwSvxNumBulletTabDialog
Change-Id: I8ea74dc15bba04c0615e61c069407160a7b95c4c
Reviewed-on: https://gerrit.libreoffice.org/61242
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/inc/numpages.hxx | 1 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 16 | ||||
-rw-r--r-- | cui/uiconfig/ui/numberingoptionspage.ui | 6 | ||||
-rw-r--r-- | cui/uiconfig/ui/numberingpositionpage.ui | 35 | ||||
-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 | 50 | ||||
-rw-r--r-- | sw/source/uibase/inc/num.hxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/shells/txtnum.cxx | 6 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/bulletsandnumbering.ui | 193 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 105 |
12 files changed, 319 insertions, 116 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index 67f6a37ef782..5d0a1574e0c6 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -268,6 +268,7 @@ class SvxNumOptionsTabPage : public SfxTabPage MapUnit eCoreUnit; cui::NumberingPreview m_aPreviewWIN; + std::unique_ptr<weld::Widget> m_xGrid; std::unique_ptr<weld::TreeView> m_xLevelLB; std::unique_ptr<weld::ComboBox> m_xFmtLB; std::unique_ptr<weld::Label> m_xSeparatorFT; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 4c3b5433ff2b..a853745965aa 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -1057,6 +1057,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(TabPageParent pParent, , nBullet(0xff) , nActNumLvl(1) , nNumItemId(SID_ATTR_NUMBERING_RULE) + , m_xGrid(m_xBuilder->weld_widget("grid2")) , m_xLevelLB(m_xBuilder->weld_tree_view("levellb")) , m_xFmtLB(m_xBuilder->weld_combo_box("numfmtlb")) , m_xSeparatorFT(m_xBuilder->weld_label("separator")) @@ -1130,6 +1131,12 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(TabPageParent pParent, // 136 == 0x88 == SVX_NUM_BITMAP|0x80 == SVX_NUM_BITMAP|LINK_TOKEN // to not remove that. SvxNumOptionsTabPageHelper::GetI18nNumbering( *m_xFmtLB, (SVX_NUM_BITMAP | LINK_TOKEN)); + + m_xFmtLB->set_active(0); + + m_xCharFmtLB->set_size_request(m_xCharFmtLB->get_approximate_digit_width() * 10, -1); + Size aSize(m_xGrid->get_preferred_size()); + m_xGrid->set_size_request(aSize.Width(), -1); } SvxNumOptionsTabPage::~SvxNumOptionsTabPage() @@ -1911,7 +1918,6 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::ToggleButton& INetURLObject aObj(grfName); if(aObj.GetProtocol() == INetProtocol::File) grfName = aObj.PathToFileName(); - if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic)) { BitmapEx aBitmap(aGraphic.GetBitmapEx()); @@ -2036,11 +2042,9 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, if (bRatio) { aSize.setHeight( aInitSize[i].Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) ); -#if 0 //TODO - m_xHeightMF->SetUserValue(m_xHeightMF->normalize( + m_xHeightMF->set_value(m_xHeightMF->normalize( OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )), FUNIT_100TH_MM); -#endif } } else @@ -2050,11 +2054,9 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, if (bRatio) { aSize.setWidth( aInitSize[i].Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) ); -#if 0 //TODO - m_xWidthMF->SetUserValue(m_xWidthMF->normalize( + m_xWidthMF->set_value(m_xWidthMF->normalize( OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )), FUNIT_100TH_MM); -#endif } } const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); diff --git a/cui/uiconfig/ui/numberingoptionspage.ui b/cui/uiconfig/ui/numberingoptionspage.ui index d29e1f586de5..22725e92ceee 100644 --- a/cui/uiconfig/ui/numberingoptionspage.ui +++ b/cui/uiconfig/ui/numberingoptionspage.ui @@ -168,6 +168,7 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="label" translatable="yes" context="numberingoptionspage|label4">Number:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">numfmtlb</property> @@ -179,7 +180,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="charstyle"> + <object class="GtkComboBoxText" id="charstyle"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -228,7 +229,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="numfmtlb"> + <object class="GtkComboBoxText" id="numfmtlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -339,6 +340,7 @@ <object class="GtkComboBoxText" id="orientlb"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="active">0</property> <items> <item translatable="yes" context="numberingoptionspage|orientlb">Top of baseline</item> <item translatable="yes" context="numberingoptionspage|orientlb">Center of baseline</item> diff --git a/cui/uiconfig/ui/numberingpositionpage.ui b/cui/uiconfig/ui/numberingpositionpage.ui index 5b15b93ff796..e369e683ddde 100644 --- a/cui/uiconfig/ui/numberingpositionpage.ui +++ b/cui/uiconfig/ui/numberingpositionpage.ui @@ -18,6 +18,29 @@ <property name="step_increment">0.050000000000000003</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="upper">19.989999999999998</property> + <property name="step_increment">0.01</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment5"> + <property name="upper">19.989999999999998</property> + <property name="step_increment">0.01</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="upper">19.989999999999998</property> + <property name="step_increment">0.01</property> + <property name="page_increment">10</property> + </object> + <object class="GtkListStore" id="liststore1"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkBox" id="NumberingPositionPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -46,6 +69,7 @@ <object class="GtkTreeView" id="levellb"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="model">liststore1</property> <property name="headers_visible">False</property> <property name="headers_clickable">False</property> <property name="search_column">0</property> @@ -180,6 +204,7 @@ <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> @@ -206,6 +231,7 @@ <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> @@ -218,6 +244,7 @@ <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> @@ -466,12 +493,4 @@ numbering and text:</property> </packing> </child> </object> - <object class="GtkListStore" id="liststore1"> - <columns> - <!-- column-name text --> - <column type="gchararray"/> - <!-- column-name id --> - <column type="gchararray"/> - </columns> - </object> </interface> diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index da2486e48b71..6673fdef64ac 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -465,7 +465,7 @@ public: virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) = 0; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(vcl::Window* pParent, + virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) = 0; virtual VclPtr<AbstractMultiTOXTabDialog> CreateMultiTOXTabDialog( diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 5e1c01acdacc..4ad47f91a41b 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1049,12 +1049,11 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg(we return VclPtr<AbstractMultiTOXMarkDlg_Impl>::Create(o3tl::make_unique<SwMultiTOXMarkDlg>(pParent, rTOXMgr)); } -VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSvxNumBulletTabDialog(vcl::Window* pParent, +VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell & rWrtSh) { - VclPtr<SfxTabDialog> pDlg = VclPtr<SwSvxNumBulletTabDialog>::Create(pParent, pSwItemSet, rWrtSh); - return VclPtr<AbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractTabController_Impl>::Create(o3tl::make_unique<SwSvxNumBulletTabDialog>(pParent, pSwItemSet, rWrtSh)); } VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateOutlineTabDialog(weld::Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 2ad87e1986dc..208d423fc3c7 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -667,7 +667,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) override; virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(vcl::Window* pParent, + virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &) override; virtual VclPtr<AbstractMultiTOXTabDialog> CreateMultiTOXTabDialog( diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index be703641970b..35e763f326d6 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -876,63 +876,63 @@ void SwNumPositionTabPage::SetModified() } #endif -SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(vcl::Window* pParent, +SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell & rSh) - : SfxTabDialog(pParent, "BulletsAndNumberingDialog", - "modules/swriter/ui/bulletsandnumbering.ui", + : SfxTabDialogController(pParent, "modules/swriter/ui/bulletsandnumbering.ui", "BulletsAndNumberingDialog", pSwItemSet) , rWrtSh(rSh) + , m_xDummyCombo(m_xBuilder->weld_combo_box("dummycombo")) { - GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl)); - GetUserButton()->Enable(rWrtSh.GetNumRuleAtCurrCursorPos() != nullptr); - m_nSingleNumPageId = AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM ); - m_nBulletPageId = AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET ); + weld::Button* pButton = GetUserButton(); + pButton->connect_clicked(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl)); + pButton->set_sensitive(rWrtSh.GetNumRuleAtCurrCursorPos() != nullptr); + AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM ); + AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET ); AddTabPage("outlinenum", RID_SVXPAGE_PICK_NUM ); AddTabPage("graphics", RID_SVXPAGE_PICK_BMP ); - m_nOptionsPageId = AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS ); - m_nPositionPageId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION ); + AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS ); + AddTabPage("position", RID_SVXPAGE_NUM_POSITION ); } SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog() { } -void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) +void SwSvxNumBulletTabDialog::PageCreated(const OString& rPageId, SfxTabPage& rPage) { // set styles' names and metric OUString sNumCharFormat, sBulletCharFormat; SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFormat ); SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFormat ); - if (nPageId == m_nSingleNumPageId) + if (rPageId == "singlenum") { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat)); rPage.PageCreated(aSet); } - else if (nPageId == m_nBulletPageId) + else if (rPageId == "bullets") { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat)); rPage.PageCreated(aSet); } - else if (nPageId == m_nOptionsPageId) + else if (rPageId == "customize") { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat)); // collect char styles - ScopedVclPtrInstance< ListBox > rCharFormatLB(this); - rCharFormatLB->Clear(); - rCharFormatLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + m_xDummyCombo->clear(); + m_xDummyCombo->append_text(SwViewShell::GetShellRes()->aStrNone); SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - ::FillCharStyleListBox(*rCharFormatLB.get(), pDocShell); + ::FillCharStyleListBox(*m_xDummyCombo, pDocShell); std::vector<OUString> aList; - aList.reserve(rCharFormatLB->GetEntryCount()); - for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) - aList.push_back(rCharFormatLB->GetEntry(j)); + aList.reserve(m_xDummyCombo->get_count()); + for (sal_Int32 j = 0; j < m_xDummyCombo->get_count(); j++) + aList.push_back(m_xDummyCombo->get_text(j)); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; @@ -940,7 +940,7 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) ); rPage.PageCreated(aSet); } - else if (nPageId == m_nPositionPageId) + else if (rPageId == "position") { SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); @@ -952,14 +952,14 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) short SwSvxNumBulletTabDialog::Ok() { - short nRet = SfxTabDialog::Ok(); - m_pExampleSet->ClearItem(SID_PARAM_NUM_PRESET); + short nRet = SfxTabDialogController::Ok(); + m_xExampleSet->ClearItem(SID_PARAM_NUM_PRESET); return nRet; } -IMPL_LINK_NOARG(SwSvxNumBulletTabDialog, RemoveNumberingHdl, Button*, void) +IMPL_LINK_NOARG(SwSvxNumBulletTabDialog, RemoveNumberingHdl, weld::Button&, void) { - EndDialog(RET_USER); + m_xDialog->response(RET_USER); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index b4aa9f79cdc4..5554cdf2f4a6 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -129,20 +129,18 @@ public: #endif }; -class SwSvxNumBulletTabDialog final : public SfxTabDialog +class SwSvxNumBulletTabDialog final : public SfxTabDialogController { SwWrtShell& rWrtSh; - sal_uInt16 m_nSingleNumPageId; - sal_uInt16 m_nBulletPageId; - sal_uInt16 m_nOptionsPageId; - sal_uInt16 m_nPositionPageId; virtual short Ok() override; - virtual void PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) override; - DECL_LINK(RemoveNumberingHdl, Button*, void); + virtual void PageCreated(const OString& rPageId, SfxTabPage& rPage) override; + DECL_LINK(RemoveNumberingHdl, weld::Button&, void); + + std::unique_ptr<weld::ComboBox> m_xDummyCombo; public: - SwSvxNumBulletTabDialog(vcl::Window* pParent, + SwSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); virtual ~SwSvxNumBulletTabDialog() override; diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx index 0fedafa0f7c3..daaab629bcd9 100644 --- a/sw/source/uibase/shells/txtnum.cxx +++ b/sw/source/uibase/shells/txtnum.cxx @@ -182,10 +182,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - vcl::Window *pParent = rReq.GetFrameWindow(); - if (!pParent) - pParent = GetView().GetWindow(); - + weld::Window *pParent = rReq.GetFrameWeld(); VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxNumBulletTabDialog(pParent, &aSet, GetShell())); const SfxStringItem* pPageItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1); if ( pPageItem ) @@ -234,6 +231,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) } else if (RET_USER == nResult) GetShell().DelNumRules(); + pDlg->disposeOnce(); }); } break; diff --git a/sw/uiconfig/swriter/ui/bulletsandnumbering.ui b/sw/uiconfig/swriter/ui/bulletsandnumbering.ui index b5434b3bf36b..05886850315a 100644 --- a/sw/uiconfig/swriter/ui/bulletsandnumbering.ui +++ b/sw/uiconfig/swriter/ui/bulletsandnumbering.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="BulletsAndNumberingDialog"> @@ -7,8 +7,12 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="bulletsandnumbering|BulletsAndNumberingDialog">Bullets and Numbering</property> <property name="resizable">False</property> + <property name="modal">True</property> <property name="window_position">mouse</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -19,14 +23,12 @@ <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="GtkButton" id="user"> + <property name="label" translatable="yes" context="bulletsandnumbering|user">_Remove</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> </object> <packing> <property name="expand">False</property> @@ -35,8 +37,8 @@ </packing> </child> <child> - <object class="GtkButton" id="user"> - <property name="label" translatable="yes" context="bulletsandnumbering|user">_Remove</property> + <object class="GtkButton" id="reset"> + <property name="label" translatable="yes" context="bulletsandnumbering|reset">Reset</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -49,10 +51,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 +67,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,20 +78,31 @@ <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" translatable="yes" context="bulletsandnumbering|reset">Reset</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> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="position">4</property> + <property name="secondary">True</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="dummycombo"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">5</property> </packing> </child> </object> @@ -113,6 +128,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"> @@ -132,6 +171,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> @@ -155,6 +218,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">2</property> @@ -178,6 +265,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">3</property> @@ -201,6 +312,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">4</property> @@ -224,6 +359,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">5</property> @@ -250,11 +409,11 @@ </object> </child> <action-widgets> - <action-widget response="-5">ok</action-widget> <action-widget response="0">user</action-widget> + <action-widget response="0">reset</action-widget> + <action-widget response="-5">ok</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> </interface> diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index ada894820f59..eac52843af19 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1692,6 +1692,43 @@ public: } }; +namespace +{ + GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang) + { + GdkPixbuf* pixbuf = nullptr; + auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang); + if (xMemStm) + { + GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new(); + gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()), + xMemStm->Seek(STREAM_SEEK_TO_END), nullptr); + gdk_pixbuf_loader_close(pixbuf_loader, nullptr); + pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader); + if (pixbuf) + g_object_ref(pixbuf); + g_object_unref(pixbuf_loader); + } + return pixbuf; + } + + GdkPixbuf* load_icon_by_name(const OUString& rIconName) + { + OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); + OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); + return load_icon_by_name(rIconName, sIconTheme, sUILang); + } + + GdkPixbuf* load_icon_from_surface(VirtualDevice& rDevice) + { + Size aSize(rDevice.GetOutputSizePixel()); + cairo_surface_t* surface = get_underlying_cairo_surface(rDevice); + double m_fXScale, m_fYScale; + cairo_surface_get_device_scale(surface, &m_fXScale, &m_fYScale); + return gdk_pixbuf_get_from_surface(surface, 0, 0, aSize.Width() * m_fXScale, aSize.Height() * m_fYScale); + } +} + class GtkInstanceMenu : public MenuHelper, public virtual weld::Menu { protected: @@ -1789,13 +1826,38 @@ public: show_item(rIdent, bShow); } - virtual void insert(int pos, const OUString& rId, const OUString& rStr, - const OUString* /*pIconName*/, VirtualDevice* /*pImageSufface*/) override + const OUString* pIconName, VirtualDevice* pImageSufface) override { - GtkWidget *pItem = gtk_menu_item_new_with_label(MapToGtkAccelerator(rStr).getStr()); + GtkWidget* pImage = nullptr; + if (pIconName) + { + GdkPixbuf* pixbuf = load_icon_by_name(*pIconName); + if (!pixbuf) + { + pImage = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(pixbuf); + } + } + else if (pImageSufface) + pImage = gtk_image_new_from_surface(get_underlying_cairo_surface(*pImageSufface)); + + GtkWidget *pItem; + if (pImage) + { + GtkWidget *pBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + GtkWidget *pLabel = gtk_label_new(MapToGtkAccelerator(rStr).getStr()); + pItem = gtk_menu_item_new(); + gtk_container_add(GTK_CONTAINER(pBox), pImage); + gtk_container_add(GTK_CONTAINER(pBox), pLabel); + gtk_container_add(GTK_CONTAINER(pItem), pBox); + gtk_widget_show_all(pItem); + } + else + pItem = gtk_menu_item_new_with_label(MapToGtkAccelerator(rStr).getStr()); gtk_buildable_set_name(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); gtk_menu_shell_append(GTK_MENU_SHELL(m_pMenu), pItem); + gtk_widget_show(pItem); add_to_map(GTK_MENU_ITEM(pItem)); if (pos != -1) gtk_menu_reorder_child(m_pMenu, pItem, pos); @@ -2763,43 +2825,6 @@ public: } }; -namespace -{ - GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang) - { - GdkPixbuf* pixbuf = nullptr; - auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang); - if (xMemStm) - { - GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new(); - gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()), - xMemStm->Seek(STREAM_SEEK_TO_END), nullptr); - gdk_pixbuf_loader_close(pixbuf_loader, nullptr); - pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader); - if (pixbuf) - g_object_ref(pixbuf); - g_object_unref(pixbuf_loader); - } - return pixbuf; - } - - GdkPixbuf* load_icon_by_name(const OUString& rIconName) - { - OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); - OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); - return load_icon_by_name(rIconName, sIconTheme, sUILang); - } - - GdkPixbuf* load_icon_from_surface(VirtualDevice& rDevice) - { - Size aSize(rDevice.GetOutputSizePixel()); - cairo_surface_t* surface = get_underlying_cairo_surface(rDevice); - double m_fXScale, m_fYScale; - cairo_surface_get_device_scale(surface, &m_fXScale, &m_fYScale); - return gdk_pixbuf_get_from_surface(surface, 0, 0, aSize.Width() * m_fXScale, aSize.Height() * m_fYScale); - } -} - class GtkInstanceButton : public GtkInstanceContainer, public virtual weld::Button { private: |