[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/sfx2 include/vcl sc/source sd/source sfx2/source svx/source sw/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 11 10:14:01 UTC 2019
include/sfx2/lokhelper.hxx | 2 +-
include/sfx2/viewsh.hxx | 1 -
include/vcl/IDialogRenderable.hxx | 1 -
sc/source/ui/drawfunc/drawsh2.cxx | 4 ----
sd/source/ui/view/drviewsf.cxx | 4 ----
sfx2/source/control/unoctitm.cxx | 4 ++++
sfx2/source/view/lokhelper.cxx | 31 ++++++++++---------------------
sfx2/source/view/viewsh.cxx | 5 -----
svx/source/svdraw/svdedtv1.cxx | 4 ----
svx/source/tbxctrls/grafctrl.cxx | 4 ----
sw/source/uibase/shells/drawdlg.cxx | 4 ----
sw/source/uibase/shells/grfsh.cxx | 4 ----
sw/source/uibase/shells/txtattr.cxx | 4 ----
sw/source/uibase/uiview/viewtab.cxx | 4 ----
14 files changed, 15 insertions(+), 61 deletions(-)
New commits:
commit 23c8830da611d14dbffc2022efac28203352f6b9
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Dec 10 15:16:32 2019 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Dec 11 11:13:17 2019 +0100
jsdialog: send items on status change
Use existing mechanism, delete sending in getter code
which caused unnecessary work.
Change-Id: Ibc191c16b95fd58e7065e019f48f3837cfed5bbd
Reviewed-on: https://gerrit.libreoffice.org/84888
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 697840ff035b..8dbd43277ff1 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -44,7 +44,7 @@ public:
/// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload);
/// Emits a LOK_CALLBACK_STATE_CHANGED
- static void sendUnoStatus(const SfxViewShell* pThisView, const SfxItemSet* pSet);
+ static void sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem);
/// Emits a LOK_CALLBACK_WINDOW
static void notifyWindow(const SfxViewShell* pThisView,
vcl::LOKWindowId nWindowId,
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 599aedf2cb53..0f6915d8a9c0 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -224,7 +224,6 @@ public:
virtual const SfxShell* GetFormShell() const { return nullptr; };
// ILibreOfficeKitNotifier
- virtual void sendUnoStatus(const SfxItemSet* pSet) const override;
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
// Focus, KeyInput, Cursor
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index 963fd4998182..edf83a50123b 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -33,7 +33,6 @@ public:
virtual ~ILibreOfficeKitNotifier() {}
/// Callbacks
- virtual void sendUnoStatus(const SfxItemSet* pSet) const = 0;
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
const OUString& rAction,
const std::vector<LOKPayloadItem>& rPayload = std::vector<LOKPayloadItem>()) const = 0;
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 852f1931d64a..952ca461d9f9 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -365,10 +365,6 @@ void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
}
}
-
- SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
}
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 6e00a5256646..a0f5909d5c36 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -703,10 +703,6 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
}
nWhich = aNewIter.NextWhich();
}
-
- SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index c308a15bb53d..7b8d6d101df8 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -66,6 +66,7 @@
#include <rtl/ustring.hxx>
#include <unotools/pathoptions.hxx>
#include <osl/time.h>
+#include <sfx2/lokhelper.hxx>
#include <iostream>
#include <map>
@@ -1206,6 +1207,9 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
}
else
{
+ // Try to send JSON state version
+ SfxLokHelper::sendUnoStatus(SfxViewShell::Current(), pState);
+
return;
}
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 65f8e5090972..5802a9b96ad8 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -235,34 +235,23 @@ namespace {
}
}
-void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* pSet)
+void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem)
{
- if (!pShell || !pSet || DisableCallbacks::disabled())
+ if (!pShell || !pItem || DisableCallbacks::disabled())
return;
- boost::property_tree::ptree aTree;
- boost::property_tree::ptree anArray;
+ boost::property_tree::ptree aItem = pItem->dumpAsJSON();
- for(int i = 0; i < pSet->Count(); i++)
+ if (aItem.count("state"))
{
- sal_uInt16 nWhich = pSet->GetWhichByPos(i);
- if (pSet->HasItem(nWhich) && SfxItemState::SET >= pSet->GetItemState(nWhich))
- {
- boost::property_tree::ptree aItem = pSet->Get(nWhich).dumpAsJSON();
-
- OUString sCommand = lcl_getNameForSlot(pShell, nWhich);
- if (!sCommand.isEmpty())
- aItem.put("commandName", sCommand);
+ OUString sCommand = lcl_getNameForSlot(pShell, pItem->Which());
+ if (!sCommand.isEmpty())
+ aItem.put("commandName", sCommand);
- if (!aItem.empty())
- anArray.push_back(std::make_pair("", aItem));
- }
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aItem);
+ pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str());
}
- aTree.add_child("items", anArray);
-
- std::stringstream aStream;
- boost::property_tree::write_json(aStream, aTree);
- pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str());
}
void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView,
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 7e2ec6369e58..bc32de20a9e6 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2000,11 +2000,6 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable()
return xRender;
}
-void SfxViewShell::sendUnoStatus(const SfxItemSet* pSet) const
-{
- SfxLokHelper::sendUnoStatus(this, pSet);
-}
-
void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const
{
SfxLokHelper::notifyWindow(this, nDialogId, rAction, rPayload);
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 4284993d6ae8..50fb97118ee3 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -905,10 +905,6 @@ SfxItemSet SdrEditView::GetAttrFromMarked(bool bOnlyHardAttr) const
aSet.ClearItem(EE_FEATURE_NOTCONV);
aSet.ClearItem(EE_FEATURE_FIELD);
- SfxViewShell* pViewShell = SfxViewShell::Current();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &aSet );
-
return aSet;
}
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index ced4d4c2bc32..b83ea5028f95 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -1013,10 +1013,6 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView const & rVie
nWhich = aIter.NextWhich();
}
-
- SfxViewShell* pViewShell = SfxViewShell::Current();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 4ef0bfafc67f..8b42f0ebb732 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -333,10 +333,6 @@ void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
}
else
rSet.Put(pSdrView->GetDefaultAttr());
-
- SfxViewShell* pViewShell = GetShell().GetSfxViewShell();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index c1c837d0808f..c7435228725e 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -923,10 +923,6 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
nWhich = aIter.NextWhich();
}
SetGetStateSet( nullptr );
-
- SfxViewShell* pViewShell = GetShell().GetSfxViewShell();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
void SwGrfShell::ExecuteRotation(SfxRequest const &rReq)
diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx
index 5af84af21eff..00de00c41422 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -816,10 +816,6 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
}
rSet.Put(aCoreSet,false);
-
- SfxViewShell* pViewShell = SfxViewShell::Current();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index befdddd48c0a..d9b61426b9e1 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -2424,10 +2424,6 @@ void SwView::StateTabWin(SfxItemSet& rSet)
}
nWhich = aIter.NextWhich();
}
-
- SfxViewShell* pViewShell = SfxViewShell::Current();
- if (pViewShell && comphelper::LibreOfficeKit::isActive())
- pViewShell->sendUnoStatus( &rSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list