summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-02-08 12:37:38 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2021-02-08 18:36:11 +0100
commit598ffe47a7f47157d891ad97d1edef032208d9f4 (patch)
treee5e30b9939ffeba15c35feb2ff6c3cb00e1dc10f /vcl
parentffe7fd5c3f3de474b201fbb1e25b8251cb13574d (diff)
jsdialog autofilter: show submenu on demad
- add posibility to trigger full update - send information if docking window is visible - send close message on builder destruction Change-Id: I0b3abc5ebcacf7f9a48910edf1bf0d73e8120d6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110578 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx25
-rw-r--r--vcl/jsdialog/executor.cxx11
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx14
3 files changed, 40 insertions, 10 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 267dc960ecd9..4be8eee0d0c0 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -84,7 +84,7 @@ public:
initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON);
}
- virtual ~JSDialogSender() = default;
+ virtual ~JSDialogSender();
virtual void sendFullUpdate(bool bForce = false);
void sendClose();
@@ -146,6 +146,8 @@ class JSInstanceBuilder : public SalInstanceBuilder, public JSDialogSender
friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget,
StringMap& rData);
+ friend VCL_DLLPUBLIC void jsdialog::SendFullUpdate(sal_uInt64 nWindowId,
+ const OString& rWidget);
static std::map<sal_uInt64, WidgetMap>& GetLOKWeldWidgetsMap();
static void InsertWindowToMap(sal_uInt64 nWindowId);
@@ -204,7 +206,20 @@ private:
VclPtr<vcl::Window>& GetNotifierWindow();
};
-template <class BaseInstanceClass, class VclClass> class JSWidget : public BaseInstanceClass
+class BaseJSWidget
+{
+public:
+ virtual ~BaseJSWidget() = default;
+
+ virtual void sendClose() = 0;
+
+ virtual void sendUpdate(bool bForce = false) = 0;
+
+ virtual void sendFullUpdate(bool bForce = false) = 0;
+};
+
+template <class BaseInstanceClass, class VclClass>
+class JSWidget : public BaseInstanceClass, public BaseJSWidget
{
protected:
rtl::Reference<JSDropTarget> m_xDropTarget;
@@ -272,19 +287,19 @@ public:
m_bIsFreezed = false;
}
- void sendClose()
+ virtual void sendClose() override
{
if (m_pSender)
m_pSender->sendClose();
}
- void sendUpdate(bool bForce = false)
+ virtual void sendUpdate(bool bForce = false) override
{
if (!m_bIsFreezed && m_pSender)
m_pSender->sendUpdate(BaseInstanceClass::m_xWidget, bForce);
}
- void sendFullUpdate(bool bForce = false)
+ virtual void sendFullUpdate(bool bForce = false) override
{
if ((!m_bIsFreezed || bForce) && m_pSender)
m_pSender->sendFullUpdate(bForce);
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 1de6db627f96..53f70630fe1c 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -34,6 +34,17 @@ StringMap jsonToStringMap(const char* pJSON)
return aArgs;
}
+void SendFullUpdate(sal_uInt64 nWindowId, const OString& rWidget)
+{
+ weld::Widget* pWidget = JSInstanceBuilder::FindWeldWidgetsMap(nWindowId, rWidget);
+
+ if (pWidget != nullptr)
+ {
+ auto pJSWidget = dynamic_cast<BaseJSWidget*>(pWidget);
+ pJSWidget->sendFullUpdate();
+ }
+}
+
bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rData)
{
weld::Widget* pWidget = JSInstanceBuilder::FindWeldWidgetsMap(nWindowId, rWidget);
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 9fd33ae26b3a..8c14e93e4a72 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -97,18 +97,20 @@ std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateFullUpdate() cons
if (m_sTypeOfJSON == "autofilter")
{
vcl::Window* pWindow = m_aContentWindow.get();
- DockingWindow* pDockingWIndow = dynamic_cast<DockingWindow*>(pWindow);
- while (pWindow && !pDockingWIndow)
+ DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow);
+ while (pWindow && !pDockingWindow)
{
pWindow = pWindow->GetParent();
- pDockingWIndow = dynamic_cast<DockingWindow*>(pWindow);
+ pDockingWindow = dynamic_cast<DockingWindow*>(pWindow);
}
- if (pDockingWIndow)
+ if (pDockingWindow)
{
- Point aPos = pDockingWIndow->GetFloatingPos();
+ Point aPos = pDockingWindow->GetFloatingPos();
aJsonWriter->put("posx", aPos.getX());
aJsonWriter->put("posy", aPos.getY());
+ if (!pDockingWindow->IsVisible())
+ aJsonWriter->put("visible", "false");
}
}
@@ -167,6 +169,8 @@ void JSDialogNotifyIdle::Invoke()
m_aMessageQueue.clear();
}
+JSDialogSender::~JSDialogSender() { sendClose(); }
+
void JSDialogSender::sendFullUpdate(bool bForce)
{
if (bForce)