26 u"modules/scalc/ui/sparklinedialog.ui",
"SparklineDialog")
27 , mrViewData(rViewData)
28 , mrDocument(rViewData.GetDocument())
29 , mpActiveEdit(nullptr)
30 , mbDialogLostFocus(false)
31 , mxButtonOk(m_xBuilder->weld_button(
"ok"))
32 , mxButtonCancel(m_xBuilder->weld_button(
"cancel"))
33 , mxFrameData(m_xBuilder->weld_frame(
"frmData"))
34 , mxInputRangeLabel(m_xBuilder->weld_label(
"lbInputRange"))
35 , mxInputRangeEdit(new
formula::RefEdit(m_xBuilder->weld_entry(
"edInputRange")))
36 , mxInputRangeButton(new
formula::RefButton(m_xBuilder->weld_button(
"btnInputRange")))
37 , mxOutputRangeLabel(m_xBuilder->weld_label(
"lbOutputRange"))
38 , mxOutputRangeEdit(new
formula::RefEdit(m_xBuilder->weld_entry(
"edOutputRange")))
39 , mxOutputRangeButton(new
formula::RefButton(m_xBuilder->weld_button(
"btnOutputRange")))
40 , mxColorSeries(new
ColorListBox(m_xBuilder->weld_menu_button(
"colSeries"),
41 [pWindow] {
return pWindow; }))
42 , mxColorNegative(
new ColorListBox(m_xBuilder->weld_menu_button(
"colNegative"),
43 [pWindow] { return pWindow; }))
44 , mxColorMarker(
new ColorListBox(m_xBuilder->weld_menu_button(
"colMarker"),
45 [pWindow] { return pWindow; }))
47 new ColorListBox(m_xBuilder->weld_menu_button(
"colHigh"), [pWindow] { return pWindow; }))
49 new ColorListBox(m_xBuilder->weld_menu_button(
"colLow"), [pWindow] { return pWindow; }))
51 new ColorListBox(m_xBuilder->weld_menu_button(
"colFirst"), [pWindow] { return pWindow; }))
53 new ColorListBox(m_xBuilder->weld_menu_button(
"colLast"), [pWindow] { return pWindow; }))
54 , mxCheckButtonNegative(m_xBuilder->weld_check_button(
"cbNegative"))
55 , mxCheckButtonMarker(m_xBuilder->weld_check_button(
"cbMarker"))
56 , mxCheckButtonHigh(m_xBuilder->weld_check_button(
"cbHigh"))
57 , mxCheckButtonLow(m_xBuilder->weld_check_button(
"cbLow"))
58 , mxCheckButtonFirst(m_xBuilder->weld_check_button(
"cbFirst"))
59 , mxCheckButtonLast(m_xBuilder->weld_check_button(
"cbLast"))
60 , mxSpinLineWidth(m_xBuilder->weld_spin_button(
"seLineWidth"))
61 , mxType(m_xBuilder->weld_combo_box(
"cbType"))
62 , mxCheckDisplayXAxis(m_xBuilder->weld_check_button(
"cbDisplayXAxis"))
63 , mxCheckDisplayHidden(m_xBuilder->weld_check_button(
"cbHidden"))
64 , mxCheckRightToLeft(m_xBuilder->weld_check_button(
"cbRTL"))
65 , mxDisplayEmptyGap(m_xBuilder->weld_combo_box(
"cbEmptyCells"))
66 , mxComboMinAxisType(m_xBuilder->weld_combo_box(
"cbMinAxisType"))
67 , mxComboMaxAxisType(m_xBuilder->weld_combo_box(
"cbMaxAxisType"))
68 , mxSpinCustomMin(m_xBuilder->weld_formatted_spin_button(
"seMinAxis"))
69 , mxSpinCustomMax(m_xBuilder->weld_formatted_spin_button(
"seMaxAxis"))
72 mxInputRangeEdit->SetReferences(
this, mxInputRangeLabel.get());
73 mxInputRangeButton->SetReferences(
this, mxInputRangeEdit.get());
75 mxOutputRangeEdit->SetReferences(
this, mxOutputRangeLabel.get());
76 mxOutputRangeButton->SetReferences(
this, mxOutputRangeEdit.get());
80 mxButtonOk->set_sensitive(
false);
83 mxInputRangeEdit->SetGetFocusHdl(aEditLink);
84 mxOutputRangeEdit->SetGetFocusHdl(aEditLink);
86 mxInputRangeEdit->SetLoseFocusHdl(aEditLink);
87 mxOutputRangeEdit->SetLoseFocusHdl(aEditLink);
90 mxInputRangeButton->SetGetFocusHdl(aButtonLink);
91 mxOutputRangeButton->SetGetFocusHdl(aButtonLink);
93 mxInputRangeButton->SetLoseFocusHdl(aButtonLink);
94 mxOutputRangeButton->SetLoseFocusHdl(aButtonLink);
97 mxInputRangeEdit->SetModifyHdl(aModifyLink);
98 mxOutputRangeEdit->SetModifyHdl(aModifyLink);
104 mxCheckButtonNegative->connect_toggled(aLink);
105 mxCheckButtonMarker->connect_toggled(aLink);
106 mxCheckButtonHigh->connect_toggled(aLink);
107 mxCheckButtonLow->connect_toggled(aLink);
108 mxCheckButtonFirst->connect_toggled(aLink);
109 mxCheckButtonLast->connect_toggled(aLink);
110 mxCheckDisplayXAxis->connect_toggled(aLink);
111 mxCheckDisplayHidden->connect_toggled(aLink);
112 mxCheckRightToLeft->connect_toggled(aLink);
133 mxOutputRangeEdit->GrabFocus();
134 mxButtonOk->set_sensitive(checkValidInputOutput());
274 if (rReferenceRange.
aStart != rReferenceRange.
aEnd)
300 auto* pEdit = &rEdit;
302 if (mxInputRangeEdit.get() == pEdit)
303 mpActiveEdit = mxInputRangeEdit.get();
304 else if (mxOutputRangeEdit.get() == pEdit)
305 mpActiveEdit = mxOutputRangeEdit.get();
307 mpActiveEdit =
nullptr;
310 mpActiveEdit->SelectAll();
315 auto* pButton = &rButton;
317 if (mxInputRangeButton.get() == pButton)
318 mpActiveEdit = mxInputRangeEdit.get();
319 else if (mxOutputRangeButton.get() == pButton)
320 mpActiveEdit = mxOutputRangeEdit.get();
322 mpActiveEdit =
nullptr;
325 mpActiveEdit->SelectAll();
330 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
335 mbDialogLostFocus = !
m_xDialog->has_toplevel_focus();
342 if (mpActiveEdit == mxInputRangeEdit.get())
345 bool bValid = ParseWithNames(aRangeList, mxInputRangeEdit->GetText(), mrDocument);
346 const ScRange* pRange = (bValid && aRangeList.
size() == 1) ? &aRangeList[0] :
nullptr;
349 maInputRange = *pRange;
350 mxInputRangeEdit->StartUpdateData();
357 else if (mpActiveEdit == mxOutputRangeEdit.get())
360 bool bValid = ParseWithNames(aRangeList, mxOutputRangeEdit->GetText(), mrDocument);
361 const ScRange* pRange = (bValid && aRangeList.
size() == 1) ? &aRangeList[0] :
nullptr;
364 maOutputRange = *pRange;
365 mxOutputRangeEdit->StartUpdateData();
374 mxButtonOk->set_sensitive(checkValidInputOutput());
379 if (mxButtonOk.get() == &rButton)
392 if (mxCheckButtonNegative.get() == &rToggle)
393 maAttributes.setNegative(mxCheckButtonNegative->get_active());
394 if (mxCheckButtonMarker.get() == &rToggle)
395 maAttributes.setMarkers(mxCheckButtonMarker->get_active());
396 if (mxCheckButtonHigh.get() == &rToggle)
397 maAttributes.setHigh(mxCheckButtonHigh->get_active());
398 if (mxCheckButtonLow.get() == &rToggle)
399 maAttributes.setLow(mxCheckButtonLow->get_active());
400 if (mxCheckButtonFirst.get() == &rToggle)
401 maAttributes.setFirst(mxCheckButtonFirst->get_active());
402 if (mxCheckButtonLast.get() == &rToggle)
403 maAttributes.setLast(mxCheckButtonLast->get_active());
404 if (mxCheckDisplayXAxis.get() == &rToggle)
405 maAttributes.setDisplayXAxis(mxCheckDisplayXAxis->get_active());
406 if (mxCheckDisplayHidden.get() == &rToggle)
407 maAttributes.setDisplayHidden(mxCheckDisplayHidden->get_active());
408 if (mxCheckRightToLeft.get() == &rToggle)
409 maAttributes.setRightToLeft(mxCheckRightToLeft->get_active());
414 switch (mxType->get_active())
426 switch (mxDisplayEmptyGap->get_active())
442 double value = mxSpinLineWidth->get_value() / 100.0;
443 maAttributes.setLineWeight(
value);
448 if (mxSpinCustomMin.get() == &rFormatted)
450 maAttributes.setManualMin(rFormatted.GetFormatter().GetValue());
452 else if (mxSpinCustomMax.get() == &rFormatted)
454 maAttributes.setManualMax(rFormatted.GetFormatter().GetValue());
460 int nActive = rComboBox.get_active();
462 if (mxComboMinAxisType.get() == &rComboBox)
468 mxSpinCustomMin->set_sensitive(
false);
472 mxSpinCustomMin->set_sensitive(
false);
476 mxSpinCustomMin->set_sensitive(
true);
482 else if (mxComboMaxAxisType.get() == &rComboBox)
488 mxSpinCustomMax->set_sensitive(
false);
492 mxSpinCustomMax->set_sensitive(
false);
496 mxSpinCustomMax->set_sensitive(
true);
545 auto pNewSparklineGroup = std::make_shared<sc::SparklineGroup>(
maAttributes);
Reference< XExecutableDialog > m_xDialog
static sal_uInt16 GetChildWindowId()
SC_DLLPUBLIC bool ChangeSparklineGroupAttributes(std::shared_ptr< sc::SparklineGroup > const &pExistingSparklineGroup, sc::SparklineAttributes const &rNewAttributes)
SC_DLLPUBLIC std::shared_ptr< sc::Sparkline > GetSparkline(ScAddress const &rPosition)
Returns sparkline at the address if it exists.
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC bool HasOneSparklineGroup(ScRange const &rRange)
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
virtual void RefInputDone(bool bForced=false) override
bool DoClose(sal_uInt16 nId)
ScDocShell * GetDocShell() const
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
DisplayEmptyCellsAs getDisplayEmptyCellsAs() const
std::optional< double > getManualMax() const
bool shouldDisplayXAxis() const
bool shouldDisplayHidden() const
Color getColorHigh() const
SparklineType getType() const
void setColorLast(Color aColorSeries)
void setColorSeries(Color aColorSeries)
Color getColorNegative() const
bool isRightToLeft() const
Color getColorMarkers() const
void setColorFirst(Color aColorSeries)
void setColorLow(Color aColorSeries)
AxisType getMaxAxisType() const
Color getColorFirst() const
AxisType getMinAxisType() const
std::optional< double > getManualMin() const
Color getColorLast() const
double getLineWeight() const
Line weight or width in points.
Color getColorSeries() const
void setColorMarkers(Color aColorSeries)
Color getColorLow() const
void setColorNegative(Color aColorSeries)
void setColorHigh(Color aColorSeries)
Dialog to create or edit sparkline group attributes.
std::unique_ptr< weld::CheckButton > mxCheckButtonHigh
bool checkValidInputOutput()
std::unique_ptr< weld::CheckButton > mxCheckDisplayXAxis
std::unique_ptr< weld::FormattedSpinButton > mxSpinCustomMin
std::unique_ptr< ColorListBox > mxColorMarker
std::unique_ptr< weld::SpinButton > mxSpinLineWidth
std::unique_ptr< ColorListBox > mxColorFirst
std::unique_ptr< weld::CheckButton > mxCheckDisplayHidden
virtual ~SparklineDialog() override
SparklineDialog(SfxBindings *pBindings, SfxChildWindow *pChildWindow, weld::Window *pWindow, ScViewData &rViewData)
std::unique_ptr< weld::FormattedSpinButton > mxSpinCustomMax
std::unique_ptr< weld::ComboBox > mxType
std::unique_ptr< ColorListBox > mxColorNegative
std::unique_ptr< ColorListBox > mxColorHigh
std::unique_ptr< weld::CheckButton > mxCheckButtonMarker
std::unique_ptr< ColorListBox > mxColorSeries
std::unique_ptr< weld::Frame > mxFrameData
std::unique_ptr< weld::CheckButton > mxCheckButtonNegative
std::unique_ptr< formula::RefEdit > mxOutputRangeEdit
std::unique_ptr< formula::RefEdit > mxInputRangeEdit
std::unique_ptr< weld::ComboBox > mxComboMinAxisType
std::unique_ptr< weld::ComboBox > mxComboMaxAxisType
std::unique_ptr< weld::CheckButton > mxCheckButtonLast
std::unique_ptr< weld::CheckButton > mxCheckButtonFirst
std::unique_ptr< weld::ComboBox > mxDisplayEmptyGap
std::shared_ptr< sc::SparklineGroup > mpSparklineGroup
std::unique_ptr< weld::CheckButton > mxCheckRightToLeft
formula::RefEdit * mpActiveEdit
virtual void SetReference(const ScRange &rRef, ScDocument &rDocument) override
std::unique_ptr< weld::Button > mxButtonOk
virtual void Close() override
sc::SparklineAttributes maAttributes
std::unique_ptr< ColorListBox > mxColorLow
std::unique_ptr< weld::CheckButton > mxCheckButtonLow
virtual void SetActive() override
std::unique_ptr< ColorListBox > mxColorLast
#define LINK(Instance, Class, Member)
CAUTION! The following defines must be in the same namespace as the respective type.
IMPL_LINK_NOARG(SharedStringPoolPurge, timerHandler, Timer *, void)
IMPL_LINK(SearchResultsDlg, HeaderBarClick, int, nColumn, void)
RangeOrientation calculateOrientation(sal_Int32 nOutputSize, ScRange const &rInputRange)
Determine the sparkline group orientation for the input data the output size.