diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-10 14:51:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-11 09:56:57 +0200 |
commit | 1520d56ea3cd5075c71b8ec492e3d4c23b9593f5 (patch) | |
tree | ebc9c23478614e399d0813ea2c5b320897afa615 /cui | |
parent | bc65992929392d597070237471aa4d5a7eec674d (diff) |
weld SvxBitmapPickTabPage
Change-Id: I4c5fd94356f3640b150ef9fec48a166457f3b70b
Reviewed-on: https://gerrit.libreoffice.org/60266
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/numpages.hxx | 25 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 76 | ||||
-rw-r--r-- | cui/uiconfig/ui/pickgraphicpage.ui | 40 |
3 files changed, 80 insertions, 61 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index 920ffbf6b3c1..e0d9a1909f30 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -196,16 +196,11 @@ public: virtual void PageCreated(const SfxAllItemSet& aSet) override; }; - class SvxBitmapPickTabPage final : public SfxTabPage { using TabPage::ActivatePage; using TabPage::DeactivatePage; - VclPtr<FixedText> m_pErrorText; - VclPtr<SvxBmpNumValueSet> m_pExamplesVS; - VclPtr<Button> m_pBtBrowseFile; - std::vector<OUString> aGrfNames; std::unique_ptr<SvxNumRule> pActNum; @@ -216,19 +211,22 @@ class SvxBitmapPickTabPage final : public SfxTabPage bool bModified : 1; bool bPreset : 1; - DECL_LINK(NumSelectHdl_Impl, ValueSet*, void); - DECL_LINK(DoubleClickHdl_Impl, ValueSet*, void); - DECL_LINK(ClickAddBrowseHdl_Impl, Button*, void ); + std::unique_ptr<weld::Label> m_xErrorText; + std::unique_ptr<weld::Button> m_xBtBrowseFile; + std::unique_ptr<SvxBmpNumValueSet> m_xExamplesVS; + std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin; + DECL_LINK(NumSelectHdl_Impl, SvtValueSet*, void); + DECL_LINK(DoubleClickHdl_Impl, SvtValueSet*, void); + DECL_LINK(ClickAddBrowseHdl_Impl, weld::Button&, void); public: - SvxBitmapPickTabPage(vcl::Window* pParent, - const SfxItemSet& rSet); - virtual ~SvxBitmapPickTabPage() override; + SvxBitmapPickTabPage(TabPageParent pParent, const SfxItemSet& rSet); + virtual ~SvxBitmapPickTabPage() override; virtual void dispose() override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(TabPageParent pParent, + const SfxItemSet* rAttrSet); virtual void ActivatePage(const SfxItemSet& rSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; @@ -236,7 +234,6 @@ public: virtual void Reset( const SfxItemSet* rSet ) override; }; - class SvxNumOptionsTabPage : public SfxTabPage { using TabPage::ActivatePage; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 58cdf26ee997..a505c954c306 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -176,7 +176,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(TabPageParent pParent, const Sf , bModified(false) , bPreset(false) , nNumItemId(SID_ATTR_NUMBERING_RULE) - , m_xExamplesVS(new NumValueSet) + , m_xExamplesVS(new NumValueSet(nullptr)) , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); @@ -361,7 +361,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(TabPageParent pParent, const SfxItemS , bModified(false) , bPreset(false) , nNumItemId(SID_ATTR_NUMBERING_RULE) - , m_xExamplesVS(new NumValueSet) + , m_xExamplesVS(new NumValueSet(nullptr)) , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); @@ -516,7 +516,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(TabPageParent pParent, const SfxItemSet& rS , nNumItemId(SID_ATTR_NUMBERING_RULE) , bModified(false) , bPreset(false) - , m_xExamplesVS(new NumValueSet) + , m_xExamplesVS(new NumValueSet(nullptr)) , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); @@ -755,22 +755,23 @@ void SvxNumPickTabPage::PageCreated(const SfxAllItemSet& aSet) SetCharFormatNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); } -SvxBitmapPickTabPage::SvxBitmapPickTabPage(vcl::Window* pParent, - const SfxItemSet& rSet) - : SfxTabPage(pParent, "PickGraphicPage", "cui/ui/pickgraphicpage.ui", &rSet) +SvxBitmapPickTabPage::SvxBitmapPickTabPage(TabPageParent pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "cui/ui/pickgraphicpage.ui", "PickGraphicPage", &rSet) , nActNumLvl(SAL_MAX_UINT16) , nNumItemId(SID_ATTR_NUMBERING_RULE) , bModified(false) , bPreset(false) + , m_xErrorText(m_xBuilder->weld_label("errorft")) + , m_xBtBrowseFile(m_xBuilder->weld_button("browseBtn")) + , m_xExamplesVS(new SvxBmpNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin"))) + , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS)) { SetExchangeSupport(); - get(m_pErrorText, "errorft"); - get(m_pExamplesVS, "valueset"); - get(m_pBtBrowseFile, "browseBtn"); - m_pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl)); - m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl)); - m_pBtBrowseFile->SetClickHdl(LINK(this, SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl)); + m_xExamplesVS->init(); + m_xExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl)); + m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl)); + m_xBtBrowseFile->connect_clicked(LINK(this, SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl)); eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); @@ -780,25 +781,25 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(vcl::Window* pParent, size_t i = 0; for (auto & grfName : aGrfNames) { - m_pExamplesVS->InsertItem( i + 1, i); + m_xExamplesVS->InsertItem( i + 1, i); INetURLObject aObj(grfName); if(aObj.GetProtocol() == INetProtocol::File) grfName = aObj.PathToFileName(); - m_pExamplesVS->SetItemText( i + 1, grfName ); + m_xExamplesVS->SetItemText( i + 1, grfName ); ++i; } if(aGrfNames.empty()) { - m_pErrorText->Show(); + m_xErrorText->show(); } else { - m_pExamplesVS->Show(); - m_pExamplesVS->SetFormat(); - m_pExamplesVS->Invalidate(); + m_xExamplesVS->Show(); + m_xExamplesVS->SetFormat(); + m_xExamplesVS->Invalidate(); } } @@ -809,18 +810,15 @@ SvxBitmapPickTabPage::~SvxBitmapPickTabPage() void SvxBitmapPickTabPage::dispose() { - pActNum.reset(); - pSaveNum.reset(); - m_pBtBrowseFile.clear(); - m_pErrorText.clear(); - m_pExamplesVS.clear(); + m_xExamplesVSWin.reset(); + m_xExamplesVS.reset(); SfxTabPage::dispose(); } -VclPtr<SfxTabPage> SvxBitmapPickTabPage::Create( TabPageParent pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SvxBitmapPickTabPage::Create(TabPageParent pParent, + const SfxItemSet* rAttrSet) { - return VclPtr<SvxBitmapPickTabPage>::Create(pParent.pParent, *rAttrSet); + return VclPtr<SvxBitmapPickTabPage>::Create(pParent, *rAttrSet); } void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) @@ -843,14 +841,14 @@ void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) if(pActNum && *pSaveNum != *pActNum) { *pActNum = *pSaveNum; - m_pExamplesVS->SetNoSelection(); + m_xExamplesVS->SetNoSelection(); } if(!aGrfNames.empty() && (pActNum && (lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset))) { - m_pExamplesVS->SelectItem(1); - NumSelectHdl_Impl(m_pExamplesVS); + m_xExamplesVS->SelectItem(1); + NumSelectHdl_Impl(m_xExamplesVS.get()); bPreset = true; } bPreset |= bIsPreset; @@ -906,13 +904,13 @@ void SvxBitmapPickTabPage::Reset( const SfxItemSet* rSet ) *pActNum = *pSaveNum; } -IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, void) +IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, SvtValueSet*, void) { if(pActNum) { bPreset = false; bModified = true; - sal_uInt16 nIdx = m_pExamplesVS->GetSelectedItemId() - 1; + sal_uInt16 nIdx = m_xExamplesVS->GetSelectedItemId() - 1; sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) @@ -943,14 +941,14 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, void) } } -IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, void) +IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl, SvtValueSet*, void) { - NumSelectHdl_Impl(m_pExamplesVS); + NumSelectHdl_Impl(m_xExamplesVS.get()); PushButton& rOk = GetTabDialog()->GetOKButton(); rOk.GetClickHdl().Call(&rOk); } -IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, void) { sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, GetFrameWeld()); aFileDialog.SetTitle(CuiResId(RID_SVXSTR_ADD_IMAGE)); @@ -1023,22 +1021,22 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, Button*, void) size_t i = 0; for (auto & grfName : aGrfNames) { - m_pExamplesVS->InsertItem( i + 1, i); + m_xExamplesVS->InsertItem( i + 1, i); INetURLObject aObj(grfName); if(aObj.GetProtocol() == INetProtocol::File) grfName = aObj.PathToFileName(); - m_pExamplesVS->SetItemText( i + 1, grfName ); + m_xExamplesVS->SetItemText( i + 1, grfName ); ++i; } if(aGrfNames.empty()) { - m_pErrorText->Show(); + m_xErrorText->show(); } else { - m_pExamplesVS->Show(); - m_pExamplesVS->SetFormat(); + m_xExamplesVS->Show(); + m_xExamplesVS->SetFormat(); } } diff --git a/cui/uiconfig/ui/pickgraphicpage.ui b/cui/uiconfig/ui/pickgraphicpage.ui index 8f11c574c316..8aa3af45c1b0 100644 --- a/cui/uiconfig/ui/pickgraphicpage.ui +++ b/cui/uiconfig/ui/pickgraphicpage.ui @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkFrame" id="PickGraphicPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -25,17 +26,32 @@ <property name="vexpand">True</property> <property name="row_spacing">6</property> <child> - <object class="svxlo-SvxBmpNumValueSet" id="valueset"> + <object class="GtkScrolledWindow" id="valuesetwin"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="valueset"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + </child> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -48,15 +64,14 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkButton" id="browseBtn"> <property name="label" translatable="yes" context="pickgraphicpage|browseBtn">Add and Resize</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="halign">end</property> </object> <packing> @@ -64,6 +79,15 @@ <property name="top_attach">2</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> </object> |