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
{
InsertErrorBarsDialog::InsertErrorBarsDialog(
vcl::Window* pParent, const SfxItemSet& rMyAttrs,
weld::Window* pParent, const SfxItemSet& rMyAttrs,
const uno::Reference< chart2::XChartDocument > & xChartDocument,
ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) :
ModalDialog( pParent
,"dlg_InsertErrorBars"
,"modules/schart/ui/dlg_InsertErrorBars.ui"),
m_apErrorBarResources( new ErrorBarResources(
this, this, rMyAttrs,
ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ )
: GenericDialogController(pParent, "modules/schart/ui/dlg_InsertErrorBars.ui", "dlg_InsertErrorBars")
, m_apErrorBarResources( new ErrorBarResources(
m_xBuilder.get(), TabPageParent(m_xDialog.get(), nullptr), rMyAttrs,
/* bNoneAvailable = */ true, eType ))
{
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 );
}
......@@ -61,14 +59,6 @@ void InsertErrorBarsDialog::FillItemSet(SfxItemSet& 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 )
{
m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
......
......@@ -27,23 +27,15 @@ using namespace ::com::sun::star;
namespace chart
{
ErrorBarsTabPage::ErrorBarsTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) :
SfxTabPage( pParent
,"tp_ErrorBars"
,"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 )
ErrorBarsTabPage::ErrorBarsTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs)
: SfxTabPage(pParent, "modules/schart/ui/tp_ErrorBars.ui", "tp_ErrorBars", &rInAttrs)
, m_aErrorBarResources(m_xBuilder.get(), pParent, rInAttrs, /* bNoneAvailable = */ false)
{
}
VclPtr<SfxTabPage> ErrorBarsTabPage::Create(
TabPageParent pParent, const SfxItemSet* rOutAttrs )
VclPtr<SfxTabPage> ErrorBarsTabPage::Create(TabPageParent pParent, const SfxItemSet* rOutAttrs)
{
return VclPtr<ErrorBarsTabPage>::Create( pParent.pParent, *rOutAttrs );
return VclPtr<ErrorBarsTabPage>::Create(pParent, *rOutAttrs);
}
bool ErrorBarsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
......
......@@ -29,7 +29,7 @@ namespace chart
class ErrorBarsTabPage : public SfxTabPage
{
public:
ErrorBarsTabPage ( vcl::Window* pParent, const SfxItemSet& rInAttrs );
ErrorBarsTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType );
......
......@@ -20,7 +20,7 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX
#include <memory>
#include <vcl/dialog.hxx>
#include <vcl/weld.hxx>
#include <svl/itemset.hxx>
#include "res_ErrorBar.hxx"
......@@ -30,12 +30,12 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel;
namespace chart
{
class InsertErrorBarsDialog : public ModalDialog
class InsertErrorBarsDialog : public weld::GenericDialogController
{
public:
InsertErrorBarsDialog( vcl::Window* pParent, const SfxItemSet& rMyAttrs,
InsertErrorBarsDialog(weld::Window* pParent, const SfxItemSet& rMyAttrs,
const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
ErrorBarResources::tErrorBarType eType );
ErrorBarResources::tErrorBarType eType);
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
......@@ -45,7 +45,6 @@ public:
const OUString& rSelectedObjectCID );
void FillItemSet( SfxItemSet& rOutAttrs );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
private:
std::unique_ptr< ErrorBarResources > m_apErrorBarResources;
......
......@@ -20,11 +20,8 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX
#include <memory>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/layout.hxx>
#include <vcl/weld.hxx>
#include <sfx2/tabdlg.hxx>
#include <svl/itemset.hxx>
#include <svx/chrtitem.hxx>
#include "RangeSelectionListener.hxx"
......@@ -46,7 +43,7 @@ public:
};
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();
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
......@@ -63,38 +60,6 @@ public:
virtual void disposingRangeSelection() override;
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;
SvxChartIndicate m_eIndicate;
......@@ -109,22 +74,55 @@ private:
double m_fPlusValue;
double m_fMinusValue;
VclPtr<Dialog> m_pParentDialog;
TabPageParent m_pParentDialog;
std::unique_ptr< RangeSelectionHelper > m_apRangeSelectionHelper;
VclPtr<Edit> m_pCurrentRangeChoosingField;
weld::Entry* m_pCurrentRangeChoosingField;
bool m_bHasInternalDataProvider;
bool m_bEnableDataTableDialog;
DECL_LINK( CategoryChosen, Button*, void );
DECL_LINK( CategoryChosen2, ListBox&, void );
DECL_LINK( SynchronizePosAndNeg, CheckBox&, void );
DECL_LINK( PosValueChanged, Edit&, void );
DECL_LINK( IndicatorChanged, Button *, void );
DECL_LINK( ChooseRange, Button *, void );
DECL_LINK( RangeChanged, Edit&, void );
// category
std::unique_ptr<weld::RadioButton> m_xRbNone;
std::unique_ptr<weld::RadioButton> m_xRbConst;
std::unique_ptr<weld::RadioButton> m_xRbPercent;
std::unique_ptr<weld::RadioButton> m_xRbFunction;
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 isRangeFieldContentValid( Edit & rEdit );
void isRangeFieldContentValid(weld::Entry& rEdit);
};
} //namespace chart
......
......@@ -488,18 +488,18 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
//prepare and open dialog
SolarMutexGuard aGuard;
ScopedVclPtrInstance<InsertErrorBarsDialog> aDlg(
GetChartWindow(), aItemSet,
InsertErrorBarsDialog aDlg(
GetChartFrame(), aItemSet,
uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ),
bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X);
aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) );
if( aDlg->Execute() == RET_OK )
if (aDlg.run() == RET_OK)
{
SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
aDlg->FillItemSet( aOutItemSet );
aDlg.FillItemSet( aOutItemSet );
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
......
......@@ -194,6 +194,7 @@ public:
virtual OUString get_title() const = 0;
virtual void set_busy_cursor(bool bBusy) = 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)
= 0;
......
......@@ -727,6 +727,16 @@ public:
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
{
m_xWindow->SetPosPixel(Point(x, y));
......
......@@ -2052,6 +2052,11 @@ public:
g_object_unref(pCursor);
}
virtual void set_modal(bool bModal) override
{
gtk_window_set_modal(m_pWindow, bModal);
}
virtual void resize_to_request() override
{
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