[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 33 commits - desktop/source include/sfx2 include/svx include/vcl officecfg/registry sc/source sd/source svx/source sw/inc sw/source vcl/inc vcl/jsdialog vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 10 19:55:31 UTC 2021
desktop/source/lib/init.cxx | 11
include/sfx2/viewsh.hxx | 2
include/svx/fontworkbar.hxx | 2
include/vcl/EnumContext.hxx | 1
include/vcl/jsdialog/executor.hxx | 1
include/vcl/svapp.hxx | 1
include/vcl/weld.hxx | 2
officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 13
sc/source/ui/cctrl/checklistmenu.cxx | 9
sc/source/ui/cctrl/dpcontrol.cxx | 7
sc/source/ui/dbgui/PivotLayoutTreeListData.cxx | 3
sc/source/ui/inc/tabvwsh.hxx | 2
sc/source/ui/view/output2.cxx | 14
sc/source/ui/view/tabvwsh4.cxx | 5
sd/source/ui/inc/ViewShellBase.hxx | 4
sd/source/ui/inc/unomodel.hxx | 2
sd/source/ui/unoidl/unomodel.cxx | 11
svx/source/inc/StylesPreviewWindow.hxx | 3
svx/source/sidebar/SelectionAnalyzer.cxx | 9
svx/source/tbxctrls/StylesPreviewWindow.cxx | 49 +
svx/source/tbxctrls/fontworkgallery.cxx | 47 +
svx/source/toolbars/fontworkbar.cxx | 26
sw/inc/view.hxx | 2
sw/source/uibase/shells/drawsh.cxx | 11
sw/source/uibase/uiview/view.cxx | 9
sw/source/uibase/uiview/viewdraw.cxx | 19
vcl/inc/jsdialog/jsdialogbuilder.hxx | 145 +++-
vcl/inc/salvtables.hxx | 28
vcl/jsdialog/executor.cxx | 52 +
vcl/jsdialog/jsdialogbuilder.cxx | 369 +++++++----
vcl/source/app/salvtables.cxx | 88 +-
vcl/source/treelist/iconview.cxx | 4
vcl/source/treelist/svimpbox.cxx | 8
vcl/source/window/EnumContext.cxx | 1
vcl/source/window/dialog.cxx | 14
35 files changed, 747 insertions(+), 227 deletions(-)
New commits:
commit 3a2709b2765425759846195754f69787e7803678
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Mar 1 19:27:04 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:28 2021 +0200
jsdialog: send selection change for icon view
- add posibility to send additional actions
- send selection change for icon view as separate
command - optimization, no need for rendering
Change-Id: I02dd129068baf32c265612a1cfa2c2af20319ae9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111767
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112071
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index f6308b27e26d..c907b128bbd3 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -25,6 +25,7 @@
#include <cppuhelper/compbase.hxx>
#include <deque>
+#include <unordered_map>
class ToolBox;
class ComboBox;
@@ -33,6 +34,7 @@ class SvTabListBox;
class IconView;
typedef std::map<OString, weld::Widget*> WidgetMap;
+typedef std::unordered_map<std::string, OUString> ActionDataMap;
namespace jsdialog
{
@@ -40,10 +42,52 @@ enum MessageType
{
FullUpdate,
WidgetUpdate,
- Close
+ Close,
+ Action
};
}
+/// Class with the message description for storing in the queue
+class JSDialogMessageInfo
+{
+public:
+ jsdialog::MessageType m_eType;
+ VclPtr<vcl::Window> m_pWindow;
+ std::unique_ptr<ActionDataMap> m_pData;
+
+private:
+ void copy(const JSDialogMessageInfo& rInfo)
+ {
+ this->m_eType = rInfo.m_eType;
+ this->m_pWindow = rInfo.m_pWindow;
+ if (rInfo.m_pData)
+ {
+ std::unique_ptr<ActionDataMap> pData(new ActionDataMap(*rInfo.m_pData));
+ this->m_pData = std::move(pData);
+ }
+ }
+
+public:
+ JSDialogMessageInfo(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow,
+ std::unique_ptr<ActionDataMap> pData)
+ : m_eType(eType)
+ , m_pWindow(pWindow)
+ , m_pData(std::move(pData))
+ {
+ }
+
+ JSDialogMessageInfo(const JSDialogMessageInfo& rInfo) { copy(rInfo); }
+
+ JSDialogMessageInfo& operator=(JSDialogMessageInfo aInfo)
+ {
+ if (this == &aInfo)
+ return *this;
+
+ copy(aInfo);
+ return *this;
+ }
+};
+
class JSDialogNotifyIdle : public Idle
{
// used to send message
@@ -54,7 +98,7 @@ class JSDialogNotifyIdle : public Idle
std::string m_LastNotificationMessage;
bool m_bForce;
- std::deque<std::pair<jsdialog::MessageType, VclPtr<vcl::Window>>> m_aMessageQueue;
+ std::deque<JSDialogMessageInfo> m_aMessageQueue;
public:
JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
@@ -64,13 +108,16 @@ public:
void clearQueue();
void forceUpdate();
- void sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow);
+ void sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow,
+ std::unique_ptr<ActionDataMap> pData = nullptr);
private:
void send(tools::JsonWriter& aJsonWriter);
std::unique_ptr<tools::JsonWriter> generateFullUpdate() const;
std::unique_ptr<tools::JsonWriter> generateWidgetUpdate(VclPtr<vcl::Window> pWindow) const;
std::unique_ptr<tools::JsonWriter> generateCloseMessage() const;
+ std::unique_ptr<tools::JsonWriter>
+ generateActionMessage(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData) const;
};
class JSDialogSender
@@ -90,6 +137,7 @@ public:
virtual void sendFullUpdate(bool bForce = false);
void sendClose();
virtual void sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce = false);
+ virtual void sendAction(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData);
void flush() { mpIdleNotify->Invoke(); }
protected:
@@ -217,6 +265,8 @@ public:
virtual void sendUpdate(bool bForce = false) = 0;
virtual void sendFullUpdate(bool bForce = false) = 0;
+
+ virtual void sendAction(std::unique_ptr<ActionDataMap> pData) = 0;
};
template <class BaseInstanceClass, class VclClass>
@@ -305,6 +355,12 @@ public:
if ((!m_bIsFreezed || bForce) && m_pSender)
m_pSender->sendFullUpdate(bForce);
}
+
+ virtual void sendAction(std::unique_ptr<ActionDataMap> pData) override
+ {
+ if (!m_bIsFreezed && m_pSender && pData)
+ m_pSender->sendAction(BaseInstanceClass::m_xWidget, std::move(pData));
+ }
};
class JSDialog : public JSWidget<SalInstanceDialog, ::Dialog>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 14ab57570307..e039566805d3 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -27,6 +27,8 @@
#include <cppuhelper/supportsservice.hxx>
#include <utility>
+#define ACTION_TYPE "action_type"
+
namespace
{
void response_help(vcl::Window* pWindow)
@@ -83,7 +85,19 @@ void JSDialogNotifyIdle::send(tools::JsonWriter& aJsonWriter)
}
}
-void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow)
+namespace
+{
+OUString extractActionType(const ActionDataMap& rData)
+{
+ auto it = rData.find(ACTION_TYPE);
+ if (it != rData.end())
+ return it->second;
+ return "";
+}
+};
+
+void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow,
+ std::unique_ptr<ActionDataMap> pData)
{
// we want only the latest update of same type
// TODO: also if we met full update - previous updates are not valid
@@ -91,13 +105,22 @@ void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Wi
while (it != m_aMessageQueue.end())
{
- if (it->first == eType && it->second == pWindow)
+ if (it->m_eType == eType && it->m_pWindow == pWindow)
+ {
+ if (it->m_pData && pData
+ && extractActionType(*it->m_pData) != extractActionType(*pData))
+ {
+ it++;
+ continue;
+ }
it = m_aMessageQueue.erase(it);
+ }
else
it++;
}
- m_aMessageQueue.push_back(std::make_pair(eType, pWindow));
+ JSDialogMessageInfo aMessage(eType, pWindow, std::move(pData));
+ m_aMessageQueue.push_back(aMessage);
}
std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateFullUpdate() const
@@ -161,11 +184,32 @@ std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateCloseMessage() co
return aJsonWriter;
}
+std::unique_ptr<tools::JsonWriter>
+JSDialogNotifyIdle::generateActionMessage(VclPtr<vcl::Window> pWindow,
+ std::unique_ptr<ActionDataMap> pData) const
+{
+ std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
+
+ aJsonWriter->put("jsontype", m_sTypeOfJSON);
+ aJsonWriter->put("action", "action");
+ aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
+
+ {
+ auto aDataNode = aJsonWriter->startNode("data");
+ aJsonWriter->put("control_id", pWindow->get_id());
+
+ for (auto it = pData->begin(); it != pData->end(); it++)
+ aJsonWriter->put(it->first.c_str(), it->second);
+ }
+
+ return aJsonWriter;
+}
+
void JSDialogNotifyIdle::Invoke()
{
for (auto& rMessage : m_aMessageQueue)
{
- jsdialog::MessageType eType = rMessage.first;
+ jsdialog::MessageType eType = rMessage.m_eType;
switch (eType)
{
@@ -174,12 +218,16 @@ void JSDialogNotifyIdle::Invoke()
break;
case jsdialog::MessageType::WidgetUpdate:
- send(*generateWidgetUpdate(rMessage.second));
+ send(*generateWidgetUpdate(rMessage.m_pWindow));
break;
case jsdialog::MessageType::Close:
send(*generateCloseMessage());
break;
+
+ case jsdialog::MessageType::Action:
+ send(*generateActionMessage(rMessage.m_pWindow, std::move(rMessage.m_pData)));
+ break;
}
}
@@ -219,6 +267,12 @@ void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce)
mpIdleNotify->Start();
}
+void JSDialogSender::sendAction(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData)
+{
+ mpIdleNotify->sendMessage(jsdialog::MessageType::Action, pWindow, std::move(pData));
+ mpIdleNotify->Start();
+}
+
namespace
{
vcl::Window* extract_sal_widget(weld::Widget* pParent)
@@ -1187,7 +1241,11 @@ void JSIconView::clear()
void JSIconView::select(int pos)
{
SalInstanceIconView::select(pos);
- sendUpdate();
+
+ std::unique_ptr<ActionDataMap> pMap = std::make_unique<ActionDataMap>();
+ (*pMap)[ACTION_TYPE] = "select";
+ (*pMap)["position"] = OUString::number(pos);
+ sendAction(std::move(pMap));
}
void JSIconView::unselect(int pos)
commit 6d76e854b84f2c4391845475f9796dd72a804427
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Feb 26 09:00:33 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:28 2021 +0200
jsdialog: stop idle on destruction
be sure timer is stopped after we destroy builder.
if we close abandon previous messages.
Change-Id: I8c5458d14c45660aadecb1559b87d30a32364ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111593
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111990
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 968f5de23aaf..f6308b27e26d 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -62,6 +62,7 @@ public:
void Invoke() override;
+ void clearQueue();
void forceUpdate();
void sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow);
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index b915e944cadc..14ab57570307 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -183,10 +183,16 @@ void JSDialogNotifyIdle::Invoke()
}
}
- m_aMessageQueue.clear();
+ clearQueue();
}
-JSDialogSender::~JSDialogSender() { sendClose(); }
+void JSDialogNotifyIdle::clearQueue() { m_aMessageQueue.clear(); }
+
+JSDialogSender::~JSDialogSender()
+{
+ sendClose();
+ mpIdleNotify->Stop();
+}
void JSDialogSender::sendFullUpdate(bool bForce)
{
@@ -199,6 +205,7 @@ void JSDialogSender::sendFullUpdate(bool bForce)
void JSDialogSender::sendClose()
{
+ mpIdleNotify->clearQueue();
mpIdleNotify->sendMessage(jsdialog::MessageType::Close, nullptr);
flush();
}
commit 777ed7aa3a891fd52c3602ecb061da1daab61e7b
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Mar 1 10:01:42 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:27 2021 +0200
jsdialog: update on treeview clear
Change-Id: I4152e7581ae9172e77474c7f62bd42351636793e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111733
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Henry Castro <hcastro at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111989
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index ddb7adc2b35c..968f5de23aaf 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -472,6 +472,8 @@ public:
virtual void remove(int pos) override;
virtual void remove(const weld::TreeIter& rIter) override;
+ virtual void clear() override;
+
void drag_start();
void drag_end();
};
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 3332f125cc3d..b915e944cadc 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1121,6 +1121,12 @@ void JSTreeView::remove(const weld::TreeIter& rIter)
sendUpdate();
}
+void JSTreeView::clear()
+{
+ SalInstanceTreeView::clear();
+ sendUpdate();
+}
+
void JSTreeView::expand_row(const weld::TreeIter& rIter)
{
SalInstanceTreeView::expand_row(rIter);
commit d11fb90920766955c7982584751493d29cd45f77
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Fri Jan 22 20:38:21 2021 -0900
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:27 2021 +0200
tdf#137121 add popup menu to style items used in styles preview window
Change-Id: Ib9bd6584416b24301d3d302165d12c89bcd1e178
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109838
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx
index 8381f3b72c49..9e90c4d36288 100644
--- a/svx/source/inc/StylesPreviewWindow.hxx
+++ b/svx/source/inc/StylesPreviewWindow.hxx
@@ -56,7 +56,8 @@ public:
void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
- bool MouseButtonDown(const MouseEvent&) override;
+ bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ bool Command(const CommandEvent& rEvent) override;
void SetStyle(const std::pair<OUString, OUString>& sStyleName);
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index f0f24e2bf907..40d070477065 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -54,6 +54,9 @@
#include <sal/log.hxx>
+#include <vcl/event.hxx>
+#include <vcl/commandevent.hxx>
+
StyleStatusListener::StyleStatusListener(
StylesPreviewWindow_Base* pPreviewControl,
const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider)
@@ -102,15 +105,47 @@ void StyleItemController::Select(bool bSelect)
Invalidate();
}
-bool StyleItemController::MouseButtonDown(const MouseEvent&)
+bool StyleItemController::MouseButtonDown(const MouseEvent& rMEvt)
{
- css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
- aArgs[0].Value <<= m_aStyleName.second;
- aArgs[1].Name = "Family";
- aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
+ if (rMEvt.IsLeft())
+ {
+ css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
+ aArgs[0].Value <<= m_aStyleName.second;
+ aArgs[1].Name = "Family";
+ aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
+
+ aArgs[0].Name = "Template";
+ SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs);
+ }
+
+ return false;
+}
- aArgs[0].Name = "Template";
- SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs);
+bool StyleItemController::Command(const CommandEvent& rEvent)
+{
+ if (rEvent.GetCommand() != CommandEventId::ContextMenu)
+ return CustomWidgetController::Command(rEvent);
+
+ std::unique_ptr<weld::Builder> xBuilder(
+ Application::CreateBuilder(GetDrawingArea(), "svx/ui/stylemenu.ui"));
+ std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu"));
+ std::string_view rIdent = xMenu->popup_at_rect(
+ GetDrawingArea(), tools::Rectangle(rEvent.GetMousePosPixel(), Size(1, 1)));
+ if (rIdent == "update" || rIdent == "edit")
+ {
+ css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
+ aArgs[0].Name = "Param";
+ aArgs[0].Value <<= m_aStyleName.second;
+ aArgs[1].Name = "Family";
+ aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
+
+ SfxToolBoxControl::Dispatch(m_xDispatchProvider,
+ rIdent == "update" ? OUString(".uno:StyleUpdateByExample")
+ : OUString(".uno:EditStyle"),
+ aArgs);
+
+ return true;
+ }
return false;
}
commit 2d635cea465818f3e5b7e04dcba6731e6898000e
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 3 16:44:35 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:27 2021 +0200
Don't skip lines if only one row in the list
Mouse wheel emits delta > 1 so if we see only one row
but delta is 3 we skip then 2 rows.
Change-Id: I136788d38a189c061a55cba12eef05c7a4733820
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110379
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 68e32734e72a..7198ed561c0f 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -291,6 +291,10 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void )
if( !nDelta )
return;
+ // when only one row don't skip lines
+ if (pScrollBar->GetPageSize() == 1)
+ nDelta = nDelta > 0 ? 1 : -1;
+
m_nFlags &= ~LBoxFlags::Filling;
m_bInVScrollHdl = true;
commit 69f662277496d88f94772b3aa3fb4dcf01d2a8ee
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 3 17:21:54 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:27 2021 +0200
Resize IconView entry if there is no space
If IconView has only one row and there is no space for
default 100px height - scale down the entries.
Change-Id: I8b310f1274ba91872af0849e36e3a87e775c98b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110381
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index 7786a6976c2a..44fc3db789d4 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -104,6 +104,10 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n
const Color aHighlightTextColor(rSettings.GetHighlightTextColor());
aHighlightFont.SetColor(aHighlightTextColor);
+ Size aOutputSize = GetOutputSizePixel();
+ if (aOutputSize.getHeight() < nTempEntryHeight)
+ nTempEntryHeight = aOutputSize.getHeight();
+
Size aRectSize(nTempEntryWidth, nTempEntryHeight);
SvViewDataEntry* pViewDataEntry = GetViewDataEntry(&rEntry);
commit 690d3f11f36d350eb110621ae237464d7185be42
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 3 16:17:29 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:27 2021 +0200
Invalidate IconView on scroll if has only one row
When we have only one row the page size for scrollbar is
set to 1 so delta is always 1. This prevents from invalidation
when scrolling up using a scrollbar button and results in artifacts
on the screen.
Change-Id: I92ed0133450ba459e19b575d8c52d059464b1e33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110377
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index d72de8763981..68e32734e72a 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -303,7 +303,7 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void )
if( nDelta > 0 )
{
- if( nDelta == 1 )
+ if( nDelta == 1 && pScrollBar->GetPageSize() > 1)
CursorDown();
else
PageDown( static_cast<sal_uInt16>(nDelta) );
@@ -311,7 +311,7 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void )
else
{
nDelta *= -1;
- if( nDelta == 1 )
+ if( nDelta == 1 && pScrollBar->GetPageSize() > 1)
CursorUp();
else
PageUp( static_cast<sal_uInt16>(nDelta) );
commit 480b346d106f24070fbb02d6b2fc40e6a2ec98fe
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Feb 22 15:16:06 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:26 2021 +0200
jsdialog: fix missing update for "treeview" action "select"
When Treeview control selects an item, the state of the control
has changed and it should update the new changes to the client side.
Change-Id: I27d6a215148fcef260799d76ffe209460f38c559
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111355
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113683
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 5f4ad0ec2bd2..3332f125cc3d 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1056,6 +1056,7 @@ void JSTreeView::select(int pos)
}
}
enable_notify_events();
+ sendUpdate();
}
weld::TreeView* JSTreeView::get_drag_source() const { return g_DragSource; }
commit 12fb7a05ebcce753941b3e9e0988a7870e1fb03d
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Feb 17 16:47:27 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:26 2021 +0200
lok: add batch mode option to load the document
When the LibreOffice Kit is active by default is
set to headless mode, with the flag "DialogCancelMode::Silent",
according to the documentation it should close the dialog,
but it was changed for dialog tunneling.
However the dialog tunneling is being deprecated, and
in order to not produce any regression, it will be used
temporary a new state "DialogCancelMode::LOKSilent", to disable
any dialog interactivity.
Change-Id: I3b6cce38c37f75dc1b24dda352f6caec19438ff1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111087
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
(cherry picked from commit 5f3fbb019bd79bd57eed94e01bd2202efd9a0c06)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111319
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1964eac0a2a2..0d1b7999dae1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2240,6 +2240,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
const OUString aDeviceFormFactor = extractParameter(aOptions, "DeviceFormFactor");
SfxLokHelper::setDeviceFormFactor(aDeviceFormFactor);
+ const OUString aBatch = extractParameter(aOptions, u"Batch");
+ if (!aBatch.isEmpty())
+ {
+ Application::SetDialogCancelMode(DialogCancelMode::LOKSilent);
+ }
+
uno::Sequence<css::beans::PropertyValue> aFilterOptions(3);
aFilterOptions[0] = css::beans::PropertyValue( "FilterOptions",
0,
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 1f4dff193024..ab2af42dc41c 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -212,6 +212,7 @@ private:
enum class DialogCancelMode {
Off, ///< do not automatically cancel dialogs
Silent, ///< silently cancel any dialogs
+ LOKSilent, ///< silently cancel any dialogs (LOK case)
Fatal ///< cancel any dialogs by std::abort
};
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index af8fb38b10e6..27949e4d19b7 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -950,6 +950,10 @@ bool Dialog::ImplStartExecute()
"Dialog \"" << ImplGetDialogText(this)
<< "\"cancelled in silent mode");
return false;
+
+ case DialogCancelMode::LOKSilent:
+ return false;
+
default: // default cannot happen
case DialogCancelMode::Fatal:
std::abort();
commit 7749d40346790430be2aea7635b47eae20252462
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 10 08:04:06 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:26 2021 +0200
jsdialog: update on treeview item remove
Change-Id: I36b07284b18d3eda184fd6c3f186763d1265d2a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110665
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111988
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 4c78f135a67a..ddb7adc2b35c 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -468,6 +468,10 @@ public:
virtual void expand_row(const weld::TreeIter& rIter) override;
virtual void collapse_row(const weld::TreeIter& rIter) override;
+ using SalInstanceTreeView::remove;
+ virtual void remove(int pos) override;
+ virtual void remove(const weld::TreeIter& rIter) override;
+
void drag_start();
void drag_end();
};
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index c7c8c3735fd5..5f4ad0ec2bd2 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1108,6 +1108,18 @@ void JSTreeView::set_text(const weld::TreeIter& rIter, const OUString& rStr, int
sendUpdate();
}
+void JSTreeView::remove(int pos)
+{
+ SalInstanceTreeView::remove(pos);
+ sendUpdate();
+}
+
+void JSTreeView::remove(const weld::TreeIter& rIter)
+{
+ SalInstanceTreeView::remove(rIter);
+ sendUpdate();
+}
+
void JSTreeView::expand_row(const weld::TreeIter& rIter)
{
SalInstanceTreeView::expand_row(rIter);
commit 04ec107195c81331932e62a0630b94cd7fb09355
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 10 07:21:30 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:26 2021 +0200
fontwork: center in online in writer
Avoid unnecessary position change
Change-Id: I338b9a28653569e1b7c19ba3a1f590363fb2f94c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110664
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112164
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index b23fb93ed520..6ee6e4eafe22 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -162,18 +162,17 @@ void SwView::ExecDraw(SfxRequest& rReq)
const SwRect& rVisArea = comphelper::LibreOfficeKit::isActive() ?
m_pWrtShell->getLOKVisibleArea() : m_pWrtShell->VisArea();
Point aPos( rVisArea.Center() );
+ tools::Rectangle aObjRect( pObj->GetLogicRect() );
- if( rVisArea.Width() > aDocSize.Width())
+ if ( rVisArea.Width() > aDocSize.Width())
aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
+ else if (aPos.getX() > aObjRect.GetWidth() / 2)
+ aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
- if(rVisArea.Height() > aDocSize.Height())
+ if (rVisArea.Height() > aDocSize.Height())
aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
-
- tools::Rectangle aObjRect( pObj->GetLogicRect() );
- if (aPos.getX() > aObjRect.GetWidth() / 2)
- aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
- if (aPos.getY() > aObjRect.GetHeight() / 2)
- aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
+ else if (aPos.getY() > aObjRect.GetHeight() / 2)
+ aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
m_pWrtShell->EnterStdMode();
m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
commit ce10de8ed4159422700eef2a80237528d4fcd98d
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Feb 8 16:58:44 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:25 2021 +0200
jsdialog: handle standard buttons like help
- dump response bindings
- execute help callback
Change-Id: Ib0696b4ba74a186a2b80d49f21a1442d1c520821
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110586
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111958
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 190d1bb33465..4c78f135a67a 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -400,6 +400,8 @@ public:
virtual void set_primary_text(const OUString& rText) override;
virtual void set_secondary_text(const OUString& rText) override;
+
+ virtual void response(int response) override;
};
class JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox>
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 409c77a5d126..7504db8900fe 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -345,6 +345,14 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
pDialog->response(RET_CANCEL);
return true;
}
+ else if (sAction == "response")
+ {
+ OString nResponseString
+ = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+ int nResponse = std::atoi(nResponseString.getStr());
+ pDialog->response(nResponse);
+ return true;
+ }
}
}
else if (sControlType == "radiobutton")
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index da0537893a35..c7c8c3735fd5 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -27,6 +27,23 @@
#include <cppuhelper/supportsservice.hxx>
#include <utility>
+namespace
+{
+void response_help(vcl::Window* pWindow)
+{
+ ::Dialog* pDialog = dynamic_cast<::Dialog*>(pWindow);
+ if (!pDialog)
+ return;
+
+ vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP);
+ ::Button* pButton = dynamic_cast<::Button*>(pButtonWindow);
+ if (!pButton)
+ return;
+
+ pButton->Click();
+}
+}
+
JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow,
VclPtr<vcl::Window> aContentWindow, std::string sTypeOfJSON)
: Idle("JSDialog notify")
@@ -748,6 +765,12 @@ void JSDialog::undo_collapse()
void JSDialog::response(int response)
{
+ if (response == RET_HELP)
+ {
+ response_help(m_xWidget.get());
+ return;
+ }
+
sendClose();
SalInstanceDialog::response(response);
}
@@ -922,6 +945,18 @@ void JSMessageDialog::set_secondary_text(const OUString& rText)
sendFullUpdate();
}
+void JSMessageDialog::response(int response)
+{
+ if (response == RET_HELP)
+ {
+ response_help(m_xWidget.get());
+ return;
+ }
+
+ sendClose();
+ SalInstanceMessageDialog::response(response);
+}
+
JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: JSWidget<SalInstanceCheckButton, ::CheckBox>(pSender, pCheckBox, pBuilder, bTakeOwnership)
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index f1e3fe30cf06..af8fb38b10e6 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1653,6 +1653,16 @@ void Dialog::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
+
+ {
+ auto aResponses = rJsonWriter.startArray("responses");
+ for (auto& rResponse : mpDialogImpl->maResponses)
+ {
+ auto aResponse = rJsonWriter.startStruct();
+ rJsonWriter.put("id", rResponse.first->get_id());
+ rJsonWriter.put("response", rResponse.second);
+ }
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 47a2459a24396578a7afd1331b1c6baefa2d9750
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 12:02:41 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:25 2021 +0200
pivot table: avoid crash on drag n drop
Change-Id: I8d081cf884c38b2e4f367143ad728c29b1466fbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109634
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index d6b3f6d980a9..b01286755e20 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -181,6 +181,9 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataF
void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget)
{
+ if (rSource.count_selected_rows() <=0)
+ return;
+
ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
if (mpParent->IsDataElement(pItemValue->maFunctionData.mnCol))
commit cc2c4fd39cf190fd527162b39390964bc251a7a9
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Feb 1 16:48:28 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:25:25 2021 +0200
autofilter: scale dropdown button according to zoom level
Change-Id: I4f8a16e196bc33ea5b29fda0edc1f773a24e28db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110259
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111896
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 24620cdbd661..d7dd13dd5c4e 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -146,6 +146,13 @@ void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const
tools::Long nW = std::min(maSize.getWidth() / 2, nMaxSize);
tools::Long nH = std::min(maSize.getHeight(), nMaxSize);
+ double fZoom = static_cast<double>(maZoomY) > 1.0 ? static_cast<double>(maZoomY) : 1.0;
+ if (fZoom > 1.0)
+ {
+ nW = fZoom * (nW - 1);
+ nH = fZoom * (nH - 1);
+ }
+
// #i114944# AutoFilter button is left-aligned in RTL.
// DataPilot button is always right-aligned for now, so text output isn't affected.
if (mbPopupLeft)
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 367d0dca1f5a..78304634df1d 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1351,8 +1351,10 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too
( rPattern.GetItem(ATTR_MERGE_FLAG).GetValue() & (ScMF::Auto|ScMF::Button|ScMF::ButtonPopup) ) &&
( !bBreak || mpRefDevice == pFmtDevice ) )
{
- // filter drop-down width is now independent from row height
- const tools::Long nFilter = DROPDOWN_BITMAP_SIZE;
+ // filter drop-down width depends on row height
+ double fZoom = mpRefDevice ? static_cast<double>(mpRefDevice->GetMapMode().GetScaleY()) : 1.0;
+ fZoom = fZoom > 1.0 ? fZoom : 1.0;
+ const tools::Long nFilter = fZoom * DROPDOWN_BITMAP_SIZE;
bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
if ( bFit )
{
@@ -4915,11 +4917,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
eOrient!=SvxCellOrientation::Stacked &&
pInfo->bAutoFilter)
{
- // filter drop-down width is now independent from row height
+ // filter drop-down width depends on row height
+ double fZoom = mpRefDevice ? static_cast<double>(mpRefDevice->GetMapMode().GetScaleY()) : 1.0;
+ fZoom = fZoom > 1.0 ? fZoom : 1.0;
if (bPixelToLogic)
- nAvailWidth -= mpRefDevice->PixelToLogic(Size(0,DROPDOWN_BITMAP_SIZE)).Height();
+ nAvailWidth -= mpRefDevice->PixelToLogic(Size(0,fZoom * DROPDOWN_BITMAP_SIZE)).Height();
else
- nAvailWidth -= DROPDOWN_BITMAP_SIZE;
+ nAvailWidth -= fZoom * DROPDOWN_BITMAP_SIZE;
tools::Long nComp = nEngineWidth;
if (nAvailWidth<nComp) nAvailWidth=nComp;
}
commit 361121394f0794bbd0f4d23f1a410448fceb4c4e
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 27 14:34:19 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:04:33 2021 +0200
Introduce Fontwork context
Change-Id: I61512e4da13514d3e5a199ccb46468ba199b808f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110023
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112274
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svx/fontworkbar.hxx b/include/svx/fontworkbar.hxx
index 1f3a81a9a79c..33c67e8f051b 100644
--- a/include/svx/fontworkbar.hxx
+++ b/include/svx/fontworkbar.hxx
@@ -26,12 +26,14 @@
class SfxViewShell;
class SdrView;
+class SdrObject;
/************************************************************************/
namespace svx
{
bool SVXCORE_DLLPUBLIC checkForSelectedFontWork(SdrView const* pSdrView, sal_uInt32& nCheckStatus);
+bool SVXCORE_DLLPUBLIC checkForFontWork(SdrObject* pObj);
class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FontworkBar final : public SfxShell
{
diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx
index 1c356979d858..639a427a138a 100644
--- a/include/vcl/EnumContext.hxx
+++ b/include/vcl/EnumContext.hxx
@@ -71,6 +71,7 @@ public:
Chart,
ChartElements,
Draw,
+ DrawFontwork,
DrawLine,
DrawPage,
DrawText,
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index ce273e192e59..f9285cb66b5b 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -373,6 +373,7 @@
Calc, EditCell, visible ;
Calc, Pivot, visible, .uno:CellTextDlg ;
DrawImpress, Draw, hidden ;
+ DrawImpress, DrawFontwork, hidden ;
DrawImpress, DrawText, visible ;
DrawImpress, DrawLine, hidden ;
DrawImpress, Graphic, hidden ;
@@ -563,13 +564,16 @@
<prop oor:name="ContextList">
<value oor:separator=";">
Calc, Draw, visible ;
+ Calc, DrawFontwork, visible ;
Calc, OLE, hidden ;
DrawImpress, 3DObject, visible ;
DrawImpress, Draw, visible ;
+ DrawImpress, DrawFontwork, visible ;
DrawImpress, Graphic, hidden ;
DrawImpress, TextObject, hidden ;
DrawImpress, OLE, hidden ;
WriterVariants, Draw, visible ;
+ WriterVariants, DrawFontwork, visible ;
Writer, Graphic, hidden ;
Writer, OLE, hidden ;
Writer, Frame, visible ;
@@ -625,9 +629,11 @@
<prop oor:name="ContextList">
<value oor:separator=";">
Calc, Draw, visible ;
+ Calc, DrawFontwork, visible ;
Calc, OLE, hidden ;
DrawImpress, 3DObject, visible ;
DrawImpress, Draw, hidden ;
+ DrawImpress, DrawFontwork, hidden ;
DrawImpress, Graphic, hidden ;
DrawImpress, TextObject, hidden ;
DrawImpress, OLE, hidden ;
@@ -657,16 +663,19 @@
<prop oor:name="ContextList">
<value oor:separator=";">
Calc, Draw, visible ;
+ Calc, DrawFontwork, visible ;
Calc, DrawLine, visible ;
Calc, Graphic, visible ;
Calc, OLE, hidden ;
DrawImpress, 3DObject, visible ;
DrawImpress, Draw, visible ;
+ DrawImpress, DrawFontwork, visible ;
DrawImpress, DrawLine, visible ;
DrawImpress, Graphic, visible ;
DrawImpress, TextObject, hidden ;
DrawImpress, OLE, hidden ;
WriterVariants, Draw, visible ;
+ WriterVariants, DrawFontwork, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
@@ -720,6 +729,7 @@
<value oor:separator=";">
Calc, Chart, visible ;
Calc, Draw, hidden ;
+ Calc, DrawFontwork, hidden ;
Calc, DrawLine, visible ;
Calc, Form, visible ;
Calc, Graphic, hidden ;
@@ -728,6 +738,7 @@
Calc, OLE, visible ;
DrawImpress, 3DObject, visible ;
DrawImpress, Draw, visible ;
+ DrawImpress, DrawFontwork, visible ;
DrawImpress, DrawLine, visible ;
DrawImpress, Form, visible ;
DrawImpress, Graphic, hidden ;
@@ -736,6 +747,7 @@
DrawImpress, OLE, visible ;
DrawImpress, TextObject, hidden ;
WriterVariants, Draw, hidden ;
+ WriterVariants, DrawFontwork, hidden ;
WriterVariants, Form, visible ;
WriterVariants, Graphic, visible, .uno:GraphicDialog ;
WriterVariants, Media, visible ;
@@ -1149,6 +1161,7 @@
DrawImpress, DrawLine, hidden ;
DrawImpress, 3DObject, hidden ;
DrawImpress, Draw, hidden ;
+ DrawImpress, DrawFontwork, hidden ;
DrawImpress, DrawText, visible ;
DrawImpress, Graphic, hidden ;
DrawImpress, Table, visible ;
diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx
index baeaffc20858..a7e6da146edf 100644
--- a/svx/source/sidebar/SelectionAnalyzer.cxx
+++ b/svx/source/sidebar/SelectionAnalyzer.cxx
@@ -22,6 +22,7 @@
#include <svx/svdobj.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdpage.hxx>
+#include <svx/fontworkbar.hxx>
using vcl::EnumContext;
@@ -46,6 +47,10 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC(const SdrMarkL
{
eContext = EnumContext::Context::DrawText;
}
+ else if (svx::checkForFontWork(pObj))
+ {
+ eContext = EnumContext::Context::DrawFontwork;
+ }
else
{
const SdrInventor nInv = pObj->GetObjInventor();
@@ -133,6 +138,10 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD(const SdrMarkL
else
eContext = EnumContext::Context::DrawText;
}
+ else if (svx::checkForFontWork(pObj))
+ {
+ eContext = EnumContext::Context::DrawFontwork;
+ }
else
{
const SdrInventor nInv = pObj->GetObjInventor();
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 8a89952d8db3..fcaab8cce21e 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -205,26 +205,34 @@ FontworkBar::~FontworkBar()
}
namespace svx {
+bool checkForFontWork( SdrObject* pObj )
+{
+ static constexpr OUStringLiteral sTextPath = u"TextPath";
+ bool bFound = false;
+
+ if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
+ {
+ const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
+ if( pAny )
+ *pAny >>= bFound;
+ }
+
+ return bFound;
+}
+
bool checkForSelectedFontWork( SdrView const * pSdrView, sal_uInt32& nCheckStatus )
{
if ( nCheckStatus & 2 )
return ( nCheckStatus & 1 ) != 0;
- static const char sTextPath[] = "TextPath";
-
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
const size_t nCount = rMarkList.GetMarkCount();
bool bFound = false;
for(size_t i=0; (i<nCount) && !bFound ; ++i)
{
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
- if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
- {
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
- if( pAny )
- *pAny >>= bFound;
- }
+ bFound = checkForFontWork(pObj);
}
if ( bFound )
nCheckStatus |= 1;
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 59fe518a77de..5bdbdc71f81d 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -35,6 +35,7 @@
#include <swmodule.hxx>
#include <doc.hxx>
#include <docsh.hxx>
+#include <svx/fontworkbar.hxx>
#include <svx/svdoashp.hxx>
#include <svx/xfillit0.hxx>
@@ -534,7 +535,15 @@ SwDrawShell::SwDrawShell(SwView &_rView) :
{
SetName("Draw");
- SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Draw));
+ vcl::EnumContext::Context eContext = vcl::EnumContext::Context::Draw;
+
+ SwWrtShell &rSh = GetShell();
+ SdrView* pDrView = rSh.GetDrawView();
+ sal_uInt32 nCheckStatus = 0;
+ if (pDrView && svx::checkForSelectedFontWork(pDrView, nCheckStatus))
+ eContext = vcl::EnumContext::Context::DrawFontwork;
+
+ SfxShell::SetContextName(vcl::EnumContext::GetContextName(eContext));
}
// Edit SfxRequests for FontWork
diff --git a/vcl/source/window/EnumContext.cxx b/vcl/source/window/EnumContext.cxx
index 7d3d704180f4..b407a8069bc7 100644
--- a/vcl/source/window/EnumContext.cxx
+++ b/vcl/source/window/EnumContext.cxx
@@ -159,6 +159,7 @@ void EnumContext::ProvideContextContainers()
AddEntry("Chart", Context::Chart);
AddEntry("ChartElements", Context::ChartElements);
AddEntry("Draw", Context::Draw);
+ AddEntry("DrawFontwork", Context::DrawFontwork);
AddEntry("DrawLine", Context::DrawLine);
AddEntry("DrawPage", Context::DrawPage);
AddEntry("DrawText", Context::DrawText);
commit 56da8fcde1c435d2c0e13bd55b52c94bf6e4e6d9
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 26 16:35:10 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:02:23 2021 +0200
fontwork: insert in the center of LOK view
Change-Id: Iabde4ee927546b0e396c4fbd6d0099fa82240166
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109968
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112163
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 67671a6a678b..bf52719f99b5 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -382,6 +382,8 @@ public:
bool isLOKTablet() const { return maLOKDeviceFormFactor == LOKDeviceFormFactor::TABLET; }
/// Check if the lok client is running on a mobile device.
bool isLOKMobilePhone() const { return maLOKDeviceFormFactor == LOKDeviceFormFactor::MOBILE; }
+
+ virtual tools::Rectangle getLOKVisibleArea() const { return tools::Rectangle(); }
};
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 480f4ca9c73b..7a07d476eb0b 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -400,6 +400,8 @@ public:
void InitFormEditData();
void ClearFormEditData();
ScFormEditData* GetFormEditData() { return mpFormEditData.get(); }
+
+ virtual tools::Rectangle getLOKVisibleArea() const override;
};
#endif
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 34a11e3f8e6e..0a1d2212f1fb 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1858,4 +1858,9 @@ ScNavigatorSettings* ScTabViewShell::GetNavigatorSettings()
return pNavSettings.get();
}
+tools::Rectangle ScTabViewShell::getLOKVisibleArea() const
+{
+ return GetViewData().getLOKVisibleArea();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index 0510b2ad0fb5..085285f900b1 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -217,6 +217,9 @@ public:
/// See SfxViewShell::NotifyCursor().
void NotifyCursor(SfxViewShell* pViewShell) const override;
+ void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea = rArea; }
+ virtual ::tools::Rectangle getLOKVisibleArea() const override { return maLOKVisibleArea; }
+
protected:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
@@ -228,6 +231,7 @@ private:
std::unique_ptr<Implementation> mpImpl;
DrawDocShell* mpDocShell;
SdDrawDocument* mpDocument;
+ ::tools::Rectangle maLOKVisibleArea;
/** Determine from the properties of the document shell the initial type
of the view shell in the center pane. We use this method to avoid
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 4f4ba44e170e..483dca72f73a 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -255,6 +255,8 @@ public:
virtual void setGraphicSelection(int nType, int nX, int nY) override;
/// @see lok::Document::resetSelection().
virtual void resetSelection() override;
+ /// @see vcl::ITiledRenderable::setClientVisibleArea().
+ virtual void setClientVisibleArea(const tools::Rectangle& rRectangle) override;
/// @see vcl::ITiledRenderable::setClipboard().
virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override;
/// @see vcl::ITiledRenderable::isMimeTypeSupported().
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5321e17f900e..b325c3c9e201 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2619,6 +2619,17 @@ void SdXImpressDocument::resetSelection()
pSdrView->UnmarkAll();
}
+void SdXImpressDocument::setClientVisibleArea(const ::tools::Rectangle& rRectangle)
+{
+ SolarMutexGuard aGuard;
+
+ DrawViewShell* pViewShell = GetViewShell();
+ if (!pViewShell)
+ return;
+
+ pViewShell->GetViewShellBase().setLOKVisibleArea(rRectangle);
+}
+
void SdXImpressDocument::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
{
SolarMutexGuard aGuard;
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 416791cc0590..b34199ba292f 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -20,16 +20,19 @@
#include <com/sun/star/text/WritingMode.hpp>
+#include <comphelper/lok.hxx>
+
#include <vcl/toolbox.hxx>
#include <vcl/virdev.hxx>
+#include <sfx2/viewsh.hxx>
+
#include <svl/itempool.hxx>
#include <svtools/toolbarmenu.hxx>
#include <svtools/popupwindowcontroller.hxx>
#include <svx/fmmodel.hxx>
-#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
#include <svx/svdpage.hxx>
#include <svx/svdobj.hxx>
@@ -38,6 +41,8 @@
#include <svx/gallery.hxx>
#include <svx/fontworkgallery.hxx>
+#include <tools/UnitConversion.hxx>
+
#include <algorithm>
#include <memory>
@@ -193,17 +198,41 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
// pNewObject->SetPage(nullptr);
tools::Rectangle aObjRect( pNewObject->GetLogicRect() );
- tools::Rectangle aVisArea = pOutDev->PixelToLogic(tools::Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
- Point aPagePos = aVisArea.Center();
- bool bIsInsertedObjectSmallerThanVisibleArea =
- aVisArea.GetSize().getHeight() > aObjRect.GetSize().getHeight() &&
- aVisArea.GetSize().getWidth() > aObjRect.GetSize().getWidth();
- if (bIsInsertedObjectSmallerThanVisibleArea)
+ Point aPagePos;
+ Size aFontworkSize = aObjRect.GetSize();
+
+ if (comphelper::LibreOfficeKit::isActive())
{
- aPagePos.AdjustX( -(aObjRect.GetWidth() / 2) );
- aPagePos.AdjustY( -(aObjRect.GetHeight() / 2) );
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+
+ aPagePos = pViewShell->getLOKVisibleArea().Center();
+
+ aPagePos.setX(convertTwipToMm100(aPagePos.X()));
+ aPagePos.setY(convertTwipToMm100(aPagePos.Y()));
+
+ sal_Int32 nLOKViewWidth = 0.8 * convertTwipToMm100(pViewShell->getLOKVisibleArea().getWidth());
+ if (aFontworkSize.getWidth() > nLOKViewWidth)
+ {
+ double fScale = static_cast<double>(aFontworkSize.getWidth()) / nLOKViewWidth;
+ aFontworkSize.setWidth(aFontworkSize.getWidth() / fScale);
+ aFontworkSize.setHeight(aFontworkSize.getHeight() / fScale);
+ }
}
- tools::Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize());
+ else
+ {
+ Size aSize = pOutDev->GetOutputSizePixel();
+ tools::Rectangle aPixelVisRect(Point(0,0), aSize);
+ tools::Rectangle aVisArea = pOutDev->PixelToLogic(aPixelVisRect);
+
+ aPagePos = aVisArea.Center();
+ }
+
+ if (aPagePos.getX() > aFontworkSize.getWidth() / 2)
+ aPagePos.AdjustX( -(aFontworkSize.getWidth() / 2) );
+ if (aPagePos.getY() > aFontworkSize.getHeight() / 2)
+ aPagePos.AdjustY( -(aFontworkSize.getHeight() / 2) );
+
+ tools::Rectangle aNewObjectRectangle(aPagePos, aFontworkSize);
pNewObject->SetLogicRect(aNewObjectRectangle);
if (bUseSpecialCalcMode)
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 0cf34eccc881..57c41b4a7971 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -680,6 +680,8 @@ public:
void SetOldFrameCat(const OUString& sStr);
const OUString& GetOldDrwCat();
void SetOldDrwCat(const OUString& sStr);
+
+ virtual tools::Rectangle getLOKVisibleArea() const override;
};
inline tools::Long SwView::GetXScroll() const
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 9dd7b932de0b..1bc3afaba83a 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1895,6 +1895,15 @@ void SwView::AddTransferable(SwTransferable& rTransferable)
GetViewImpl()->AddTransferable(rTransferable);
}
+tools::Rectangle SwView::getLOKVisibleArea() const
+{
+ SwViewShell* pVwSh = GetWrtShellPtr();
+ if (pVwSh)
+ return pVwSh->getLOKVisibleArea();
+ else
+ return tools::Rectangle();
+}
+
OUString SwView::GetDataSourceName() const
{
uno::Reference<lang::XMultiServiceFactory> xFactory(GetDocShell()->GetModel(), uno::UNO_QUERY);
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 219d4bbf52c8..b23fb93ed520 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -159,10 +159,9 @@ void SwView::ExecDraw(SfxRequest& rReq)
if ( pObj )
{
Size aDocSize( m_pWrtShell->GetDocSize() );
- const SwRect& rVisArea = m_pWrtShell->VisArea();
+ const SwRect& rVisArea = comphelper::LibreOfficeKit::isActive() ?
+ m_pWrtShell->getLOKVisibleArea() : m_pWrtShell->VisArea();
Point aPos( rVisArea.Center() );
- Size aSize;
- Size aPrefSize( pObj->GetSnapRect().GetSize() );
if( rVisArea.Width() > aDocSize.Width())
aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
@@ -170,10 +169,11 @@ void SwView::ExecDraw(SfxRequest& rReq)
if(rVisArea.Height() > aDocSize.Height())
aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
- if( aPrefSize.Width() && aPrefSize.Height() )
- aSize = rWin2.PixelToLogic(aPrefSize, MapMode(MapUnit::MapTwip));
- else
- aSize = Size( 2835, 2835 );
+ tools::Rectangle aObjRect( pObj->GetLogicRect() );
+ if (aPos.getX() > aObjRect.GetWidth() / 2)
+ aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
+ if (aPos.getY() > aObjRect.GetHeight() / 2)
+ aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
m_pWrtShell->EnterStdMode();
m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
commit d5594a306e884e4c4700bdb28e48349445de2810
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Feb 8 12:37:38 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:00:46 2021 +0200
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 at collabora.com>
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 159b1dccd730..713afaff9082 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -59,6 +59,7 @@ public:
namespace jsdialog
{
VCL_DLLPUBLIC bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rData);
+VCL_DLLPUBLIC void SendFullUpdate(sal_uInt64 nWindowId, const OString& rWidget);
VCL_DLLPUBLIC StringMap jsonToStringMap(const char* pJSON);
};
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index c61c52cf7840..e33c0b891360 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -297,15 +297,8 @@ void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos)
mxMenu->select(*mxScratchIter);
rSubMenuControl.GrabFocus();
- // TODO: something better to retrigger JSON dialog invalidation
if (comphelper::LibreOfficeKit::isActive())
- {
- StringMap args;
- args["cmd"] = "change";
- args["type"] = "checkbox";
- args["data"] = "true";
- jsdialog::ExecuteAction(pSubMenu->GetLOKWindowId(), "toggle_all", args);
- }
+ jsdialog::SendFullUpdate(pSubMenu->GetLOKWindowId(), "toggle_all");
}
IMPL_LINK_NOARG(ScCheckListMenuControl, PostPopdownHdl, void*, void)
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index db25a8322891..190d1bb33465 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 145481955d43..409c77a5d126 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 4038e009d017..da0537893a35 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)
commit 87b986a7bfc315036d146f607942db8598073125
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jan 25 15:04:17 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:00:34 2021 +0200
jsdialog: missing method for treeview
Change-Id: Ice358bb9d79cc0e257e03fba4ef9df1397284158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109971
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111840
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 267dc960ecd9..db25a8322891 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -431,6 +431,7 @@ public:
using SalInstanceTreeView::set_toggle;
/// pos is used differently here, it defines how many steps of iterator we need to perform to take entry
virtual void set_toggle(int pos, TriState eState, int col = -1) override;
+ virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override;
using SalInstanceTreeView::select;
/// pos is used differently here, it defines how many steps of iterator we need to perform to take entry
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 9fd33ae26b3a..4038e009d017 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -991,6 +991,12 @@ void JSTreeView::set_toggle(int pos, TriState eState, int col)
}
}
+void JSTreeView::set_toggle(const weld::TreeIter& rIter, TriState bOn, int col)
+{
+ SalInstanceTreeView::set_toggle(rIter, bOn, col);
+ sendUpdate();
+}
+
void JSTreeView::select(int pos)
{
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
commit ea0879d963ed77e1d737742ec358e294a800830b
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Jan 15 11:38:50 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:00:09 2021 +0200
jsdialog: partial updates for more widgets
+ DrawingArea
+ Combobox
+ Listbox
+ RadioButton
+ Expander
+ IconView
+ Entry
+ TextView
+ SpinField
Change-Id: Ic1fdc8ae37216089d0ba18191ff12895c1f5e84e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109367
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index aa9de490c249..267dc960ecd9 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -88,7 +88,7 @@ public:
virtual void sendFullUpdate(bool bForce = false);
void sendClose();
- virtual void sendUpdate(VclPtr<vcl::Window> pWindow);
+ virtual void sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce = false);
void flush() { mpIdleNotify->Invoke(); }
protected:
@@ -278,10 +278,10 @@ public:
m_pSender->sendClose();
}
- void sendUpdate()
+ void sendUpdate(bool bForce = false)
{
if (!m_bIsFreezed && m_pSender)
- m_pSender->sendUpdate(BaseInstanceClass::m_xWidget);
+ m_pSender->sendUpdate(BaseInstanceClass::m_xWidget, bForce);
}
void sendFullUpdate(bool bForce = false)
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 658ee5ae18d6..9fd33ae26b3a 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -182,8 +182,11 @@ void JSDialogSender::sendClose()
flush();
}
-void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow)
+void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce)
{
+ if (bForce)
+ mpIdleNotify->forceUpdate();
+
mpIdleNotify->sendMessage(jsdialog::MessageType::WidgetUpdate, pWindow);
mpIdleNotify->Start();
}
@@ -772,7 +775,7 @@ JSEntry::JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pB
void JSEntry::set_text(const OUString& rText)
{
SalInstanceEntry::set_text(rText);
- sendFullUpdate();
+ sendUpdate();
}
void JSEntry::set_text_without_notify(const OUString& rText) { SalInstanceEntry::set_text(rText); }
@@ -788,19 +791,19 @@ void JSListBox::insert(int pos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface)
{
SalInstanceComboBoxWithoutEdit::insert(pos, rStr, pId, pIconName, pImageSurface);
- sendFullUpdate();
+ sendUpdate();
}
void JSListBox::remove(int pos)
{
SalInstanceComboBoxWithoutEdit::remove(pos);
- sendFullUpdate();
+ sendUpdate();
}
void JSListBox::set_active(int pos)
{
SalInstanceComboBoxWithoutEdit::set_active(pos);
- sendFullUpdate();
+ sendUpdate();
}
JSComboBox::JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
@@ -814,25 +817,25 @@ void JSComboBox::insert(int pos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface)
{
SalInstanceComboBoxWithEdit::insert(pos, rStr, pId, pIconName, pImageSurface);
- sendFullUpdate();
+ sendUpdate();
}
void JSComboBox::remove(int pos)
{
SalInstanceComboBoxWithEdit::remove(pos);
- sendFullUpdate();
+ sendUpdate();
}
void JSComboBox::set_entry_text(const OUString& rText)
{
SalInstanceComboBoxWithEdit::set_entry_text(rText);
- sendFullUpdate();
+ sendUpdate();
}
void JSComboBox::set_active(int pos)
{
SalInstanceComboBoxWithEdit::set_active(pos);
- sendFullUpdate();
+ sendUpdate();
}
JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,
@@ -884,7 +887,7 @@ JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
void JSSpinButton::set_value(int value)
{
SalInstanceSpinButton::set_value(value);
- sendFullUpdate(true); // if input is limited we can receive the same JSON
+ sendUpdate(true); // if input is limited we can receive the same JSON
}
JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog,
@@ -924,7 +927,7 @@ JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
void JSCheckButton::set_active(bool active)
{
SalInstanceCheckButton::set_active(active);
- sendFullUpdate();
+ sendUpdate();
}
JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
@@ -938,13 +941,13 @@ JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingAr
void JSDrawingArea::queue_draw()
{
SalInstanceDrawingArea::queue_draw();
- sendFullUpdate();
+ sendUpdate();
}
void JSDrawingArea::queue_draw_area(int x, int y, int width, int height)
{
SalInstanceDrawingArea::queue_draw_area(x, y, width, height);
- sendFullUpdate();
+ sendUpdate();
}
JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
@@ -963,7 +966,7 @@ JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
void JSTextView::set_text(const OUString& rText)
{
SalInstanceTextView::set_text(rText);
- sendFullUpdate();
+ sendUpdate();
}
JSTreeView::JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTreeView,
@@ -1081,7 +1084,7 @@ JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander,
void JSExpander::set_expanded(bool bExpand)
{
SalInstanceExpander::set_expanded(bExpand);
- sendFullUpdate();
+ sendUpdate();
}
JSIconView::JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
@@ -1094,32 +1097,32 @@ void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, weld::TreeIter* pRet)
{
SalInstanceIconView::insert(pos, pStr, pId, pIconName, pRet);
- sendFullUpdate();
+ sendUpdate();
}
void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
const VirtualDevice* pIcon, weld::TreeIter* pRet)
{
SalInstanceIconView::insert(pos, pStr, pId, pIcon, pRet);
- sendFullUpdate();
+ sendUpdate();
}
void JSIconView::clear()
{
SalInstanceIconView::clear();
- sendFullUpdate();
+ sendUpdate();
}
void JSIconView::select(int pos)
{
SalInstanceIconView::select(pos);
- sendFullUpdate();
+ sendUpdate();
}
void JSIconView::unselect(int pos)
{
SalInstanceIconView::unselect(pos);
- sendFullUpdate();
+ sendUpdate();
}
JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
@@ -1132,7 +1135,7 @@ JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButto
void JSRadioButton::set_active(bool active)
{
SalInstanceRadioButton::set_active(active);
- sendFullUpdate();
+ sendUpdate();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
commit 37c9e0acd5ae72231b6c4c222e46e10ff7b9a0fb
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 14:08:35 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:59:56 2021 +0200
jsdialog: enqueue update on dialog weld
Change-Id: I01f14cdf0aa3ea16cd311aed9abe14423e2ec846
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109727
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 836c73f3edea..658ee5ae18d6 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -484,16 +484,8 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id)
RememberWidget("__DIALOG__", pRet.get());
- const vcl::ILibreOfficeKitNotifier* pNotifier = pDialog->GetLOKNotifier();
- if (pNotifier)
- {
- tools::JsonWriter aJsonWriter;
- m_aOwnedToplevel->DumpAsPropertyTree(aJsonWriter);
- aJsonWriter.put("id", m_aOwnedToplevel->GetLOKWindowId());
- pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aJsonWriter.extractData());
- }
-
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
+ sendFullUpdate();
}
return pRet;
commit 29ff600b3973a3576cf6a1a1d0acad668c6c3bf3
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 20 17:48:18 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:59:44 2021 +0200
jsdialog: don't send multiple updates with the same content
Change-Id: I601511a85386a8a35cbc6a121a4719928f585794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109726
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e8c8ff4d4232..836c73f3edea 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -68,6 +68,18 @@ void JSDialogNotifyIdle::send(tools::JsonWriter& aJsonWriter)
void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow)
{
+ // we want only the latest update of same type
+ // TODO: also if we met full update - previous updates are not valid
+ auto it = m_aMessageQueue.begin();
+
+ while (it != m_aMessageQueue.end())
+ {
+ if (it->first == eType && it->second == pWindow)
+ it = m_aMessageQueue.erase(it);
+ else
+ it++;
+ }
+
m_aMessageQueue.push_back(std::make_pair(eType, pWindow));
}
commit 35be0bd997b194de1af6df0767a12db7a8590aad
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 17:06:22 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:59:29 2021 +0200
jsdialog: reduce number of unnecessary messages
Change-Id: I8dfa464a39931a12dd2ecf91fc48f4812d75301b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109645
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 137659e9b217..aa9de490c249 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -246,8 +246,10 @@ public:
using BaseInstanceClass::set_sensitive;
virtual void set_sensitive(bool sensitive) override
{
+ bool bIsSensitive = BaseInstanceClass::get_sensitive();
BaseInstanceClass::set_sensitive(sensitive);
- sendUpdate();
+ if (bIsSensitive != sensitive)
+ sendUpdate();
}
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override
commit 4fbdc8f0f5f5710010d7820d3215296eb5734e9f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 15:55:29 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:59:17 2021 +0200
jsdialog: flush message queue on dialog close
Change-Id: I9e7d24e43a7ee7bf1a006c8d16e7b47a6b714fd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109644
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 0c274868c716..137659e9b217 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -89,6 +89,7 @@ public:
virtual void sendFullUpdate(bool bForce = false);
void sendClose();
virtual void sendUpdate(VclPtr<vcl::Window> pWindow);
+ void flush() { mpIdleNotify->Invoke(); }
protected:
void initializeSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 98eb4fbdeb3a..e8c8ff4d4232 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -167,7 +167,7 @@ void JSDialogSender::sendFullUpdate(bool bForce)
void JSDialogSender::sendClose()
{
mpIdleNotify->sendMessage(jsdialog::MessageType::Close, nullptr);
- mpIdleNotify->Start();
+ flush();
}
void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow)
commit 110aa29fc688eab8193bb92c6fc7d5ce470d721c
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 14:20:51 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:59:07 2021 +0200
jsdialog: remove unnecessary handler
Change-Id: I4e4d032c73fc090f443dcc7bef0267e1df123810
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109643
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index b38ba2914462..29f671940c85 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2237,7 +2237,7 @@ protected:
friend class ::LOKTrigger;
- virtual void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); }
+ void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); }
void signal_toggle_menu(const OString& rIdent) { m_aToggleMenuHdl.Call(rIdent); }
public:
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index bf35c54609cf..0c274868c716 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -409,8 +409,6 @@ class JSToolbar : public JSWidget<SalInstanceToolbar, ::ToolBox>
public:
JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
bool bTakeOwnership);
-
- virtual void signal_clicked(const OString& rIdent) override;
};
class JSTextView : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e40e098b74e0..98eb4fbdeb3a 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -949,12 +949,6 @@ JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBu
{
}
-void JSToolbar::signal_clicked(const OString& rIdent)
-{
- SalInstanceToolbar::signal_clicked(rIdent);
- sendFullUpdate();
-}
-
JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(pSender, pTextView, pBuilder,
commit cc19e24c2d4a0120d8ff43355eefe91bf03826bf
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 12:09:45 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:58:53 2021 +0200
jsdialog: send updates also for source treeview on drag
+ simplify updates
+ unify naming
Change-Id: Iebdaae3d910ef2cba0c818aa17d407e39f62a5e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109635
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index b638ac01a417..bf35c54609cf 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -86,7 +86,7 @@ public:
virtual ~JSDialogSender() = default;
- virtual void notifyDialogState(bool bForce = false);
+ virtual void sendFullUpdate(bool bForce = false);
void sendClose();
virtual void sendUpdate(VclPtr<vcl::Window> pWindow);
@@ -233,20 +233,20 @@ public:
virtual void show() override
{
BaseInstanceClass::show();
- notifyDialogState();
+ sendFullUpdate();
}
virtual void hide() override
{
BaseInstanceClass::hide();
- notifyDialogState();
+ sendFullUpdate();
}
using BaseInstanceClass::set_sensitive;
virtual void set_sensitive(bool sensitive) override
{
BaseInstanceClass::set_sensitive(sensitive);
- sendUpdate(BaseInstanceClass::m_xWidget);
+ sendUpdate();
}
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override
@@ -275,16 +275,16 @@ public:
m_pSender->sendClose();
}
- void sendUpdate(VclPtr<vcl::Window> pWindow)
+ void sendUpdate()
{
if (!m_bIsFreezed && m_pSender)
- m_pSender->sendUpdate(pWindow);
+ m_pSender->sendUpdate(BaseInstanceClass::m_xWidget);
}
- void notifyDialogState(bool bForce = false)
+ void sendFullUpdate(bool bForce = false)
{
if ((!m_bIsFreezed || bForce) && m_pSender)
- m_pSender->notifyDialogState(bForce);
+ m_pSender->sendFullUpdate(bForce);
}
};
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 0c57aaf4fa44..e40e098b74e0 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -155,7 +155,7 @@ void JSDialogNotifyIdle::Invoke()
m_aMessageQueue.clear();
}
-void JSDialogSender::notifyDialogState(bool bForce)
+void JSDialogSender::sendFullUpdate(bool bForce)
{
if (bForce)
mpIdleNotify->forceUpdate();
@@ -726,13 +726,13 @@ JSDialog::JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilde
void JSDialog::collapse(weld::Widget* pEdit, weld::Widget* pButton)
{
SalInstanceDialog::collapse(pEdit, pButton);
- notifyDialogState();
+ sendFullUpdate();
}
void JSDialog::undo_collapse()
{
SalInstanceDialog::undo_collapse();
- notifyDialogState();
+ sendFullUpdate();
}
void JSDialog::response(int response)
@@ -750,7 +750,7 @@ JSLabel::JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder*
void JSLabel::set_label(const OUString& rText)
{
SalInstanceLabel::set_label(rText);
- sendUpdate(m_xWidget);
+ sendUpdate();
};
JSButton::JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
@@ -768,7 +768,7 @@ JSEntry::JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pB
void JSEntry::set_text(const OUString& rText)
{
SalInstanceEntry::set_text(rText);
- notifyDialogState();
+ sendFullUpdate();
}
void JSEntry::set_text_without_notify(const OUString& rText) { SalInstanceEntry::set_text(rText); }
@@ -784,19 +784,19 @@ void JSListBox::insert(int pos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface)
{
SalInstanceComboBoxWithoutEdit::insert(pos, rStr, pId, pIconName, pImageSurface);
- notifyDialogState();
+ sendFullUpdate();
}
void JSListBox::remove(int pos)
{
SalInstanceComboBoxWithoutEdit::remove(pos);
- notifyDialogState();
+ sendFullUpdate();
}
void JSListBox::set_active(int pos)
{
SalInstanceComboBoxWithoutEdit::set_active(pos);
- notifyDialogState();
+ sendFullUpdate();
}
JSComboBox::JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
@@ -810,25 +810,25 @@ void JSComboBox::insert(int pos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface)
{
SalInstanceComboBoxWithEdit::insert(pos, rStr, pId, pIconName, pImageSurface);
- notifyDialogState();
+ sendFullUpdate();
}
void JSComboBox::remove(int pos)
{
SalInstanceComboBoxWithEdit::remove(pos);
- notifyDialogState();
+ sendFullUpdate();
}
void JSComboBox::set_entry_text(const OUString& rText)
{
SalInstanceComboBoxWithEdit::set_entry_text(rText);
- notifyDialogState();
+ sendFullUpdate();
}
void JSComboBox::set_active(int pos)
{
SalInstanceComboBoxWithEdit::set_active(pos);
- notifyDialogState();
+ sendFullUpdate();
}
JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,
@@ -845,7 +845,7 @@ void JSNotebook::set_current_page(int nPage)
bForce = true;
SalInstanceNotebook::set_current_page(nPage);
- notifyDialogState(bForce);
+ sendFullUpdate(bForce);
}
void JSNotebook::set_current_page(const OString& rIdent)
@@ -856,19 +856,19 @@ void JSNotebook::set_current_page(const OString& rIdent)
bForce = true;
SalInstanceNotebook::set_current_page(rIdent);
- notifyDialogState(bForce);
+ sendFullUpdate(bForce);
}
void JSNotebook::remove_page(const OString& rIdent)
{
SalInstanceNotebook::remove_page(rIdent);
- notifyDialogState();
+ sendFullUpdate();
}
void JSNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int nPos)
{
SalInstanceNotebook::insert_page(rIdent, rLabel, nPos);
- notifyDialogState();
+ sendFullUpdate();
}
JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
@@ -880,7 +880,7 @@ JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
void JSSpinButton::set_value(int value)
{
SalInstanceSpinButton::set_value(value);
- notifyDialogState(true); // if input is limited we can receive the same JSON
+ sendFullUpdate(true); // if input is limited we can receive the same JSON
}
JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog,
@@ -902,13 +902,13 @@ JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* p
void JSMessageDialog::set_primary_text(const OUString& rText)
{
SalInstanceMessageDialog::set_primary_text(rText);
- notifyDialogState();
+ sendFullUpdate();
}
void JSMessageDialog::set_secondary_text(const OUString& rText)
{
SalInstanceMessageDialog::set_secondary_text(rText);
- notifyDialogState();
+ sendFullUpdate();
}
JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
@@ -920,7 +920,7 @@ JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
void JSCheckButton::set_active(bool active)
{
SalInstanceCheckButton::set_active(active);
- notifyDialogState();
+ sendFullUpdate();
}
JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
@@ -934,13 +934,13 @@ JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingAr
void JSDrawingArea::queue_draw()
{
SalInstanceDrawingArea::queue_draw();
- notifyDialogState();
+ sendFullUpdate();
}
void JSDrawingArea::queue_draw_area(int x, int y, int width, int height)
{
SalInstanceDrawingArea::queue_draw_area(x, y, width, height);
- notifyDialogState();
+ sendFullUpdate();
}
JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
@@ -952,7 +952,7 @@ JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBu
void JSToolbar::signal_clicked(const OString& rIdent)
{
SalInstanceToolbar::signal_clicked(rIdent);
- notifyDialogState();
+ sendFullUpdate();
}
JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
@@ -965,7 +965,7 @@ JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
void JSTextView::set_text(const OUString& rText)
{
SalInstanceTextView::set_text(rText);
- notifyDialogState();
+ sendFullUpdate();
}
JSTreeView::JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTreeView,
@@ -986,7 +986,7 @@ void JSTreeView::set_toggle(int pos, TriState eState, int col)
SalInstanceTreeView::set_toggle(pEntry, eState, col);
signal_toggled(iter_col(SalInstanceTreeIter(pEntry), col));
- sendUpdate(m_xTreeView);
+ sendUpdate();
}
}
@@ -1032,7 +1032,9 @@ void JSTreeView::drag_end()
m_xDropTarget->fire_drop(aEvent);
- sendUpdate(m_xTreeView);
+ sendUpdate();
+ if (g_DragSource)
+ g_DragSource->sendUpdate();
}
g_DragSource = nullptr;
@@ -1045,31 +1047,31 @@ void JSTreeView::insert(const weld::TreeIter* pParent, int pos, const OUString*
SalInstanceTreeView::insert(pParent, pos, pStr, pId, pIconName, pImageSurface,
bChildrenOnDemand, pRet);
- sendUpdate(m_xTreeView);
+ sendUpdate();
}
void JSTreeView::set_text(int row, const OUString& rText, int col)
{
SalInstanceTreeView::set_text(row, rText, col);
- sendUpdate(m_xTreeView);
+ sendUpdate();
}
void JSTreeView::set_text(const weld::TreeIter& rIter, const OUString& rStr, int col)
{
SalInstanceTreeView::set_text(rIter, rStr, col);
- sendUpdate(m_xTreeView);
+ sendUpdate();
}
void JSTreeView::expand_row(const weld::TreeIter& rIter)
{
SalInstanceTreeView::expand_row(rIter);
- sendUpdate(m_xTreeView);
+ sendUpdate();
}
void JSTreeView::collapse_row(const weld::TreeIter& rIter)
{
SalInstanceTreeView::collapse_row(rIter);
- sendUpdate(m_xTreeView);
+ sendUpdate();
}
JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander,
@@ -1081,7 +1083,7 @@ JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander,
void JSExpander::set_expanded(bool bExpand)
{
SalInstanceExpander::set_expanded(bExpand);
- notifyDialogState();
+ sendFullUpdate();
}
JSIconView::JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
@@ -1094,32 +1096,32 @@ void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, weld::TreeIter* pRet)
{
SalInstanceIconView::insert(pos, pStr, pId, pIconName, pRet);
- notifyDialogState();
+ sendFullUpdate();
}
void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
const VirtualDevice* pIcon, weld::TreeIter* pRet)
{
SalInstanceIconView::insert(pos, pStr, pId, pIcon, pRet);
- notifyDialogState();
+ sendFullUpdate();
}
void JSIconView::clear()
{
SalInstanceIconView::clear();
- notifyDialogState();
+ sendFullUpdate();
}
void JSIconView::select(int pos)
{
SalInstanceIconView::select(pos);
- notifyDialogState();
+ sendFullUpdate();
}
void JSIconView::unselect(int pos)
{
SalInstanceIconView::unselect(pos);
- notifyDialogState();
+ sendFullUpdate();
}
JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
@@ -1132,7 +1134,7 @@ JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButto
void JSRadioButton::set_active(bool active)
{
SalInstanceRadioButton::set_active(active);
- notifyDialogState();
+ sendFullUpdate();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
commit 5a1c70b6e8c706c8f0d80d48cd3365ea2f760436
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 08:39:15 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 20:58:43 2021 +0200
jsdialog: set entry text without back notification
We don't want to disturb user while editing the text
Change-Id: I8a8b9a688133d27fc2aeaee6178a773641f4a79f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109612
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index cefa5776c79b..b638ac01a417 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -246,7 +246,7 @@ public:
virtual void set_sensitive(bool sensitive) override
{
BaseInstanceClass::set_sensitive(sensitive);
- notifyDialogState();
+ sendUpdate(BaseInstanceClass::m_xWidget);
}
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override
@@ -320,6 +320,7 @@ public:
JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
bool bTakeOwnership);
virtual void set_text(const OUString& rText) override;
+ void set_text_without_notify(const OUString& rText);
};
class JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 53f5ec56013b..145481955d43 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -183,12 +183,12 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
}
else if (sControlType == "edit")
{
- auto pEdit = dynamic_cast<weld::Entry*>(pWidget);
+ auto pEdit = dynamic_cast<JSEntry*>(pWidget);
if (pEdit)
{
if (sAction == "change")
{
- pEdit->set_text(rData["data"]);
+ pEdit->set_text_without_notify(rData["data"]);
LOKTrigger::trigger_changed(*pEdit);
return true;
}
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 38ef2a44e354..0c57aaf4fa44 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -750,7 +750,7 @@ JSLabel::JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder*
void JSLabel::set_label(const OUString& rText)
{
SalInstanceLabel::set_label(rText);
- notifyDialogState();
+ sendUpdate(m_xWidget);
};
JSButton::JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
@@ -771,6 +771,8 @@ void JSEntry::set_text(const OUString& rText)
notifyDialogState();
}
+void JSEntry::set_text_without_notify(const OUString& rText) { SalInstanceEntry::set_text(rText); }
+
JSListBox::JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
bool bTakeOwnership)
: JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>(pSender, pListBox, pBuilder,
commit f30b8ead84b263b23b38bef87698b84ea6ba56fc
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list