summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-10 14:51:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-11 09:56:57 +0200
commit1520d56ea3cd5075c71b8ec492e3d4c23b9593f5 (patch)
treeebc9c23478614e399d0813ea2c5b320897afa615
parentbc65992929392d597070237471aa4d5a7eec674d (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>
-rw-r--r--cui/source/inc/numpages.hxx25
-rw-r--r--cui/source/tabpages/numpages.cxx76
-rw-r--r--cui/uiconfig/ui/pickgraphicpage.ui40
-rw-r--r--include/svx/numvset.hxx10
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx21
5 files changed, 90 insertions, 82 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>
diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx
index e01e9aa171a1..cab7968c895a 100644
--- a/include/svx/numvset.hxx
+++ b/include/svx/numvset.hxx
@@ -106,7 +106,7 @@ class SVX_DLLPUBLIC NumValueSet : public SvtValueSet
css::container::XIndexAccess> > aOutlineSettings;
public:
- NumValueSet();
+ NumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
void init(NumberingPageType eType);
virtual ~NumValueSet() override;
@@ -126,19 +126,17 @@ public:
};
-class SVX_DLLPUBLIC SvxBmpNumValueSet final : public SvxNumValueSet
+class SVX_DLLPUBLIC SvxBmpNumValueSet final : public NumValueSet
{
Idle aFormatIdle;
bool bGrfNotFound;
- void init();
-
DECL_LINK(FormatHdl_Impl, Timer *, void);
public:
- SvxBmpNumValueSet(vcl::Window* pParent, WinBits nWinBits);
+ SvxBmpNumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
+ void init();
virtual ~SvxBmpNumValueSet() override;
- virtual void dispose() override;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
};
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index aae13f758f9c..66ea1f6732bd 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -750,8 +750,8 @@ void NumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
pDev->SetLineColor(aOldColor);
}
-NumValueSet::NumValueSet()
- : SvtValueSet(nullptr)
+NumValueSet::NumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
+ : SvtValueSet(std::move(pScrolledWindow))
, ePageType(NumberingPageType::BULLET)
, pVDev(nullptr)
{
@@ -815,18 +815,15 @@ void NumValueSet::SetOutlineNumberingSettings(
}
}
-SvxBmpNumValueSet::SvxBmpNumValueSet(vcl::Window* pParent, WinBits nWinBits)
- : SvxNumValueSet(pParent, nWinBits)
+SvxBmpNumValueSet::SvxBmpNumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
+ : NumValueSet(std::move(pScrolledWindow))
, aFormatIdle("SvxBmpNumValueSet FormatIdle")
{
- init();
}
-VCL_BUILDER_FACTORY_ARGS(SvxBmpNumValueSet, WB_TABSTOP)
-
void SvxBmpNumValueSet::init()
{
- SvxNumValueSet::init(NumberingPageType::BITMAP);
+ NumValueSet::init(NumberingPageType::BITMAP);
bGrfNotFound = false;
GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
SetStyle( GetStyle() | WB_VSCROLL );
@@ -838,19 +835,13 @@ void SvxBmpNumValueSet::init()
SvxBmpNumValueSet::~SvxBmpNumValueSet()
{
- disposeOnce();
-}
-
-void SvxBmpNumValueSet::dispose()
-{
GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
aFormatIdle.Stop();
- SvxNumValueSet::dispose();
}
void SvxBmpNumValueSet::UserDraw(const UserDrawEvent& rUDEvt)
{
- SvxNumValueSet::UserDraw(rUDEvt);
+ NumValueSet::UserDraw(rUDEvt);
tools::Rectangle aRect = rUDEvt.GetRect();
vcl::RenderContext* pDev = rUDEvt.GetRenderContext();