Kaydet (Commit) 1c4a9964 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld InsertErrorBarsDialog and ErrorBarsTabPage

Change-Id: I3fb2fb4d8010e43e59b4de5c488f137960bc6417
Reviewed-on: https://gerrit.libreoffice.org/61760
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a58e2af6
...@@ -39,19 +39,17 @@ namespace chart ...@@ -39,19 +39,17 @@ namespace chart
{ {
InsertErrorBarsDialog::InsertErrorBarsDialog( InsertErrorBarsDialog::InsertErrorBarsDialog(
vcl::Window* pParent, const SfxItemSet& rMyAttrs, weld::Window* pParent, const SfxItemSet& rMyAttrs,
const uno::Reference< chart2::XChartDocument > & xChartDocument, const uno::Reference< chart2::XChartDocument > & xChartDocument,
ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) : ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ )
ModalDialog( pParent : GenericDialogController(pParent, "modules/schart/ui/dlg_InsertErrorBars.ui", "dlg_InsertErrorBars")
,"dlg_InsertErrorBars" , m_apErrorBarResources( new ErrorBarResources(
,"modules/schart/ui/dlg_InsertErrorBars.ui"), m_xBuilder.get(), TabPageParent(m_xDialog.get(), nullptr), rMyAttrs,
m_apErrorBarResources( new ErrorBarResources(
this, this, rMyAttrs,
/* bNoneAvailable = */ true, eType )) /* bNoneAvailable = */ true, eType ))
{ {
ObjectType objType = eType == ErrorBarResources::ERROR_BAR_Y ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X; ObjectType objType = eType == ErrorBarResources::ERROR_BAR_Y ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X;
SetText( ObjectNameProvider::getName_ObjectForAllSeries(objType) ); m_xDialog->set_title(ObjectNameProvider::getName_ObjectForAllSeries(objType));
m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument ); m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
} }
...@@ -61,14 +59,6 @@ void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs) ...@@ -61,14 +59,6 @@ void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
m_apErrorBarResources->FillItemSet(rOutAttrs); m_apErrorBarResources->FillItemSet(rOutAttrs);
} }
void InsertErrorBarsDialog::DataChanged( const DataChangedEvent& rDCEvt )
{
ModalDialog::DataChanged( rDCEvt );
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
m_apErrorBarResources->FillValueSets();
}
void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
{ {
m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth ); m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
......
...@@ -27,23 +27,15 @@ using namespace ::com::sun::star; ...@@ -27,23 +27,15 @@ using namespace ::com::sun::star;
namespace chart namespace chart
{ {
ErrorBarsTabPage::ErrorBarsTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : ErrorBarsTabPage::ErrorBarsTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs)
SfxTabPage( pParent : SfxTabPage(pParent, "modules/schart/ui/tp_ErrorBars.ui", "tp_ErrorBars", &rInAttrs)
,"tp_ErrorBars" , m_aErrorBarResources(m_xBuilder.get(), pParent, rInAttrs, /* bNoneAvailable = */ false)
,"modules/schart/ui/tp_ErrorBars.ui"
, &rInAttrs ),
m_aErrorBarResources(
this,
// the parent is the tab control, of which the parent is the dialog
pParent->GetParentDialog(),
rInAttrs, /* bNoneAvailable = */ false )
{ {
} }
VclPtr<SfxTabPage> ErrorBarsTabPage::Create( VclPtr<SfxTabPage> ErrorBarsTabPage::Create(TabPageParent pParent, const SfxItemSet* rOutAttrs)
TabPageParent pParent, const SfxItemSet* rOutAttrs )
{ {
return VclPtr<ErrorBarsTabPage>::Create( pParent.pParent, *rOutAttrs ); return VclPtr<ErrorBarsTabPage>::Create(pParent, *rOutAttrs);
} }
bool ErrorBarsTabPage::FillItemSet( SfxItemSet* rOutAttrs ) bool ErrorBarsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
......
...@@ -29,7 +29,7 @@ namespace chart ...@@ -29,7 +29,7 @@ namespace chart
class ErrorBarsTabPage : public SfxTabPage class ErrorBarsTabPage : public SfxTabPage
{ {
public: public:
ErrorBarsTabPage ( vcl::Window* pParent, const SfxItemSet& rInAttrs ); ErrorBarsTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType ); void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType );
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX
#include <memory> #include <memory>
#include <vcl/dialog.hxx> #include <vcl/weld.hxx>
#include <svl/itemset.hxx> #include <svl/itemset.hxx>
#include "res_ErrorBar.hxx" #include "res_ErrorBar.hxx"
...@@ -30,12 +30,12 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel; ...@@ -30,12 +30,12 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel;
namespace chart namespace chart
{ {
class InsertErrorBarsDialog : public ModalDialog class InsertErrorBarsDialog : public weld::GenericDialogController
{ {
public: public:
InsertErrorBarsDialog( vcl::Window* pParent, const SfxItemSet& rMyAttrs, InsertErrorBarsDialog(weld::Window* pParent, const SfxItemSet& rMyAttrs,
const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
ErrorBarResources::tErrorBarType eType ); ErrorBarResources::tErrorBarType eType);
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
...@@ -45,7 +45,6 @@ public: ...@@ -45,7 +45,6 @@ public:
const OUString& rSelectedObjectCID ); const OUString& rSelectedObjectCID );
void FillItemSet( SfxItemSet& rOutAttrs ); void FillItemSet( SfxItemSet& rOutAttrs );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
private: private:
std::unique_ptr< ErrorBarResources > m_apErrorBarResources; std::unique_ptr< ErrorBarResources > m_apErrorBarResources;
......
...@@ -20,11 +20,8 @@ ...@@ -20,11 +20,8 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX
#include <memory> #include <memory>
#include <vcl/button.hxx> #include <vcl/weld.hxx>
#include <vcl/fixed.hxx> #include <sfx2/tabdlg.hxx>
#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/layout.hxx>
#include <svl/itemset.hxx> #include <svl/itemset.hxx>
#include <svx/chrtitem.hxx> #include <svx/chrtitem.hxx>
#include "RangeSelectionListener.hxx" #include "RangeSelectionListener.hxx"
...@@ -46,7 +43,7 @@ public: ...@@ -46,7 +43,7 @@ public:
}; };
ErrorBarResources( ErrorBarResources(
VclBuilderContainer* pParent, Dialog* pParentDialog, const SfxItemSet& rInAttrs, bool bNoneAvailable, chart::ErrorBarResources::tErrorBarType eType = ERROR_BAR_Y ); weld::Builder* pParent, TabPageParent pParentDialog, const SfxItemSet& rInAttrs, bool bNoneAvailable, chart::ErrorBarResources::tErrorBarType eType = ERROR_BAR_Y );
virtual ~ErrorBarResources(); virtual ~ErrorBarResources();
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
...@@ -63,38 +60,6 @@ public: ...@@ -63,38 +60,6 @@ public:
virtual void disposingRangeSelection() override; virtual void disposingRangeSelection() override;
private: private:
// category
VclPtr<RadioButton> m_pRbNone;
VclPtr<RadioButton> m_pRbConst;
VclPtr<RadioButton> m_pRbPercent;
VclPtr<RadioButton> m_pRbFunction;
VclPtr<RadioButton> m_pRbRange;
VclPtr<ListBox> m_pLbFunction;
// parameters
VclPtr<VclFrame> m_pFlParameters;
VclPtr<VclBox> m_pBxPositive;
VclPtr<MetricField> m_pMfPositive;
VclPtr<Edit> m_pEdRangePositive;
VclPtr<PushButton> m_pIbRangePositive;
VclPtr<VclBox> m_pBxNegative;
VclPtr<MetricField> m_pMfNegative;
VclPtr<Edit> m_pEdRangeNegative;
VclPtr<PushButton> m_pIbRangeNegative;
VclPtr<CheckBox> m_pCbSyncPosNeg;
// indicator
VclPtr<RadioButton> m_pRbBoth;
VclPtr<RadioButton> m_pRbPositive;
VclPtr<RadioButton> m_pRbNegative;
VclPtr<FixedImage> m_pFiBoth;
VclPtr<FixedImage> m_pFiPositive;
VclPtr<FixedImage> m_pFiNegative;
VclPtr<FixedText> m_pUIStringPos;
VclPtr<FixedText> m_pUIStringNeg;
VclPtr<FixedText> m_pUIStringRbRange;
SvxChartKindError m_eErrorKind; SvxChartKindError m_eErrorKind;
SvxChartIndicate m_eIndicate; SvxChartIndicate m_eIndicate;
...@@ -109,22 +74,55 @@ private: ...@@ -109,22 +74,55 @@ private:
double m_fPlusValue; double m_fPlusValue;
double m_fMinusValue; double m_fMinusValue;
VclPtr<Dialog> m_pParentDialog; TabPageParent m_pParentDialog;
std::unique_ptr< RangeSelectionHelper > m_apRangeSelectionHelper; std::unique_ptr< RangeSelectionHelper > m_apRangeSelectionHelper;
VclPtr<Edit> m_pCurrentRangeChoosingField; weld::Entry* m_pCurrentRangeChoosingField;
bool m_bHasInternalDataProvider; bool m_bHasInternalDataProvider;
bool m_bEnableDataTableDialog; bool m_bEnableDataTableDialog;
DECL_LINK( CategoryChosen, Button*, void );
DECL_LINK( CategoryChosen2, ListBox&, void ); // category
DECL_LINK( SynchronizePosAndNeg, CheckBox&, void ); std::unique_ptr<weld::RadioButton> m_xRbNone;
DECL_LINK( PosValueChanged, Edit&, void ); std::unique_ptr<weld::RadioButton> m_xRbConst;
DECL_LINK( IndicatorChanged, Button *, void ); std::unique_ptr<weld::RadioButton> m_xRbPercent;
DECL_LINK( ChooseRange, Button *, void ); std::unique_ptr<weld::RadioButton> m_xRbFunction;
DECL_LINK( RangeChanged, Edit&, void ); std::unique_ptr<weld::RadioButton> m_xRbRange;
std::unique_ptr<weld::ComboBox> m_xLbFunction;
// parameters
std::unique_ptr<weld::Frame> m_xFlParameters;
std::unique_ptr<weld::Widget> m_xBxPositive;
std::unique_ptr<weld::MetricSpinButton> m_xMfPositive;
std::unique_ptr<weld::Entry> m_xEdRangePositive;
std::unique_ptr<weld::Button> m_xIbRangePositive;
std::unique_ptr<weld::Widget> m_xBxNegative;
std::unique_ptr<weld::MetricSpinButton> m_xMfNegative;
std::unique_ptr<weld::Entry> m_xEdRangeNegative;
std::unique_ptr<weld::Button> m_xIbRangeNegative;
std::unique_ptr<weld::CheckButton> m_xCbSyncPosNeg;
// indicator
std::unique_ptr<weld::RadioButton> m_xRbBoth;
std::unique_ptr<weld::RadioButton> m_xRbPositive;
std::unique_ptr<weld::RadioButton> m_xRbNegative;
std::unique_ptr<weld::Image> m_xFiBoth;
std::unique_ptr<weld::Image> m_xFiPositive;
std::unique_ptr<weld::Image> m_xFiNegative;
std::unique_ptr<weld::Label> m_xUIStringPos;
std::unique_ptr<weld::Label> m_xUIStringNeg;
std::unique_ptr<weld::Label> m_xUIStringRbRange;
DECL_LINK( CategoryChosen, weld::ToggleButton&, void );
DECL_LINK( CategoryChosen2, weld::ComboBox&, void );
DECL_LINK( SynchronizePosAndNeg, weld::ToggleButton&, void );
DECL_LINK( PosValueChanged, weld::MetricSpinButton&, void );
DECL_LINK( IndicatorChanged, weld::ToggleButton&, void );
DECL_LINK( ChooseRange, weld::Button&, void );
DECL_LINK( RangeChanged, weld::Entry&, void );
void UpdateControlStates(); void UpdateControlStates();
void isRangeFieldContentValid( Edit & rEdit ); void isRangeFieldContentValid(weld::Entry& rEdit);
}; };
} //namespace chart } //namespace chart
......
...@@ -488,18 +488,18 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError ) ...@@ -488,18 +488,18 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
//prepare and open dialog //prepare and open dialog
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
ScopedVclPtrInstance<InsertErrorBarsDialog> aDlg( InsertErrorBarsDialog aDlg(
GetChartWindow(), aItemSet, GetChartFrame(), aItemSet,
uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ), uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ),
bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X); bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X);
aDlg->SetAxisMinorStepWidthForErrorBarDecimals( aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) ); InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) );
if( aDlg->Execute() == RET_OK ) if (aDlg.run() == RET_OK)
{ {
SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet(); SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
aDlg->FillItemSet( aOutItemSet ); aDlg.FillItemSet( aOutItemSet );
// lock controllers till end of block // lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() ); ControllerLockGuardUNO aCLGuard( getModel() );
......
...@@ -194,6 +194,7 @@ public: ...@@ -194,6 +194,7 @@ public:
virtual OUString get_title() const = 0; virtual OUString get_title() const = 0;
virtual void set_busy_cursor(bool bBusy) = 0; virtual void set_busy_cursor(bool bBusy) = 0;
virtual void window_move(int x, int y) = 0; virtual void window_move(int x, int y) = 0;
virtual void set_modal(bool bModal) = 0;
virtual bool get_extents_relative_to(Window& rRelative, int& x, int& y, int& width, int& height) virtual bool get_extents_relative_to(Window& rRelative, int& x, int& y, int& width, int& height)
= 0; = 0;
......
...@@ -727,6 +727,16 @@ public: ...@@ -727,6 +727,16 @@ public:
assert(false && "must be system or docking window"); assert(false && "must be system or docking window");
} }
virtual void set_modal(bool bModal) override
{
if (::Dialog* pDialog = dynamic_cast<::Dialog*>(m_xWindow.get()))
{
pDialog->SetModalInputMode(bModal);
return;
}
m_xWindow->ImplGetFrame()->SetModal(bModal);
}
virtual void window_move(int x, int y) override virtual void window_move(int x, int y) override
{ {
m_xWindow->SetPosPixel(Point(x, y)); m_xWindow->SetPosPixel(Point(x, y));
......
...@@ -2052,6 +2052,11 @@ public: ...@@ -2052,6 +2052,11 @@ public:
g_object_unref(pCursor); g_object_unref(pCursor);
} }
virtual void set_modal(bool bModal) override
{
gtk_window_set_modal(m_pWindow, bModal);
}
virtual void resize_to_request() override virtual void resize_to_request() override
{ {
gtk_window_resize(m_pWindow, 1, 1); gtk_window_resize(m_pWindow, 1, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment