tdf#78486: sc pivot calculated fields, change weld entry to weld
textview for formula field. Change-Id: Ia9a309eb95c48d559f97615d2aa3b96c53e82e20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201788 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
This commit is contained in:
@@ -51,7 +51,7 @@ ScPivotCalcFieldDlg::ScPivotCalcFieldDlg(weld::Window* pParent, ScViewData& rDat
|
||||
, mrDocument(mrViewData.GetDocument())
|
||||
, maPivotTableObject(*pDPObj)
|
||||
, mxCalcNames(m_xBuilder->weld_combo_box(u"calcfieldscb"_ustr))
|
||||
, mxCalculation(m_xBuilder->weld_entry(u"calcentry"_ustr))
|
||||
, mxCalculation(m_xBuilder->weld_text_view(u"calcentry"_ustr))
|
||||
, mxBtnAdd(m_xBuilder->weld_button(u"addbtn"_ustr))
|
||||
, mxBtnMod(m_xBuilder->weld_button(u"modbtn"_ustr))
|
||||
, mxBtnDel(m_xBuilder->weld_button(u"deletebtn"_ustr))
|
||||
@@ -81,6 +81,7 @@ void ScPivotCalcFieldDlg::Init()
|
||||
mxFieldList->connect_selection_changed(LINK(this, ScPivotCalcFieldDlg, FieldListSelected));
|
||||
mxCalcNames->connect_changed(LINK(this, ScPivotCalcFieldDlg, CalcFieldNameSelected));
|
||||
mxCalculation->connect_changed(LINK(this, ScPivotCalcFieldDlg, CalcEntryChanged));
|
||||
mxCalculation->set_size_request(-1, mxCalculation->get_height_rows(3));
|
||||
|
||||
// Initialize Data
|
||||
maPivotTableObject.FillOldParam(maPivotParameters);
|
||||
@@ -386,7 +387,8 @@ bool ScPivotCalcFieldDlg::DoAddMod()
|
||||
{
|
||||
// Validate the formula before adding or modifying
|
||||
FormulaError eError = FormulaError::NONE;
|
||||
OUString aCalculation = mxCalculation->get_text();
|
||||
OUString aCalculation
|
||||
= mxCalculation->get_text().replaceAll(u"\r", u"").replaceAll(u"\n", u" ");
|
||||
std::shared_ptr<ScTokenArray> pTokenArray = ValidateFormula(aCalculation, &eError);
|
||||
if (!pTokenArray)
|
||||
{
|
||||
@@ -590,11 +592,13 @@ IMPL_LINK_NOARG(ScPivotCalcFieldDlg, CalcFieldNameSelected, weld::ComboBox&, voi
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(ScPivotCalcFieldDlg, CalcEntryChanged, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(ScPivotCalcFieldDlg, CalcEntryChanged, weld::TextView&, void)
|
||||
{
|
||||
OUString aName = mxCalcNames->get_active_text();
|
||||
if (!aName.isEmpty() && !IsExistingField(aName))
|
||||
mxBtnAdd->set_sensitive(true);
|
||||
OUString aCalc = mxCalculation->get_text().trim();
|
||||
bool bEnable = !aCalc.isEmpty() && !aName.isEmpty() && !IsExistingField(aName);
|
||||
if (mxBtnAdd->get_sensitive() != bEnable)
|
||||
mxBtnAdd->set_sensitive(bEnable);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
|
||||
#include "viewdata.hxx"
|
||||
#include <dpobject.hxx>
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
OUString aStrModify;
|
||||
|
||||
std::unique_ptr<weld::ComboBox> mxCalcNames;
|
||||
std::unique_ptr<weld::Entry> mxCalculation;
|
||||
std::unique_ptr<weld::TextView> mxCalculation;
|
||||
|
||||
std::unique_ptr<weld::Button> mxBtnAdd;
|
||||
std::unique_ptr<weld::Button> mxBtnMod;
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
|
||||
DECL_LINK(FieldListSelected, weld::TreeView&, void);
|
||||
DECL_LINK(CalcFieldNameSelected, weld::ComboBox&, void);
|
||||
DECL_LINK(CalcEntryChanged, weld::Entry&, void);
|
||||
DECL_LINK(CalcEntryChanged, weld::TextView&, void);
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="label" translatable="yes" context="pivotcalcfielddialog|label2">Formula:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">calcentry</property>
|
||||
@@ -141,10 +142,26 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="calcentry">
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow_calcentry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="calcentry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="accepts-tab">False</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="calcentry-atkobject">
|
||||
<property name="AtkObject::accessible-description" translatable="yes" context="pivotcalcfielddialog|extended_tip|calcentry">Enter the formula for the calculated field.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -155,6 +172,7 @@
|
||||
<object class="GtkComboBoxText" id="calcfieldscb">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="has-entry">True</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry">
|
||||
|
||||
Reference in New Issue
Block a user