[Libreoffice-commits] core.git: chart2/source chart2/uiconfig
Caolán McNamara
caolanm at redhat.com
Mon May 21 15:12:57 UTC 2018
chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx | 87 +++++----------
chart2/source/controller/inc/ChartController.hxx | 1
chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx | 25 +---
chart2/source/controller/main/ChartController.cxx | 9 +
chart2/source/controller/main/ChartController_Insert.cxx | 12 +-
chart2/uiconfig/ui/insertaxisdlg.ui | 8 +
chart2/uiconfig/ui/insertgriddlg.ui | 8 +
7 files changed, 74 insertions(+), 76 deletions(-)
New commits:
commit e4d95fa557179d787fd78211b76dd7c311940762
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 21 10:59:34 2018 +0100
weld SchAxisDlg
Change-Id: I18441b4fc06b69caf12dc73e5042ad2b609a7cc5
Reviewed-on: https://gerrit.libreoffice.org/54620
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
index 74f2ce9b8831..9a227f59b2f5 100644
--- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -40,74 +40,55 @@ InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
// SchAxisDlg
-SchAxisDlg::SchAxisDlg(vcl::Window* pWindow,
+SchAxisDlg::SchAxisDlg(weld::Window* pWindow,
const InsertAxisOrGridDialogData& rInput, bool bAxisDlg)
- : ModalDialog(pWindow,
- bAxisDlg ?
- OUString("InsertAxisDialog") :
- OUString("InsertGridDialog"),
+ : GenericDialogController(pWindow,
bAxisDlg ?
OUString("modules/schart/ui/insertaxisdlg.ui") :
- OUString("modules/schart/ui/insertgriddlg.ui"))
+ OUString("modules/schart/ui/insertgriddlg.ui"),
+ bAxisDlg ?
+ OString("InsertAxisDialog") :
+ OString("InsertGridDialog"))
+ , m_xCbPrimaryX(m_xBuilder->weld_check_button("primaryX"))
+ , m_xCbPrimaryY(m_xBuilder->weld_check_button("primaryY"))
+ , m_xCbPrimaryZ(m_xBuilder->weld_check_button("primaryZ"))
+ , m_xCbSecondaryX(m_xBuilder->weld_check_button("secondaryX"))
+ , m_xCbSecondaryY(m_xBuilder->weld_check_button("secondaryY"))
+ , m_xCbSecondaryZ(m_xBuilder->weld_check_button("secondaryZ"))
{
- get(m_pCbPrimaryX, "primaryX");
- get(m_pCbPrimaryY, "primaryY");
- get(m_pCbPrimaryZ, "primaryZ");
- get(m_pCbSecondaryX, "secondaryX");
- get(m_pCbSecondaryY, "secondaryY");
- get(m_pCbSecondaryZ, "secondaryZ");
-
if (bAxisDlg)
{
-
//todo: remove if secondary z axis are possible somewhere
- m_pCbSecondaryZ->Hide();
+ m_xCbSecondaryZ->hide();
}
- m_pCbPrimaryX->Check( rInput.aExistenceList[0] );
- m_pCbPrimaryY->Check( rInput.aExistenceList[1] );
- m_pCbPrimaryZ->Check( rInput.aExistenceList[2] );
- m_pCbSecondaryX->Check( rInput.aExistenceList[3] );
- m_pCbSecondaryY->Check( rInput.aExistenceList[4] );
- m_pCbSecondaryZ->Check( rInput.aExistenceList[5] );
-
- m_pCbPrimaryX->Enable( rInput.aPossibilityList[0] );
- m_pCbPrimaryY->Enable( rInput.aPossibilityList[1] );
- m_pCbPrimaryZ->Enable( rInput.aPossibilityList[2] );
- m_pCbSecondaryX->Enable( rInput.aPossibilityList[3] );
- m_pCbSecondaryY->Enable( rInput.aPossibilityList[4] );
- m_pCbSecondaryZ->Enable( rInput.aPossibilityList[5] );
-}
-
-SchAxisDlg::~SchAxisDlg()
-{
- disposeOnce();
-}
-
-void SchAxisDlg::dispose()
-{
- m_pCbPrimaryX.clear();
- m_pCbPrimaryY.clear();
- m_pCbPrimaryZ.clear();
- m_pCbSecondaryX.clear();
- m_pCbSecondaryY.clear();
- m_pCbSecondaryZ.clear();
- ModalDialog::dispose();
+ m_xCbPrimaryX->set_active( rInput.aExistenceList[0] );
+ m_xCbPrimaryY->set_active( rInput.aExistenceList[1] );
+ m_xCbPrimaryZ->set_active( rInput.aExistenceList[2] );
+ m_xCbSecondaryX->set_active( rInput.aExistenceList[3] );
+ m_xCbSecondaryY->set_active( rInput.aExistenceList[4] );
+ m_xCbSecondaryZ->set_active( rInput.aExistenceList[5] );
+
+ m_xCbPrimaryX->set_sensitive( rInput.aPossibilityList[0] );
+ m_xCbPrimaryY->set_sensitive( rInput.aPossibilityList[1] );
+ m_xCbPrimaryZ->set_sensitive( rInput.aPossibilityList[2] );
+ m_xCbSecondaryX->set_sensitive( rInput.aPossibilityList[3] );
+ m_xCbSecondaryY->set_sensitive( rInput.aPossibilityList[4] );
+ m_xCbSecondaryZ->set_sensitive( rInput.aPossibilityList[5] );
}
-
void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
{
- rOutput.aExistenceList[0]=m_pCbPrimaryX->IsChecked();
- rOutput.aExistenceList[1]=m_pCbPrimaryY->IsChecked();
- rOutput.aExistenceList[2]=m_pCbPrimaryZ->IsChecked();
- rOutput.aExistenceList[3]=m_pCbSecondaryX->IsChecked();
- rOutput.aExistenceList[4]=m_pCbSecondaryY->IsChecked();
- rOutput.aExistenceList[5]=m_pCbSecondaryZ->IsChecked();
+ rOutput.aExistenceList[0]=m_xCbPrimaryX->get_active();
+ rOutput.aExistenceList[1]=m_xCbPrimaryY->get_active();
+ rOutput.aExistenceList[2]=m_xCbPrimaryZ->get_active();
+ rOutput.aExistenceList[3]=m_xCbSecondaryX->get_active();
+ rOutput.aExistenceList[4]=m_xCbSecondaryY->get_active();
+ rOutput.aExistenceList[5]=m_xCbSecondaryZ->get_active();
}
-SchGridDlg::SchGridDlg( vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput )
- : SchAxisDlg( pParent, rInput, false )//rInAttrs, b3D, bNet, bSecondaryX, bSecondaryY, false )
+SchGridDlg::SchGridDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput)
+ : SchAxisDlg(pParent, rInput, false) //rInAttrs, b3D, bNet, bSecondaryX, bSecondaryY, false )
{
}
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 5a47a8838e55..941672c0cc6e 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -321,6 +321,7 @@ public:
DrawModelWrapper* GetDrawModelWrapper();
DrawViewWrapper* GetDrawViewWrapper();
VclPtr<ChartWindow> GetChartWindow();
+ weld::Window* GetChartFrame();
bool isAdditionalShapeSelected();
void SetAndApplySelection(const css::uno::Reference<css::drawing::XShape>& rxShape);
void StartTextEdit( const Point* pMousePixel = nullptr );
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
index fea533d7b22d..14e3c6669d51 100644
--- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -19,9 +19,7 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTAXIS_GRID_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTAXIS_GRID_HXX
-#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/uno/Sequence.hxx>
namespace chart
@@ -40,21 +38,18 @@ struct InsertAxisOrGridDialogData
|* insert Axis dialog (also base for grid dialog)
|*
\************************************************************************/
-class SchAxisDlg : public ModalDialog
+class SchAxisDlg : public weld::GenericDialogController
{
protected:
- VclPtr<CheckBox> m_pCbPrimaryX;
- VclPtr<CheckBox> m_pCbPrimaryY;
- VclPtr<CheckBox> m_pCbPrimaryZ;
- VclPtr<CheckBox> m_pCbSecondaryX;
- VclPtr<CheckBox> m_pCbSecondaryY;
- VclPtr<CheckBox> m_pCbSecondaryZ;
+ std::unique_ptr<weld::CheckButton> m_xCbPrimaryX;
+ std::unique_ptr<weld::CheckButton> m_xCbPrimaryY;
+ std::unique_ptr<weld::CheckButton> m_xCbPrimaryZ;
+ std::unique_ptr<weld::CheckButton> m_xCbSecondaryX;
+ std::unique_ptr<weld::CheckButton> m_xCbSecondaryY;
+ std::unique_ptr<weld::CheckButton> m_xCbSecondaryZ;
public:
- SchAxisDlg(vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg=true);
- virtual ~SchAxisDlg() override;
- virtual void dispose() override;
-
+ SchAxisDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg = true);
void getResult( InsertAxisOrGridDialogData& rOutput );
};
@@ -66,7 +61,7 @@ public:
class SchGridDlg : public SchAxisDlg
{
public:
- SchGridDlg( vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput );
+ SchGridDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput);
};
} //namespace chart
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index a57ddc676396..3fc25dd822a7 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1487,6 +1487,15 @@ VclPtr<ChartWindow> ChartController::GetChartWindow()
return dynamic_cast<ChartWindow*>(VCLUnoHelper::GetWindow(m_xViewWindow).get());
}
+weld::Window* ChartController::GetChartFrame()
+{
+ // clients getting the naked VCL Window from UNO should always have the
+ // solar mutex (and keep it over the lifetime of this ptr), as VCL might
+ // might deinit otherwise
+ DBG_TESTSOLARMUTEX();
+ return Application::GetFrameWeld(m_xViewWindow);
+}
+
bool ChartController::isAdditionalShapeSelected()
{
return m_aSelection.isAdditionalShapeSelected();
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 3589d0cc2d02..a1510a7db984 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -97,14 +97,14 @@ void ChartController::executeDispatch_InsertAxes()
AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram );
SolarMutexGuard aGuard;
- ScopedVclPtrInstance<SchAxisDlg> aDlg( GetChartWindow(), aDialogInput );
- if( aDlg->Execute() == RET_OK )
+ SchAxisDlg aDlg(GetChartFrame(), aDialogInput);
+ if (aDlg.run() == RET_OK)
{
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
InsertAxisOrGridDialogData aDialogOutput;
- aDlg->getResult( aDialogOutput );
+ aDlg.getResult(aDialogOutput);
std::unique_ptr< ReferenceSizeProvider > pRefSizeProvider(
impl_createReferenceSizeProvider());
bool bChanged = AxisHelper::changeVisibilityOfAxes( xDiagram
@@ -135,13 +135,13 @@ void ChartController::executeDispatch_InsertGrid()
AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, false );
SolarMutexGuard aGuard;
- ScopedVclPtrInstance<SchGridDlg> aDlg(GetChartWindow(), aDialogInput);//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
- if( aDlg->Execute() == RET_OK )
+ SchGridDlg aDlg(GetChartFrame(), aDialogInput);//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
+ if (aDlg.run() == RET_OK)
{
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
InsertAxisOrGridDialogData aDialogOutput;
- aDlg->getResult( aDialogOutput );
+ aDlg.getResult( aDialogOutput );
bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
, aDialogInput.aExistenceList, aDialogOutput.aExistenceList );
if( bChanged )
diff --git a/chart2/uiconfig/ui/insertaxisdlg.ui b/chart2/uiconfig/ui/insertaxisdlg.ui
index 99441951b724..c445cc8256f2 100644
--- a/chart2/uiconfig/ui/insertaxisdlg.ui
+++ b/chart2/uiconfig/ui/insertaxisdlg.ui
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="chart">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="InsertAxisDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="insertaxisdlg|InsertAxisDialog">Axes</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-vbox3">
<property name="can_focus">False</property>
diff --git a/chart2/uiconfig/ui/insertgriddlg.ui b/chart2/uiconfig/ui/insertgriddlg.ui
index 26b9ce55302e..ae3863a59ff5 100644
--- a/chart2/uiconfig/ui/insertgriddlg.ui
+++ b/chart2/uiconfig/ui/insertgriddlg.ui
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="chart">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="InsertGridDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="insertgriddlg|InsertGridDialog">Grids</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>
More information about the Libreoffice-commits
mailing list