27#include <svx/svxids.hrc>
28#include <osl/diagnose.h>
39#include <com/sun/star/chart2/AxisType.hpp>
57 :
SfxTabPage(pPage, pController,
"modules/schart/ui/tp_Scale.ui",
"tp_Scale", &rInAttrs)
63 , m_nTimeResolution(1)
66 , m_nAxisType(chart2::
AxisType::REALNUMBER)
67 , m_bAllowDateAxis(false)
68 , pNumFormatter(nullptr)
69 , m_bShowAxisOrigin(false)
70 , m_xCbxReverse(m_xBuilder->weld_check_button(
"CBX_REVERSE"))
71 , m_xCbxLogarithm(m_xBuilder->weld_check_button(
"CBX_LOGARITHM"))
72 , m_xBxType(m_xBuilder->weld_widget(
"boxTYPE"))
73 , m_xLB_AxisType(m_xBuilder->weld_combo_box(
"LB_AXIS_TYPE"))
74 , m_xBxMinMax(m_xBuilder->weld_widget(
"gridMINMAX"))
75 , m_xFmtFldMin(m_xBuilder->weld_formatted_spin_button(
"EDT_MIN"))
76 , m_xCbxAutoMin(m_xBuilder->weld_check_button(
"CBX_AUTO_MIN"))
77 , m_xFmtFldMax(m_xBuilder->weld_formatted_spin_button(
"EDT_MAX"))
78 , m_xCbxAutoMax(m_xBuilder->weld_check_button(
"CBX_AUTO_MAX"))
79 , m_xBxResolution(m_xBuilder->weld_widget(
"boxRESOLUTION"))
80 , m_xLB_TimeResolution(m_xBuilder->weld_combo_box(
"LB_TIME_RESOLUTION"))
81 , m_xCbx_AutoTimeResolution(m_xBuilder->weld_check_button(
"CBX_AUTO_TIME_RESOLUTION"))
82 , m_xTxtMain(m_xBuilder->weld_label(
"TXT_STEP_MAIN"))
83 , m_xFmtFldStepMain(m_xBuilder->weld_formatted_spin_button(
"EDT_STEP_MAIN"))
84 , m_xMt_MainDateStep(m_xBuilder->weld_spin_button(
"MT_MAIN_DATE_STEP"))
85 , m_xLB_MainTimeUnit(m_xBuilder->weld_combo_box(
"LB_MAIN_TIME_UNIT"))
86 , m_xCbxAutoStepMain(m_xBuilder->weld_check_button(
"CBX_AUTO_STEP_MAIN"))
87 , m_xTxtHelpCount(m_xBuilder->weld_label(
"TXT_STEP_HELP_COUNT"))
88 , m_xTxtHelp(m_xBuilder->weld_label(
"TXT_STEP_HELP"))
89 , m_xMtStepHelp(m_xBuilder->weld_spin_button(
"MT_STEPHELP"))
90 , m_xLB_HelpTimeUnit(m_xBuilder->weld_combo_box(
"LB_HELP_TIME_UNIT"))
91 , m_xCbxAutoStepHelp(m_xBuilder->weld_check_button(
"CBX_AUTO_STEP_HELP"))
92 , m_xFmtFldOrigin(m_xBuilder->weld_formatted_spin_button(
"EDT_ORIGIN"))
93 , m_xCbxAutoOrigin(m_xBuilder->weld_check_button(
"CBX_AUTO_ORIGIN"))
94 , m_xBxOrigin(m_xBuilder->weld_widget(
"boxORIGIN"))
127 bool bValueAxis =
m_nAxisType == chart2::AxisType::REALNUMBER
130 bool bDateAxis =
m_nAxisType == chart2::AxisType::DATE;
150 if( bWasDateAxis != bDateAxis )
175 bool bEnable = !rCbx.get_active() && rCbx.get_sensitive();
176 if (&rCbx == m_xCbxAutoMin.get())
178 m_xFmtFldMin->set_sensitive( bEnable );
180 else if (&rCbx == m_xCbxAutoMax.get())
182 m_xFmtFldMax->set_sensitive( bEnable );
184 else if (&rCbx == m_xCbxAutoStepMain.get())
186 m_xFmtFldStepMain->set_sensitive( bEnable );
187 m_xMt_MainDateStep->set_sensitive( bEnable );
188 m_xLB_MainTimeUnit->set_sensitive( bEnable );
190 else if (&rCbx == m_xCbxAutoStepHelp.get())
192 m_xMtStepHelp->set_sensitive( bEnable );
193 m_xLB_HelpTimeUnit->set_sensitive( bEnable );
195 else if (&rCbx == m_xCbx_AutoTimeResolution.get())
197 m_xLB_TimeResolution->set_sensitive( bEnable );
199 else if (&rCbx == m_xCbxAutoOrigin.get())
201 m_xFmtFldOrigin->set_sensitive( bEnable );
207enum AxisTypeListBoxEntry
218 const sal_Int32
nPos = m_xLB_AxisType->get_active();
220 m_nAxisType = chart2::AxisType::DATE;
222 m_nAxisType = chart2::AxisType::CATEGORY;
223 if( m_nAxisType == chart2::AxisType::DATE )
224 m_xCbxLogarithm->set_active(
false);
231 return std::make_unique<ScaleTabPage>(pPage, pController, *rOutAttrs);
236 OSL_PRECOND(
pNumFormatter,
"No NumberFormatter available" );
242 bool bAutoScale =
false;
271 OSL_PRECOND(
pNumFormatter,
"No NumberFormatter available" );
279 m_nAxisType =
static_cast<int>(pAxisTypeItem->GetValue());
284 bool bAutoDateAxis =
false;
286 bAutoDateAxis = pDateAxisItem->GetValue();
291 else if( bAutoDateAxis )
310 fMin = pAxisMinItem->GetValue();
320 fMax = pAxisMaxItem->GetValue();
352 fOrigin = pOriginItem->GetValue();
384 OSL_FAIL(
"No NumberFormatter available" );
385 return DeactivateRC::LeavePage;
388 bool bDateAxis =
m_nAxisType == chart2::AxisType::DATE;
390 sal_uInt32 nMinMaxOriginFmt =
m_xFmtFldMax->GetFormatter().GetFormatKey();
392 nMinMaxOriginFmt = 0;
421 pErrStrId = STR_BAD_LOGARITHM;
429 pErrStrId = STR_INVALID_NUMBER;
436 pErrStrId = STR_INVALID_NUMBER;
443 pErrStrId = STR_INVALID_NUMBER;
449 pErrStrId = STR_INVALID_NUMBER;
454 pErrStrId = STR_STEP_GT_ZERO;
460 pErrStrId = STR_MIN_GREATER_MAX;
469 pErrStrId = STR_INVALID_INTERVALS;
474 pErrStrId = STR_INVALID_INTERVALS;
485 pErrStrId = STR_INVALID_TIME_UNIT;
491 return DeactivateRC::KeepPage;
496 return DeactivateRC::LeavePage;
529 if( !pNumFormatItem )
532 sal_uInt32 nFmt = pNumFormatItem->
GetValue();
544 if(
eType == SvNumFormatType::DATE )
553 else if(
eType == SvNumFormatType::DATETIME )
564 int nWidthChars = std::ceil(nWidestTime /
m_xFmtFldMin->get_approximate_digit_width()) + 1;
569 if(
m_nAxisType == chart2::AxisType::DATE && (
eType != SvNumFormatType::DATE &&
eType != SvNumFormatType::DATETIME) )
599 VclMessageType::Warning, VclButtonsType::Ok,
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_DATEAXIS(SCHATTR_AXIS_START+15)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_AXIS_STEP_HELP(SCHATTR_AXIS_START+10)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_MAX(SCHATTR_AXIS_START+4)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_STEP_MAIN(SCHATTR_AXIS_START+6)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_STEP_HELP(SCHATTR_AXIS_START+9)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_AXIS_MIN(SCHATTR_AXIS_START+3)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_REVERSE(SCHATTR_AXIS_START+1)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_AXISTYPE(SCHATTR_AXIS_START)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_MIN(SCHATTR_AXIS_START+2)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_AXIS_ORIGIN(SCHATTR_AXIS_START+18)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_AXIS_HELP_TIME_UNIT(SCHATTR_AXIS_START+11)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_AXIS_TIME_RESOLUTION(SCHATTR_AXIS_START+13)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_AXIS_STEP_MAIN(SCHATTR_AXIS_START+7)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_ORIGIN(SCHATTR_AXIS_START+17)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_AXIS_MAX(SCHATTR_AXIS_START+5)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_ALLOW_DATEAXIS(SCHATTR_AXIS_START+16)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_AXIS_MAIN_TIME_UNIT(SCHATTR_AXIS_START+8)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_LOGARITHM(SCHATTR_AXIS_START+14)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_AXIS_AUTO_TIME_RESOLUTION(SCHATTR_AXIS_START+12)
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt32 GetValue() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxItemSet & GetItemSet() const
weld::Window * GetFrameWeld() const
static bool isAxisPositioningEnabled()
std::unique_ptr< weld::Widget > m_xBxMinMax
virtual DeactivateRC DeactivatePage(SfxItemSet *pItemSet) override
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFldOrigin
std::unique_ptr< weld::CheckButton > m_xCbxAutoMin
SvNumberFormatter * pNumFormatter
std::unique_ptr< weld::SpinButton > m_xMt_MainDateStep
std::unique_ptr< weld::Label > m_xTxtMain
ScaleTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
sal_Int32 m_nTimeResolution
std::unique_ptr< weld::CheckButton > m_xCbxAutoOrigin
std::unique_ptr< weld::SpinButton > m_xMtStepHelp
sal_Int32 m_nHelpTimeUnit
virtual ~ScaleTabPage() override
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFldStepMain
void SetNumFormatter(SvNumberFormatter *pFormatter)
std::unique_ptr< weld::ComboBox > m_xLB_HelpTimeUnit
std::unique_ptr< weld::ComboBox > m_xLB_MainTimeUnit
void ShowAxisOrigin(bool bShowOrigin)
sal_Int32 m_nMainTimeUnit
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rInAttrs)
std::unique_ptr< weld::CheckButton > m_xCbxAutoMax
std::unique_ptr< weld::CheckButton > m_xCbxAutoStepMain
std::unique_ptr< weld::Widget > m_xBxOrigin
std::unique_ptr< weld::CheckButton > m_xCbxReverse
std::unique_ptr< weld::Widget > m_xBxType
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFldMin
std::unique_ptr< weld::CheckButton > m_xCbx_AutoTimeResolution
virtual void Reset(const SfxItemSet *rInAttrs) override
std::unique_ptr< weld::CheckButton > m_xCbxAutoStepHelp
std::unique_ptr< weld::ComboBox > m_xLB_AxisType
std::unique_ptr< weld::Label > m_xTxtHelp
std::unique_ptr< weld::Widget > m_xBxResolution
bool ShowWarning(TranslateId pResIdMessage, weld::Widget *pControl)
shows a warning window due to an invalid input.
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFldMax
std::unique_ptr< weld::Label > m_xTxtHelpCount
std::unique_ptr< weld::CheckButton > m_xCbxLogarithm
virtual bool FillItemSet(SfxItemSet *rOutAttrs) override
std::unique_ptr< weld::ComboBox > m_xLB_TimeResolution
virtual void select_region(int nStartPos, int nEndPos)=0
OUString SFX2_DLLPUBLIC getWidestDateTime(const LocaleDataWrapper &rWrapper, bool bWithSec)
#define LINK(Instance, Class, Member)
static void lcl_setValue(weld::FormattedSpinButton &rFmtField, double fValue)
OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(TranslateId aId)
IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::Toggleable &, rRadio, void)
IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl, weld::ComboBox &, void)
const sal_uInt16 TYPE_DATE
const sal_uInt16 TYPE_TEXT
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)