Skip to content

Commit

Permalink
weld SdInsertPasteDlg
Browse files Browse the repository at this point in the history
Change-Id: I999e7ff88afd7dd82b368ede83d004e309e7dd3e
Reviewed-on: https://gerrit.libreoffice.org/54102
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
  • Loading branch information
Caolán McNamara committed May 11, 2018
1 parent 6c6982e commit 36a6882
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
21 changes: 6 additions & 15 deletions sd/source/ui/dlg/ins_paste.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,21 @@

#include <ins_paste.hxx>

SdInsertPasteDlg::SdInsertPasteDlg(vcl::Window* pWindow)
: ModalDialog( pWindow, "InsertSlidesDialog",
"modules/simpress/ui/insertslides.ui")
SdInsertPasteDlg::SdInsertPasteDlg(weld::Window* pWindow)
: GenericDialogController(pWindow, "modules/simpress/ui/insertslides.ui", "InsertSlidesDialog")
, m_xRbBefore(m_xBuilder->weld_radio_button("before"))
, m_xRbAfter(m_xBuilder->weld_radio_button("after"))
{
get(m_pRbBefore, "before");
get(m_pRbAfter, "after");
m_pRbAfter->Check();
m_xRbAfter->set_active(true);
}

SdInsertPasteDlg::~SdInsertPasteDlg()
{
disposeOnce();
}

void SdInsertPasteDlg::dispose()
{
m_pRbBefore.clear();
m_pRbAfter.clear();
ModalDialog::dispose();
}

bool SdInsertPasteDlg::IsInsertBefore() const
{
return m_pRbBefore->IsChecked();
return m_xRbBefore->get_active();
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
13 changes: 5 additions & 8 deletions sd/source/ui/inc/ins_paste.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@

#include <sddllapi.h>

#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/dialog.hxx>
#include <vcl/weld.hxx>

// SdInsertPasteDlg
class SD_DLLPUBLIC SdInsertPasteDlg : public ModalDialog
class SD_DLLPUBLIC SdInsertPasteDlg : public weld::GenericDialogController
{
private:
VclPtr<RadioButton> m_pRbBefore;
VclPtr<RadioButton> m_pRbAfter;
std::unique_ptr<weld::RadioButton> m_xRbBefore;
std::unique_ptr<weld::RadioButton> m_xRbAfter;

public:
SdInsertPasteDlg( vcl::Window* pWindow );
SdInsertPasteDlg(weld::Window* pWindow);
virtual ~SdInsertPasteDlg() override;
virtual void dispose() override;
bool IsInsertBefore() const;
};

Expand Down
7 changes: 4 additions & 3 deletions sd/source/ui/slidesorter/controller/SlsClipboard.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,12 @@ sal_Int32 Clipboard::GetInsertionPosition ()
else if (mrController.GetFocusManager().IsFocusShowing())
{
// Use the focus to determine the insertion position.
ScopedVclPtrInstance< SdInsertPasteDlg > aDialog(nullptr);
if (aDialog->Execute() == RET_OK)
vcl::Window* pWin = mrSlideSorter.GetContentWindow();
SdInsertPasteDlg aDialog(pWin ? pWin->GetFrameWeld() : nullptr);
if (aDialog.run() == RET_OK)
{
nInsertPosition = mrController.GetFocusManager().GetFocusedPageIndex();
if ( ! aDialog->IsInsertBefore())
if (!aDialog.IsInsertBefore())
nInsertPosition ++;
}
}
Expand Down
16 changes: 11 additions & 5 deletions sd/uiconfig/simpress/ui/insertslides.ui
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="sd">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="InsertSlidesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="insertslides|InsertSlidesDialog">Insert Slides</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">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
Expand Down Expand Up @@ -59,6 +62,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
Expand Down Expand Up @@ -98,7 +102,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">after</property>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -132,10 +135,10 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0.55000001192092896</property>
<property name="xpad">1</property>
<property name="label" translatable="yes" context="insertslides|label1">Position</property>
<property name="justify">center</property>
<property name="yalign">0.55000001192092896</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
Expand All @@ -155,5 +158,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>

0 comments on commit 36a6882

Please sign in to comment.