weld ScMergeCellsDialog

Change-Id: I513f7e9b0c969706646821af508e41bb2331bbc2
Reviewed-on: https://gerrit.libreoffice.org/53809
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-05-04 09:54:00 +02:00
parent c1293a13b0
commit 736cebb414
4 changed files with 34 additions and 43 deletions
+6 -9
View File
@@ -11,9 +11,7 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_MERGECELLSDIALOG_HXX
#define INCLUDED_SC_SOURCE_UI_INC_MERGECELLSDIALOG_HXX
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/weld.hxx>
enum ScMergeCellsOption
{
@@ -22,16 +20,15 @@ enum ScMergeCellsOption
EmptyContentHiddenCells
};
class ScMergeCellsDialog : public ModalDialog
class ScMergeCellsDialog : public weld::GenericDialogController
{
VclPtr<RadioButton> mpRBMoveContent;
VclPtr<RadioButton> mpRBKeepContent;
VclPtr<RadioButton> mpRBEmptyContent;
std::unique_ptr<weld::RadioButton> m_xRBMoveContent;
std::unique_ptr<weld::RadioButton> m_xRBKeepContent;
std::unique_ptr<weld::RadioButton> m_xRBEmptyContent;
public:
ScMergeCellsDialog( vcl::Window * pParent );
ScMergeCellsDialog(weld::Window* pParent);
virtual ~ScMergeCellsDialog() override;
virtual void dispose() override;
ScMergeCellsOption GetMergeCellsOption();
};
+9 -21
View File
@@ -10,41 +10,29 @@
#include <mergecellsdialog.hxx>
ScMergeCellsDialog::ScMergeCellsDialog( vcl::Window * pParent )
: ModalDialog( pParent, "MergeCellsDialog",
"modules/scalc/ui/mergecellsdialog.ui" )
ScMergeCellsDialog::ScMergeCellsDialog(weld::Window * pParent)
: GenericDialogController(pParent, "modules/scalc/ui/mergecellsdialog.ui", "MergeCellsDialog")
, m_xRBMoveContent(m_xBuilder->weld_radio_button("move-cells-radio"))
, m_xRBKeepContent(m_xBuilder->weld_radio_button("keep-content-radio"))
, m_xRBEmptyContent(m_xBuilder->weld_radio_button("empty-cells-radio"))
{
get(mpRBMoveContent, "move-cells-radio");
get(mpRBKeepContent, "keep-content-radio");
get(mpRBEmptyContent, "empty-cells-radio");
mpRBKeepContent->Check();
m_xRBKeepContent->set_active(true);
}
ScMergeCellsDialog::~ScMergeCellsDialog()
{
disposeOnce();
}
void ScMergeCellsDialog::dispose()
{
mpRBMoveContent.disposeAndClear();
mpRBKeepContent.disposeAndClear();
mpRBEmptyContent.disposeAndClear();
ModalDialog::dispose();
}
ScMergeCellsOption ScMergeCellsDialog::GetMergeCellsOption()
{
if ( mpRBMoveContent->IsChecked() )
if ( m_xRBMoveContent->get_active() )
return MoveContentHiddenCells;
if ( mpRBKeepContent->IsChecked() )
if ( m_xRBKeepContent->get_active() )
return KeepContentHiddenCells;
if ( mpRBEmptyContent->IsChecked() )
if ( m_xRBEmptyContent->get_active() )
return EmptyContentHiddenCells;
assert(!"Unknown selection for merge cells.");
return KeepContentHiddenCells; // default value
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+4 -3
View File
@@ -1148,12 +1148,13 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter )
bool bShowDialog = officecfg::Office::Calc::Compatibility::MergeCells::ShowDialog::get();
if (!bApi && bShowDialog)
{
ScopedVclPtr<ScMergeCellsDialog> aBox( VclPtr<ScMergeCellsDialog>::Create( GetViewData().GetDialogParent() ) );
sal_uInt16 nRetVal = aBox->Execute();
vcl::Window* pWin = GetViewData().GetDialogParent();
ScMergeCellsDialog aBox(pWin ? pWin->GetFrameWeld() : nullptr);
sal_uInt16 nRetVal = aBox.run();
if ( nRetVal == RET_OK )
{
switch ( aBox->GetMergeCellsOption() )
switch (aBox.GetMergeCellsOption())
{
case MoveContentHiddenCells:
rDoContents = true;
+15 -10
View File
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="MergeCellsDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="mergecellsdialog|MergeCellsDialog">Merge Cells</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>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -105,7 +105,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
@@ -122,7 +121,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="position">2</property>
</packing>
</child>
<child>
@@ -139,7 +137,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@@ -150,7 +147,7 @@
<property name="margin_left">24</property>
<property name="margin_bottom">6</property>
<property name="hexpand">False</property>
<property name="pixbuf">vcl/res/MergeFirstCell.svg</property>
<property name="icon_name">vcl/res/MergeFirstCell.svg</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -165,7 +162,7 @@
<property name="margin_left">24</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="pixbuf">vcl/res/MergeKeepHidden.svg</property>
<property name="icon_name">vcl/res/MergeKeepHidden.svg</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -179,7 +176,7 @@
<property name="halign">start</property>
<property name="margin_left">24</property>
<property name="hexpand">True</property>
<property name="pixbuf">vcl/res/MergeEmptyHidden.svg</property>
<property name="icon_name">vcl/res/MergeEmptyHidden.svg</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -195,5 +192,13 @@
</child>
</object>
</child>
<action-widgets>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>