[Libreoffice-commits] core.git: Branch 'feature/jsdialogs' - 8 commits - desktop/source include/vcl sw/source vcl/jsdialog vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 11 14:08:51 UTC 2020
desktop/source/lib/init.cxx | 21 +++++++++++++++++++--
include/vcl/jsdialog/jsdialogbuilder.hxx | 12 +++++++++++-
sw/source/uibase/dialog/watermarkdialog.cxx | 10 ++++++++++
vcl/jsdialog/jsdialogbuilder.cxx | 25 +++++++++++++++++++++++++
vcl/source/control/tabctrl.cxx | 2 ++
vcl/source/window/builder.cxx | 6 +++++-
6 files changed, 72 insertions(+), 4 deletions(-)
New commits:
commit e96dbc88a6c63529500a52f0fac1f8c63445780f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Mar 11 14:45:10 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Mar 11 14:46:39 2020 +0100
jsdialog: send selected tab and names
Change-Id: I54db09a7a0311b5ed9bc0764c353b82bb99b9e41
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index cab39a8feb94..8d1806006dfe 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2194,10 +2194,12 @@ boost::property_tree::ptree TabControl::DumpAsPropertyTree()
boost::property_tree::ptree aTab;
aTab.put("text", GetPageText(id));
aTab.put("id", id);
+ aTab.put("name", GetPageName(id));
aTabs.push_back(std::make_pair("", aTab));
}
aTree.add_child("tabs", aTabs);
+ aTree.put("selected", GetCurPageId());
return aTree;
}
commit edacac4cfebe85055788af389ad5f87657c97ac3
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Mar 11 11:44:14 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Mar 11 11:44:16 2020 +0100
jsdialog: hide color picker in watermark dialog
with current color picker impl its impossible to
change color using JSDIALOG bridge
Change-Id: I1e022ecea1c0916d4e2df03f8e69fda5d43ea81c
diff --git a/sw/source/uibase/dialog/watermarkdialog.cxx b/sw/source/uibase/dialog/watermarkdialog.cxx
index a40977792873..1b15d1a2366c 100644
--- a/sw/source/uibase/dialog/watermarkdialog.cxx
+++ b/sw/source/uibase/dialog/watermarkdialog.cxx
@@ -18,6 +18,10 @@
#include <svl/eitem.hxx>
#include <sfx2/watermarkitem.hxx>
#include <svtools/ctrltool.hxx>
+#include <comphelper/lok.hxx>
+#include <sfx2/lokhelper.hxx>
+
+#define IS_MOBILE (comphelper::LibreOfficeKit::isActive() && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
SwWatermarkDialog::SwWatermarkDialog(weld::Window* pParent, SfxBindings& rBindings)
: SfxDialogController(pParent, "modules/swriter/ui/watermarkdialog.ui", "WatermarkDialog")
@@ -30,6 +34,12 @@ SwWatermarkDialog::SwWatermarkDialog(weld::Window* pParent, SfxBindings& rBindin
, m_xColor(new ColorListBox(m_xBuilder->weld_menu_button("Color"), m_xDialog.get()))
{
InitFields();
+
+ if (IS_MOBILE)
+ {
+ m_xBuilder->weld_label("ColorLabel")->hide();
+ m_xColor->hide();
+ }
}
SwWatermarkDialog::~SwWatermarkDialog()
commit 195f9e4205697283fd12c387f204e3bafbd21e40
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 10 17:10:38 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Mar 10 17:10:38 2020 +0100
jsdialog: weld SpinButton
Change-Id: I0dfa163b8a52594cde9e3529df8f433dc93bc459
diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx
index 107bd05c0bd4..5e79197f09e1 100644
--- a/include/vcl/jsdialog/jsdialogbuilder.hxx
+++ b/include/vcl/jsdialog/jsdialogbuilder.hxx
@@ -9,6 +9,7 @@
#include <vcl/salvtables.hxx>
#include <vcl/combobox.hxx>
#include <vcl/button.hxx>
+#include <vcl/fmtfield.hxx>
typedef std::map<OString, weld::Widget*> WidgetMap;
@@ -43,7 +44,7 @@ public:
virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id, bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id, bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership = false) override;
-
+ virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id, bool bTakeOwnership = false) override;
static weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget);
};
@@ -137,4 +138,13 @@ public:
virtual void append_page(const OString& rIdent, const OUString& rLabel) override;
};
+class VCL_DLLPUBLIC JSSpinButton : public JSWidget<SalInstanceSpinButton, ::FormattedField>
+{
+public:
+ JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+ virtual void set_value(int value) override;
+};
+
#endif
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 2fae6e6ac172..afdd7158e51b 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -196,6 +196,19 @@ std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString &
return pWeldWidget;
}
+std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OString &id, bool bTakeOwnership)
+{
+ FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
+ auto pWeldWidget = pSpinButton ?
+ std::make_unique<JSSpinButton>(m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog,
+ pSpinButton, this, bTakeOwnership) : nullptr;
+
+ if (pWeldWidget)
+ RememberWidget(id, pWeldWidget.get());
+
+ return pWeldWidget;
+}
+
JSLabel::JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: JSWidget<SalInstanceLabel, FixedText>(aOwnedToplevel, pLabel, pBuilder, bTakeOwnership)
@@ -312,3 +325,15 @@ void JSNotebook::append_page(const OString& rIdent, const OUString& rLabel)
SalInstanceNotebook::append_page(rIdent, rLabel);
notifyDialogState();
}
+
+JSSpinButton::JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+: JSWidget<SalInstanceSpinButton, ::FormattedField>(aOwnedToplevel, pSpin, pBuilder, bTakeOwnership)
+{
+}
+
+void JSSpinButton::set_value(int value)
+{
+ SalInstanceSpinButton::set_value(value);
+ notifyDialogState();
+}
commit 2977582671e8de4e21de9ee79825caf50033bff7
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 10 16:46:37 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Mar 10 16:46:37 2020 +0100
jsdialog: use welding for button click event
Change-Id: I0320dfb5cdc4f936eddff003bda7d16bdd1c4667
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6ba10ddec74a..02b020d8ea1b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3610,6 +3610,19 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
bContinueWithLOKWindow = true;
}
}
+ else if (sControlType == "pushbutton")
+ {
+ auto pButton = dynamic_cast<weld::Button*>(pWidget);
+ if (pButton)
+ {
+ if (sAction == "click")
+ {
+ pButton->clicked();
+ }
+ else
+ bContinueWithLOKWindow = true;
+ }
+ }
else
{
bContinueWithLOKWindow = true;
commit df72693ecf375dcb0a793e62e7ea8a3da60bd1a9
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 10 16:24:16 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Mar 10 16:24:16 2020 +0100
jsdialog: avoid crash in watermark dialog
Change-Id: Iea4a0e6ce005d6a86f9a228026471dd4b4c7b2da
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cc3db9484140..6ba10ddec74a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3553,12 +3553,14 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
static const OUString sUpAction("UP");
static const OUString sDownAction("DOWN");
+ bool bIsWeldedDialog = false;
+
try
{
OString sControlId = OUStringToOString(aMap["id"], RTL_TEXTENCODING_ASCII_US);
weld::Widget* pWidget = JSInstanceBuilder::FindWeldWidgetsMap(nWindowId, sControlId);
- bool bIsWeldedDialog = pWidget != nullptr;
+ bIsWeldedDialog = pWidget != nullptr;
bool bContinueWithLOKWindow = false;
if (bIsWeldedDialog)
@@ -3657,7 +3659,8 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
} catch(...) {}
// force resend
- pWindow->Resize();
+ if (!bIsWeldedDialog)
+ pWindow->Resize();
}
}
commit d5a82d1a12343671456f5251e4ce90da54acaad9
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 10 16:23:51 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Mar 10 16:23:51 2020 +0100
jsdialog: enable watermark dialog
Change-Id: I4badd0d2f6c9c0d2828152685aa14c2e1d358fea
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 5e7bb6f4af73..95c9240c441d 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -153,7 +153,8 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString
rUIFile == "modules/scalc/ui/validationdialog.ui" ||
rUIFile == "modules/scalc/ui/validationcriteriapage.ui" ||
rUIFile == "modules/scalc/ui/validationhelptabpage-mobile.ui" ||
- rUIFile == "modules/scalc/ui/erroralerttabpage-mobile.ui")
+ rUIFile == "modules/scalc/ui/erroralerttabpage-mobile.ui" ||
+ rUIFile == "modules/swriter/ui/watermarkdialog.ui")
bUseJSBuilder = true;
}
commit 19add08a8150d041b11a1b11b2ba562c21f0b12d
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 10 15:51:37 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Mar 10 15:51:37 2020 +0100
jsdialog: signal changed on combobox selection
Change-Id: Icd9b5559f570ec0a70562f9d5a6fc1887b83ca1f
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fcfc27ddd23d..cc3db9484140 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3596,6 +3596,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
OString posString = OUStringToOString(entryPos, RTL_TEXTENCODING_ASCII_US);
int pos = std::atoi(posString.getStr());
pCombobox->set_active(pos);
+ pCombobox->signal_changed();
}
}
else if (sAction == "change")
commit d0cef0be7128067e435777faae1e4859ea1335f8
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Mar 9 15:40:35 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Mar 9 15:40:35 2020 +0100
jsdialog: enable validation tab pages on mobile
Change-Id: I8828935f0215a5b2d911363a30c857b71c54ea6f
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index b51ed407f432..5e7bb6f4af73 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -150,7 +150,10 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString
{
if (rUIFile == "modules/swriter/ui/wordcount-mobile.ui" ||
rUIFile == "svx/ui/findreplacedialog-mobile.ui" ||
- rUIFile == "modules/scalc/ui/validationdialog.ui")
+ rUIFile == "modules/scalc/ui/validationdialog.ui" ||
+ rUIFile == "modules/scalc/ui/validationcriteriapage.ui" ||
+ rUIFile == "modules/scalc/ui/validationhelptabpage-mobile.ui" ||
+ rUIFile == "modules/scalc/ui/erroralerttabpage-mobile.ui")
bUseJSBuilder = true;
}
More information about the Libreoffice-commits
mailing list