[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 15 commits - editeng/source include/editeng include/sfx2 include/svl include/svx include/vcl sc/source sd/source sfx2/source solenv/sanitizers svl/source svx/sdi svx/source svx/uiconfig sw/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 13 17:53:38 UTC 2020
editeng/source/items/frmitems.cxx | 51 ++++++
include/editeng/lrspitem.hxx | 2
include/editeng/ulspitem.hxx | 2
include/sfx2/lokhelper.hxx | 2
include/svl/intitem.hxx | 6
include/svl/poolitem.hxx | 2
include/svx/colorbox.hxx | 2
include/svx/svxids.hrc | 1
include/svx/xfillit0.hxx | 1
include/svx/xflftrit.hxx | 3
include/svx/xflgrit.hxx | 2
include/svx/xgrad.hxx | 6
include/vcl/IDialogRenderable.hxx | 2
sc/source/ui/drawfunc/drawsh.cxx | 11 +
sc/source/ui/drawfunc/drawsh2.cxx | 56 -------
sd/source/ui/view/drtxtob.cxx | 47 -----
sd/source/ui/view/drviews2.cxx | 11 +
sd/source/ui/view/drviewsf.cxx | 56 -------
sfx2/source/control/unoctitm.cxx | 4
sfx2/source/view/lokhelper.cxx | 40 +++++
solenv/sanitizers/ui/svx.suppr | 4
svl/source/items/intitem.cxx | 28 +++
svl/source/items/poolitem.cxx | 6
svx/sdi/svx.sdi | 2
svx/source/sidebar/graphic/GraphicPropertyPanel.cxx | 2
svx/source/svdraw/svdedtv1.cxx | 1
svx/source/tbxctrls/grafctrl.cxx | 2
svx/source/tbxctrls/tbcontrl.cxx | 7
svx/source/xoutdev/xattr.cxx | 160 ++++++++++++++++++++
svx/uiconfig/ui/sidebargraphic.ui | 10 -
sw/source/uibase/shells/drawdlg.cxx | 61 +------
sw/source/uibase/shells/grfsh.cxx | 3
sw/source/uibase/shells/txtattr.cxx | 24 ---
sw/source/uibase/uiview/viewtab.cxx | 20 --
34 files changed, 374 insertions(+), 263 deletions(-)
New commits:
commit 60ac97df116da5f2d8e405509161ee4ac3167b00
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Dec 10 15:16:32 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:47 2020 +0200
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 889788454d41..0a5af99a9e45 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -43,7 +43,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 691ee99839e4..d65fae656b16 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -219,7 +219,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 969c15421995..7e2d39c7a486 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -32,7 +32,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 0e3bf2b3529b..772e2936911a 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -369,10 +369,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 c3ee5e83d1c3..95ecd4a0d52a 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -733,10 +733,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 52339b8c7f5b..6a217b14f880 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -69,6 +69,7 @@
#include <rtl/ustring.hxx>
#include <unotools/pathoptions.hxx>
#include <osl/time.h>
+#include <sfx2/lokhelper.hxx>
#include <iostream>
#include <map>
@@ -1220,6 +1221,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 acb4fea6f49a..68b4cfcb8159 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -204,34 +204,23 @@ namespace {
}
}
-void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* pSet)
+void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem)
{
- if (!pShell || !pSet)
+ if (!pShell || !pItem)
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 d865e64f05b7..8a199623fa58 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2013,11 +2013,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 5439a2810395..cf29f4a268df 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -907,10 +907,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 af5da09255bf..b321e0799f92 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -1017,10 +1017,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 5f9d04af8079..c0fff23e32f8 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -337,10 +337,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 13cd9a22b4ad..da49cf73992d 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -924,10 +924,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 1b11fcca7bad..c7fb5cc28965 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -846,10 +846,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 f5941793eadb..448387e2527e 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -2435,10 +2435,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: */
commit 4c6ca777b1ea0ef2b36fc0c08b44220397f9361d
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Dec 9 14:47:09 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:47 2020 +0200
jsdialog: apply FillGradient with JSON arg
Change-Id: I0ca53a53ff53e66d2f25ad4eb13305edbc3aaa12
Reviewed-on: https://gerrit.libreoffice.org/84749
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 2842dcf5a77f..f7e0e2253566 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -327,6 +327,7 @@ class SvxSetItem;
#define SID_FRAME_LINESTYLE TypedWhichId<SvxLineItem>( SID_SVX_START + 201 )
#define SID_FRAME_LINECOLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 202 )
#define SID_ATTR_LINE_WIDTH_ARG ( SID_SVX_START + 203 )
+#define SID_FILL_GRADIENT_JSON ( SID_SVX_START + 204 )
#define SID_SEARCHDLG_SEARCHSTRINGS ( SID_SVX_START + 215 )
#define SID_SEARCHDLG_REPLACESTRINGS ( SID_SVX_START + 216 )
#define SID_ATTR_TABLE ( SID_SVX_START + 217 )
diff --git a/include/svx/xgrad.hxx b/include/svx/xgrad.hxx
index 268b0e06253b..5e1f33ace5a0 100644
--- a/include/svx/xgrad.hxx
+++ b/include/svx/xgrad.hxx
@@ -75,6 +75,7 @@ public:
sal_uInt16 GetSteps() const { return nStepCount; }
boost::property_tree::ptree dumpAsJSON() const;
+ static XGradient fromJSON(const OUString& rJSON);
};
#endif
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 718e6cce54d5..069642c55268 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -57,6 +57,7 @@
#include <svx/chrtitem.hxx>
#include <svx/xlnclit.hxx>
#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
SFX_IMPL_INTERFACE(ScDrawShell, SfxShell)
@@ -104,6 +105,16 @@ namespace
}
}
}
+ if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
+ {
+ const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
+ if (pJSON)
+ {
+ XGradient aGradient = XGradient::fromJSON(pJSON->GetValue());
+ XFillGradientItem aItem(aGradient);
+ pArgs->Put(aItem);
+ }
+ }
}
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index f7f5b1e9ab86..cac505e7e1f0 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -89,6 +89,7 @@
#include <svx/xlnwtit.hxx>
#include <svx/chrtitem.hxx>
#include <svx/xlnclit.hxx>
+#include <svx/xflgrit.hxx>
#include <tools/diagnose_ex.h>
@@ -583,6 +584,16 @@ namespace
}
}
}
+ if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
+ {
+ const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
+ if (pJSON)
+ {
+ XGradient aGradient = XGradient::fromJSON(pJSON->GetValue());
+ XFillGradientItem aItem(aGradient);
+ pArgs->Put(aItem);
+ }
+ }
}
}
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index ed413935bb25..0bd2964a6ad8 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -2649,7 +2649,7 @@ XFillColorItem FillPageColor SID_ATTR_PAGE_COLOR
]
XFillGradientItem FillGradient SID_ATTR_FILL_GRADIENT
-
+(SfxStringItem FillGradientJSON SID_FILL_GRADIENT_JSON)
[
AutoUpdate = TRUE,
FastCall = FALSE,
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index a43a8be1cad7..f1ef70efcc09 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -95,6 +95,8 @@
using namespace ::com::sun::star;
+typedef std::map<OUString, OUString> StringMap;
+
static long ScaleMetricValue( long nVal, long nMul, long nDiv )
{
BigInt aVal( nVal );
@@ -1974,6 +1976,62 @@ std::string XGradient::GradientStyleToString(css::awt::GradientStyle eStyle)
return "";
}
+namespace
+{
+ css::awt::GradientStyle lcl_getStyleFromString(const OUString& rStyle)
+ {
+ if (rStyle == "LINEAR")
+ return css::awt::GradientStyle_LINEAR;
+ else if (rStyle == "AXIAL")
+ return css::awt::GradientStyle_AXIAL;
+ else if (rStyle == "RADIAL")
+ return css::awt::GradientStyle_RADIAL;
+ else if (rStyle == "ELLIPTICAL")
+ return css::awt::GradientStyle_ELLIPTICAL;
+ else if (rStyle == "SQUARE")
+ return css::awt::GradientStyle_SQUARE;
+ else if (rStyle == "RECT")
+ return css::awt::GradientStyle_RECT;
+
+ return css::awt::GradientStyle_LINEAR;
+ }
+
+ StringMap lcl_jsonToStringMap(const OUString& rJSON)
+ {
+ StringMap aArgs;
+ if (rJSON.getLength() && rJSON[0] != '\0')
+ {
+ std::stringstream aStream(OUStringToOString(rJSON, RTL_TEXTENCODING_ASCII_US).getStr());
+ boost::property_tree::ptree aTree;
+ boost::property_tree::read_json(aStream, aTree);
+
+ for (const auto& rPair : aTree)
+ {
+ aArgs[OUString::fromUtf8(rPair.first.c_str())] = OUString::fromUtf8(rPair.second.get_value<std::string>(".").c_str());
+ }
+ }
+ return aArgs;
+ }
+
+ XGradient lcl_buildGradientFromStringMap(StringMap& rMap)
+ {
+ XGradient aGradient;
+
+ aGradient.SetStartColor(rMap["startcolor"].toInt32(16));
+ aGradient.SetEndColor(rMap["endcolor"].toInt32(16));
+ aGradient.SetGradientStyle(lcl_getStyleFromString(rMap["style"]));
+ aGradient.SetAngle(rMap["angle"].toInt32());
+
+ return aGradient;
+ }
+}
+
+XGradient XGradient::fromJSON(const OUString& rJSON)
+{
+ StringMap aMap(lcl_jsonToStringMap(rJSON));
+ return lcl_buildGradientFromStringMap(aMap);
+}
+
XGradient::XGradient() :
eStyle( css::awt::GradientStyle_LINEAR ),
aStartColor( COL_BLACK ),
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 8ef098bc9287..5f9d04af8079 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -41,6 +41,7 @@
#include <svx/xlnwtit.hxx>
#include <svx/xflclit.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xflgrit.hxx>
#include <comphelper/lok.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -257,6 +258,16 @@ namespace
XLineWidthItem aItem(nValue);
pArgs->Put(aItem);
}
+ if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
+ {
+ const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
+ if (pJSON)
+ {
+ XGradient aGradient = XGradient::fromJSON(pJSON->GetValue());
+ XFillGradientItem aItem(aGradient);
+ pArgs->Put(aItem);
+ }
+ }
}
}
commit 7f998e0ae09c712e7fd0d66a70a0f19855c27624
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Nov 29 12:32:24 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:47 2020 +0200
jsdialogs: send fill transparency type updates
Change-Id: I3381968a7afe1f4db09401a0e6ead93b0b22f258
Reviewed-on: https://gerrit.libreoffice.org/84072
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svx/xflftrit.hxx b/include/svx/xflftrit.hxx
index df78d6645bd7..a6daf1006535 100644
--- a/include/svx/xflftrit.hxx
+++ b/include/svx/xflftrit.hxx
@@ -22,6 +22,7 @@
#include <svx/xflgrit.hxx>
#include <svx/svxdllapi.h>
+#include <boost/property_tree/json_parser.hpp>
// class XFillFloatTransparenceItem -
@@ -54,6 +55,8 @@ public:
static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
std::unique_ptr<XFillFloatTransparenceItem> checkForUniqueItem( SdrModel* pModel ) const;
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
#endif
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 5ce79bfd1721..5439a2810395 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -906,6 +906,11 @@ SfxItemSet SdrEditView::GetAttrFromMarked(bool bOnlyHardAttr) const
aSet.ClearItem(EE_FEATURE_LINEBR);
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/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 3fb245c01659..a43a8be1cad7 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1950,25 +1950,25 @@ std::string XGradient::GradientStyleToString(css::awt::GradientStyle eStyle)
switch (eStyle)
{
case css::awt::GradientStyle::GradientStyle_LINEAR:
- return "Linear";
+ return "LINEAR";
case css::awt::GradientStyle::GradientStyle_AXIAL:
- return "Axial";
+ return "AXIAL";
case css::awt::GradientStyle::GradientStyle_RADIAL:
- return "Radial";
+ return "RADIAL";
case css::awt::GradientStyle::GradientStyle_ELLIPTICAL:
- return "Elliptical";
+ return "ELLIPTICAL";
case css::awt::GradientStyle::GradientStyle_SQUARE:
- return "Square";
+ return "SQUARE";
case css::awt::GradientStyle::GradientStyle_RECT:
- return "Rect";
+ return "RECT";
case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE:
- return "FixedSize";
+ return "MAKE_FIXED_SIZE";
}
return "";
@@ -2448,6 +2448,14 @@ std::unique_ptr<XFillFloatTransparenceItem> XFillFloatTransparenceItem::checkFor
return nullptr;
}
+boost::property_tree::ptree XFillFloatTransparenceItem::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = XFillGradientItem::dumpAsJSON();
+ aTree.put("commandName", ".uno:FillFloatTransparence");
+
+ return aTree;
+}
+
XHatch::XHatch(const Color& rCol, css::drawing::HatchStyle eTheStyle, long nTheDistance,
long nTheAngle) :
eStyle(eTheStyle),
commit 4ae1bdbff19b127d2e9d2a7533478c424d1520f5
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 14:41:53 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialog: migrate left/right margin to generic items dump
Change-Id: Ie687393ae4b9a7f8350eea07c1d417c11fc532bd
Reviewed-on: https://gerrit.libreoffice.org/84000
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index ef9b39999fc6..37f1c1a04ff7 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -625,6 +625,34 @@ void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
}
+boost::property_tree::ptree SvxLRSpaceItem::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+ boost::property_tree::ptree aState;
+
+ MapUnit eTargetUnit = MapUnit::MapInch;
+
+ OUString sLeft = GetMetricText(GetLeft(),
+ MapUnit::MapTwip, eTargetUnit, nullptr);
+
+ OUString sRight = GetMetricText(GetRight(),
+ MapUnit::MapTwip, eTargetUnit, nullptr);
+
+ OUString sFirstline = GetMetricText(GetTextFirstLineOfst(),
+ MapUnit::MapTwip, eTargetUnit, nullptr);
+
+ aState.put("left", sLeft);
+ aState.put("right", sRight);
+ aState.put("firstline", sFirstline);
+ aState.put("unit", "inch");
+
+ aTree.push_back(std::make_pair("state", aState));
+
+ return aTree;
+}
+
+
SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId )
: SfxPoolItem(nId)
, nUpper(0)
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
index 32ad5907e2b8..3c5a06f1fe83 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -116,7 +116,9 @@ public:
{ return nPropFirstLineOfst; }
void SetTextFirstLineOfstValue( const short nValue )
{ nFirstLineOfst = nValue; }
+
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp )
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 94679765eb73..d010706ab7da 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -45,8 +45,6 @@
#include <editeng/frmdiritem.hxx>
#include <editeng/fhgtitem.hxx>
#include <comphelper/lok.hxx>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
-#include <editeng/itemtype.hxx>
#include <sfx2/objface.hxx>
@@ -594,28 +592,6 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
rSet.Put(aLRSpace);
Invalidate(SID_ATTR_PARA_LRSPACE);
- if (comphelper::LibreOfficeKit::isActive())
- {
- // TODO: set correct unit
- MapUnit eTargetUnit = MapUnit::MapInch;
-
- OUString sLeft = GetMetricText(aLRSpace.GetLeft(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sRight = GetMetricText(aLRSpace.GetRight(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sFirstline = GetMetricText(aLRSpace.GetTextFirstLineOfst(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sPayload = ".uno:LeftRightParaMargin={\"left\": \"" + sLeft +
- "\", \"right\": \"" + sRight +
- "\", \"firstline\": \"" + sFirstline + "\"}";
-
- GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
-
//Added by xuxu
SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
if ( eState == SfxItemState::DONTCARE )
diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx
index 737a1e094e41..1b11fcca7bad 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -40,8 +40,6 @@
#include <editeng/cmapitem.hxx>
#include <paratr.hxx>
#include <comphelper/lok.hxx>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
-#include <editeng/itemtype.hxx>
#include <fmtinfmt.hxx>
#include <docsh.hxx>
@@ -755,28 +753,6 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
SvxLRSpaceItem aLR = aCoreSet.Get( RES_LR_SPACE );
aLR.SetWhich(nSlot);
rSet.Put(aLR);
-
- if (comphelper::LibreOfficeKit::isActive())
- {
- // TODO: set correct unit
- MapUnit eTargetUnit = MapUnit::MapInch;
-
- OUString sLeft = GetMetricText(aLR.GetLeft(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sRight = GetMetricText(aLR.GetRight(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sFirstline = GetMetricText(aLR.GetTextFirstLineOfst(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sPayload = ".uno:LeftRightParaMargin={\"left\": \"" + sLeft +
- "\", \"right\": \"" + sRight +
- "\", \"firstline\": \"" + sFirstline + "\"}";
-
- GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
}
else
rSet.InvalidateItem(nSlot);
@@ -870,6 +846,10 @@ 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: */
commit 0cb031d2253647aab3bfbc889a1949be0e47f164
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 14:22:26 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialog: migrate after/before spacing to generic items dump
Change-Id: I18f0596baa8e1136f4546a943eafab9a13929c06
Reviewed-on: https://gerrit.libreoffice.org/83998
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 7ee4258df96f..ef9b39999fc6 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -843,6 +843,29 @@ void SvxULSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
+boost::property_tree::ptree SvxULSpaceItem::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+ boost::property_tree::ptree aState;
+
+ MapUnit eTargetUnit = MapUnit::MapInch;
+
+ OUString sUpper = GetMetricText(GetUpper(),
+ MapUnit::MapTwip, eTargetUnit, nullptr);
+
+ OUString sLower = GetMetricText(GetLower(),
+ MapUnit::MapTwip, eTargetUnit, nullptr);
+
+ aState.put("upper", sUpper);
+ aState.put("lower", sLower);
+ aState.put("unit", "inch");
+
+ aTree.push_back(std::make_pair("state", aState));
+
+ return aTree;
+}
+
SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const
{
diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx
index da4eacf7bc06..c9196bafcece 100644
--- a/include/editeng/ulspitem.hxx
+++ b/include/editeng/ulspitem.hxx
@@ -74,7 +74,9 @@ public:
bool GetContext() const { return bContext; }
sal_uInt16 GetPropUpper() const { return nPropUpper; }
sal_uInt16 GetPropLower() const { return nPropLower; }
+
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 2c7df774cbf6..94679765eb73 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -482,38 +482,15 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
}
long nUpper = 0;
- OUString sUpper, sLower;
- // TODO: set correct unit
- MapUnit eTargetUnit = MapUnit::MapInch;
for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( nPara );
const SvxULSpaceItem& rItem = rItems.Get( EE_PARA_ULSPACE );
nUpper = std::max( nUpper, static_cast<long>(rItem.GetUpper()) );
-
- if (nPara == nStartPara)
- {
- sUpper = GetMetricText(rItem.GetUpper(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
- }
- if (nPara == nEndPara)
- {
- sLower = GetMetricText(rItem.GetLower(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
- }
}
if( nUpper == 0 )
rSet.DisableItem( SID_PARASPACE_DECREASE );
-
- if (comphelper::LibreOfficeKit::isActive())
- {
- OUString sPayload = ".uno:ULSpacing={\"upper\": \"" + sUpper +
- "\", \"lower\": \"" + sLower + "\"}";
-
- GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
}
else
{
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index f52cf5617664..f5941793eadb 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -62,8 +62,6 @@
#include <ndtxt.hxx>
#include <pam.hxx>
#include <comphelper/lok.hxx>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
-#include <editeng/itemtype.hxx>
#include <IDocumentSettingAccess.hxx>
@@ -1584,24 +1582,6 @@ void SwView::StateTabWin(SfxItemSet& rSet)
aUL.SetWhich( nWhich );
rSet.Put( aUL );
}
-
- if (comphelper::LibreOfficeKit::isActive())
- {
- // TODO: set correct unit
- MapUnit eTargetUnit = MapUnit::MapInch;
-
- OUString sUpper = GetMetricText(aUL.GetUpper(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sLower = GetMetricText(aUL.GetLower(),
- MapUnit::MapTwip, eTargetUnit, nullptr);
-
- OUString sPayload = ".uno:ULSpacing={\"upper\": \"" + sUpper +
- "\", \"lower\": \"" + sLower + "\"}";
-
- GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
}
else
{
@@ -2455,6 +2435,10 @@ 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: */
commit 0e5edc6ace090ff37cf85c15cd31d5aa00cc8f59
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 10:48:55 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialog: rename duplicated ui object settransparency
We had two elements with the same name (one in the area,
one in a graphic context) - that caused bottom panel
in online not work correctly.
Change-Id: I41b9604522157e2c31e68e40c49e42ff2ccdb280
Reviewed-on: https://gerrit.libreoffice.org/83974
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr
index 623ec15448ac..5b323a5f23e8 100644
--- a/solenv/sanitizers/ui/svx.suppr
+++ b/solenv/sanitizers/ui/svx.suppr
@@ -79,8 +79,8 @@ svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setcontrast:%'] missing-l
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setcontrast:%'] labelled-by-and-mnemonic
svx/uiconfig/ui/sidebargraphic.ui://GtkComboBoxText[@id='setcolormode'] missing-label-for
svx/uiconfig/ui/sidebargraphic.ui://GtkComboBoxText[@id='setcolormode'] labelled-by-and-mnemonic
-svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='settransparency:%'] missing-label-for
-svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='settransparency:%'] labelled-by-and-mnemonic
+svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setgraphtransparency:%'] missing-label-for
+svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setgraphtransparency:%'] labelled-by-and-mnemonic
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='widthlabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='colorlabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='translabel'] orphan-label
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
index 7e8bc1070ef1..00b5758e65fc 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -56,7 +56,7 @@ GraphicPropertyPanel::GraphicPropertyPanel(
get(mpMtrContrast, "setcontrast");
get(mpLBColorMode, "setcolormode");
mpLBColorMode->set_width_request(mpLBColorMode->get_preferred_size().Width());
- get(mpMtrTrans, "settransparency");
+ get(mpMtrTrans, "setgraphtransparency");
get(mpMtrRed, "setred");
get(mpMtrGreen, "setgreen");
get(mpMtrBlue, "setblue");
diff --git a/svx/uiconfig/ui/sidebargraphic.ui b/svx/uiconfig/ui/sidebargraphic.ui
index c409b8021cb8..6adf1aad5d74 100644
--- a/svx/uiconfig/ui/sidebargraphic.ui
+++ b/svx/uiconfig/ui/sidebargraphic.ui
@@ -147,7 +147,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="sidebargraphic|transparencylabel">_Transparency:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">settransparency:%</property>
+ <property name="mnemonic_widget">setgraphtransparency:%</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -156,18 +156,18 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="settransparency:%">
+ <object class="GtkSpinButton" id="setgraphtransparency:%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
- <property name="tooltip_text" translatable="yes" context="sidebargraphic|settransparency|tooltip_text">Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent.</property>
+ <property name="tooltip_text" translatable="yes" context="sidebargraphic|setgraphtransparency|tooltip_text">Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent.</property>
<property name="adjustment">0to100adjustment</property>
<accessibility>
<relation type="labelled-by" target="transparencylabel"/>
</accessibility>
<child internal-child="accessible">
- <object class="AtkObject" id="settransparency:%-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|settransparency-atkobject">Transparency</property>
+ <object class="AtkObject" id="setgraphtransparency:%-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgraphtransparency-atkobject">Transparency</property>
</object>
</child>
</object>
commit 6de7e0e4d834305706a042ca3c0a21588bb189ca
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 10:50:32 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialog: dump Sfx_Int__Items to JSON
Change-Id: I6a1d2847251b90f86457b552e5354f5e179e1627
Reviewed-on: https://gerrit.libreoffice.org/83975
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx
index 8ecf53fadb08..c43add2013d7 100644
--- a/include/svl/intitem.hxx
+++ b/include/svl/intitem.hxx
@@ -90,6 +90,7 @@ public:
{ return new SfxUInt16Item(*this); }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
@@ -105,6 +106,7 @@ public:
{ return new SfxInt32Item(*this); }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
@@ -120,6 +122,7 @@ public:
{ return new SfxUInt32Item(*this); }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
#endif // INCLUDED_SVL_INTITEM_HXX
diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx
index f4016097637f..6bf9b2ef8300 100644
--- a/svl/source/items/intitem.cxx
+++ b/svl/source/items/intitem.cxx
@@ -107,6 +107,13 @@ void SfxUInt16Item::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
+boost::property_tree::ptree SfxUInt16Item::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+ aTree.put("state", GetValue());
+ return aTree;
+}
+
// class SfxInt32Item
@@ -124,6 +131,13 @@ void SfxInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
+boost::property_tree::ptree SfxInt32Item::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+ aTree.put("state", GetValue());
+ return aTree;
+}
+
// class SfxUInt32Item
@@ -141,6 +155,12 @@ void SfxUInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
+boost::property_tree::ptree SfxUInt32Item::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+ aTree.put("state", GetValue());
+ return aTree;
+}
SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_uInt32 nValue):
SfxInt32Item(which, nValue)
commit 6ef49a97f9cb1037e39c839411dffaa37c0fa573
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 28 10:19:39 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialogs; send graphic updates in Calc and Impress
Change-Id: Ia69fe214b6961a8f0387e6fc8f97a75687f5ed93
Reviewed-on: https://gerrit.libreoffice.org/83968
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index dee443327e08..af5da09255bf 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -60,6 +60,8 @@
#include <bitmaps.hlst>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
@@ -1015,6 +1017,10 @@ 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: */
commit e5568b726356f5e05e349a1cf0a01b9558619998
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 26 15:02:48 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialogs: add generic commandName
Change-Id: Icefe02e7682cf47da0bcc5efdfc3ab1019c8abf3
Reviewed-on: https://gerrit.libreoffice.org/83772
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index ee032c6f4977..acb4fea6f49a 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -24,6 +24,9 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
#include <editeng/outliner.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/msgpool.hxx>
#include <shellimpl.hxx>
@@ -183,6 +186,24 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS
}
}
+namespace {
+ OUString lcl_getNameForSlot(const SfxViewShell* pShell, sal_uInt16 nWhich)
+ {
+ if (pShell->GetFrame())
+ {
+ const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(pShell->GetFrame()).GetSlot(nWhich);
+ if (pSlot)
+ {
+ OUStringBuffer sUnoCommand(".uno:");
+ sUnoCommand.append(OStringToOUString(pSlot->GetUnoName(), RTL_TEXTENCODING_ASCII_US));
+ return sUnoCommand.makeStringAndClear();
+ }
+ }
+
+ return "";
+ }
+}
+
void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* pSet)
{
if (!pShell || !pSet)
@@ -197,6 +218,11 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* p
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);
+
if (!aItem.empty())
anArray.push_back(std::make_pair("", aItem));
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 2742d6ff4568..3fb245c01659 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1839,7 +1839,7 @@ boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const
boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
if (Which() == XATTR_FILLSTYLE)
- aTree.put("which", ".uno:FillStyle");
+ aTree.put("commandName", ".uno:FillStyle");
OUString sValue;
@@ -1863,7 +1863,7 @@ boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const
default: break;
}
- aTree.put("data", sValue);
+ aTree.put("state", sValue);
return aTree;
}
@@ -2342,9 +2342,9 @@ boost::property_tree::ptree XFillGradientItem::dumpAsJSON() const
boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
if (Which() == XATTR_FILLGRADIENT)
- aTree.put("which", ".uno:FillGradient");
+ aTree.put("commandName", ".uno:FillGradient");
- aTree.push_back(std::make_pair("data", GetGradientValue().dumpAsJSON()));
+ aTree.push_back(std::make_pair("state", GetGradientValue().dumpAsJSON()));
return aTree;
}
commit 623f6202d859403587b726ff61266d41ea166e52
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 26 15:03:27 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialogs: send graphic items updates
Change-Id: I57d05726f80115b92e7599a7d033bf1ea8f79695
Reviewed-on: https://gerrit.libreoffice.org/83773
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx
index f6064ed8a335..8ecf53fadb08 100644
--- a/include/svl/intitem.hxx
+++ b/include/svl/intitem.hxx
@@ -22,6 +22,7 @@
#include <svl/svldllapi.h>
#include <svl/cintitem.hxx>
+#include <boost/property_tree/json_parser.hpp>
class SVL_DLLPUBLIC SfxByteItem: public CntByteItem
@@ -55,6 +56,8 @@ public:
const IntlWrapper&)
const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+
virtual bool QueryValue( css::uno::Any& rVal,
sal_uInt8 nMemberId = 0 ) const override;
diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx
index 1345308281fa..f4016097637f 100644
--- a/svl/source/items/intitem.cxx
+++ b/svl/source/items/intitem.cxx
@@ -58,6 +58,14 @@ bool SfxInt16Item::GetPresentation(SfxItemPresentation,
}
+boost::property_tree::ptree SfxInt16Item::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+ aTree.put("state", GetValue());
+ return aTree;
+}
+
+
// virtual
bool SfxInt16Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
{
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 9bc4d34fcf1b..13cd9a22b4ad 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -77,6 +77,9 @@
#include <unocrsr.hxx>
#include <memory>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
#define TOOLBOX_NAME "colorbar"
class SwGrfShell::SwExternalToolEdit
@@ -921,6 +924,10 @@ 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)
commit b2d8dc41c664097811180a41df2f460d2d7aa31f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Nov 22 12:57:00 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:46 2020 +0200
jsdialogs: dumpAsJSON for FillStyle
Change-Id: I0dc130c295b416b5b9e3071a0ec81dae0ce851fb
Reviewed-on: https://gerrit.libreoffice.org/83746
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svx/xfillit0.hxx b/include/svx/xfillit0.hxx
index a1772092f991..e0855dfb7c56 100644
--- a/include/svx/xfillit0.hxx
+++ b/include/svx/xfillit0.hxx
@@ -48,6 +48,7 @@ public:
virtual sal_uInt16 GetValueCount() const override;
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
#endif
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 7061211a8f57..2742d6ff4568 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1834,6 +1834,40 @@ void XFillStyleItem::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
+boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+ if (Which() == XATTR_FILLSTYLE)
+ aTree.put("which", ".uno:FillStyle");
+
+ OUString sValue;
+
+ switch( GetValue() )
+ {
+ case drawing::FillStyle_NONE:
+ sValue = "NONE";
+ break;
+ case drawing::FillStyle_SOLID:
+ sValue = "SOLID";
+ break;
+ case drawing::FillStyle_GRADIENT:
+ sValue = "GRADIENT";
+ break;
+ case drawing::FillStyle_HATCH:
+ sValue = "HATCH";
+ break;
+ case drawing::FillStyle_BITMAP:
+ sValue = "BITMAP";
+ break;
+ default: break;
+ }
+
+ aTree.put("data", sValue);
+
+ return aTree;
+}
+
SfxPoolItem* XFillColorItem::CreateDefault() { return new XFillColorItem; }
commit ef3255619c1817fe97dc3fddb510104cc4d09e38
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 26 10:47:33 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:45 2020 +0200
jsdialogs: share the commands updates sending code
Change-Id: I34c1e03a8f92efe0c0dd391d16ff907919e65b00
Reviewed-on: https://gerrit.libreoffice.org/83748
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 760b2ed5dfc6..889788454d41 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -42,6 +42,8 @@ public:
static void notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload);
/// 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);
/// 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 d65fae656b16..691ee99839e4 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -219,6 +219,7 @@ 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 86ea333d1100..969c15421995 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -17,6 +17,8 @@
#include <vector>
+class SfxItemSet;
+
namespace vcl
{
@@ -30,6 +32,7 @@ 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 e2ef0c75a173..0e3bf2b3529b 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -57,32 +57,6 @@
using namespace com::sun::star::drawing;
using namespace com::sun::star;
-namespace {
- void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
- {
- if (!pShell)
- return;
-
- boost::property_tree::ptree aTree;
- boost::property_tree::ptree anArray;
-
- for(int i = 0; i < rSet.Count(); i++)
- {
- sal_uInt16 nWhich = rSet.GetWhichByPos(i);
- if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich))
- {
- boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON();
- if (!aItem.empty())
- anArray.push_back(std::make_pair("", aItem));
- }
- }
- 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());
- }
-}
ScDrawShell::ScDrawShell( ScViewData* pData ) :
SfxShell(pData->GetViewShell()),
@@ -398,7 +372,7 @@ void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
if (pViewShell && comphelper::LibreOfficeKit::isActive())
- lcl_sendAttrUpdatesForLOK( pViewShell, rSet );
+ pViewShell->sendUnoStatus( &rSet );
}
}
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 3bd059cabdff..c3ee5e83d1c3 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -70,33 +70,6 @@ using namespace com::sun::star::drawing;
using namespace svx::sidebar;
using namespace ::com::sun::star;
-namespace {
- void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
- {
- if (!pShell)
- return;
-
- boost::property_tree::ptree aTree;
- boost::property_tree::ptree anArray;
-
- for(int i = 0; i < rSet.Count(); i++)
- {
- sal_uInt16 nWhich = rSet.GetWhichByPos(i);
- if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich))
- {
- boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON();
- if (!aItem.empty())
- anArray.push_back(std::make_pair("", aItem));
- }
- }
- 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());
- }
-}
-
namespace sd {
/**
@@ -763,7 +736,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
if (pViewShell && comphelper::LibreOfficeKit::isActive())
- lcl_sendAttrUpdatesForLOK( pViewShell, *pSet );
+ pViewShell->sendUnoStatus( &rSet );
}
SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 6dea1bc3d125..ee032c6f4977 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -183,6 +183,31 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS
}
}
+void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* pSet)
+{
+ if (!pShell || !pSet)
+ return;
+
+ boost::property_tree::ptree aTree;
+ boost::property_tree::ptree anArray;
+
+ for(int i = 0; i < pSet->Count(); i++)
+ {
+ sal_uInt16 nWhich = pSet->GetWhichByPos(i);
+ if (pSet->HasItem(nWhich) && SfxItemState::SET >= pSet->GetItemState(nWhich))
+ {
+ boost::property_tree::ptree aItem = pSet->Get(nWhich).dumpAsJSON();
+ if (!aItem.empty())
+ anArray.push_back(std::make_pair("", aItem));
+ }
+ }
+ 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,
vcl::LOKWindowId nLOKWindowId,
const OUString& rAction,
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 8a199623fa58..d865e64f05b7 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2013,6 +2013,11 @@ 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/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 2b6abbf3396d..8ef098bc9287 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -258,31 +258,6 @@ namespace
pArgs->Put(aItem);
}
}
-
- void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
- {
- if (!pShell)
- return;
-
- boost::property_tree::ptree aTree;
- boost::property_tree::ptree anArray;
-
- for(int i = 0; i < rSet.Count(); i++)
- {
- sal_uInt16 nWhich = rSet.GetWhichByPos(i);
- if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich))
- {
- boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON();
- if (!aItem.empty())
- anArray.push_back(std::make_pair("", aItem));
- }
- }
- 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 SwDrawShell::ExecDrawAttrArgs(SfxRequest const & rReq)
@@ -354,7 +329,7 @@ void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
SfxViewShell* pViewShell = GetShell().GetSfxViewShell();
if (pViewShell && comphelper::LibreOfficeKit::isActive())
- lcl_sendAttrUpdatesForLOK( pViewShell, rSet );
+ pViewShell->sendUnoStatus( &rSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 018e8895dee5bbcd3e089cbc42b052cb7deebbe3
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Nov 25 17:10:41 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:45 2020 +0200
jsdialog: send generic fill items also in writer and impress
Change-Id: I656ee47fff4e43f77caef62c071a5aa3b867f444
Reviewed-on: https://gerrit.libreoffice.org/83747
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 2dcfe64dec3c..3bd059cabdff 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -71,54 +71,29 @@ using namespace svx::sidebar;
using namespace ::com::sun::star;
namespace {
- OUString lcl_fillStyleEnumToString(FillStyle eStyle)
- {
- switch (eStyle)
- {
- case FillStyle_NONE:
- return "NONE";
-
- case FillStyle_SOLID:
- return "SOLID";
-
- case FillStyle_GRADIENT:
- return "GRADIENT";
-
- case FillStyle_HATCH:
- return "HATCH";
-
- case FillStyle_BITMAP:
- return "BITMAP";
-
- default:
- return "";
- }
- }
-
void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
{
if (!pShell)
return;
- OUString sPayload;
- const SfxPoolItem* pItem = rSet.GetItem(SID_ATTR_FILL_STYLE);
+ boost::property_tree::ptree aTree;
+ boost::property_tree::ptree anArray;
- if (pItem)
+ for(int i = 0; i < rSet.Count(); i++)
{
- const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem);
- FillStyle eStyle;
- css::uno::Any aAny;
-
- pFillStyleItem->QueryValue(aAny);
- aAny >>= eStyle;
- sPayload = ".uno:FillStyle=" + lcl_fillStyleEnumToString(eStyle);
+ sal_uInt16 nWhich = rSet.GetWhichByPos(i);
+ if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich))
+ {
+ boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON();
+ if (!aItem.empty())
+ anArray.push_back(std::make_pair("", aItem));
+ }
}
+ aTree.add_child("items", anArray);
- if (!sPayload.isEmpty())
- {
- pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree);
+ pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str());
}
}
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index f899f7e74645..2b6abbf3396d 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -259,54 +259,29 @@ namespace
}
}
- OUString lcl_fillStyleEnumToString(FillStyle eStyle)
- {
- switch (eStyle)
- {
- case FillStyle_NONE:
- return "NONE";
-
- case FillStyle_SOLID:
- return "SOLID";
-
- case FillStyle_GRADIENT:
- return "GRADIENT";
-
- case FillStyle_HATCH:
- return "HATCH";
-
- case FillStyle_BITMAP:
- return "BITMAP";
-
- default:
- return "";
- }
- }
-
void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
{
if (!pShell)
return;
- OUString sPayload;
- const SfxPoolItem* pItem = rSet.GetItem(SID_ATTR_FILL_STYLE);
+ boost::property_tree::ptree aTree;
+ boost::property_tree::ptree anArray;
- if (pItem)
+ for(int i = 0; i < rSet.Count(); i++)
{
- const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem);
- FillStyle eStyle;
- css::uno::Any aAny;
-
- pFillStyleItem->QueryValue(aAny);
- aAny >>= eStyle;
- sPayload = ".uno:FillStyle=" + lcl_fillStyleEnumToString(eStyle);
+ sal_uInt16 nWhich = rSet.GetWhichByPos(i);
+ if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich))
+ {
+ boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON();
+ if (!aItem.empty())
+ anArray.push_back(std::make_pair("", aItem));
+ }
}
+ aTree.add_child("items", anArray);
- if (!sPayload.isEmpty())
- {
- pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree);
+ pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str());
}
}
commit 569d713259fcb172a8a8aba78fda0341081bb47b
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 21 17:47:10 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:45 2020 +0200
jsdialogs: dumpAsJSON for SfxItems with FillGradient example
Change-Id: I1b9303af6f52ad071074200bb630c587c8f611c1
Reviewed-on: https://gerrit.libreoffice.org/83745
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index cc1ddabd57a3..dd74806464cd 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -29,6 +29,7 @@
#include <svl/svldllapi.h>
#include <svl/typedwhich.hxx>
#include <tools/mapunit.hxx>
+#include <boost/property_tree/json_parser.hpp>
class IntlWrapper;
@@ -180,6 +181,7 @@ public:
sal_uInt32 GetRefCount() const { return m_nRefCount; }
SfxItemKind GetKind() const { return m_nKind; }
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+ virtual boost::property_tree::ptree dumpAsJSON() const;
/** Only SfxVoidItem shall and must return true for this.
diff --git a/include/svx/xflgrit.hxx b/include/svx/xflgrit.hxx
index 5f136e25f824..1b1d860c8fb9 100644
--- a/include/svx/xflgrit.hxx
+++ b/include/svx/xflgrit.hxx
@@ -56,6 +56,8 @@ public:
static bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
std::unique_ptr<XFillGradientItem> checkForUniqueItem( SdrModel* pModel ) const;
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
};
#endif
diff --git a/include/svx/xgrad.hxx b/include/svx/xgrad.hxx
index e31a4d2ef648..268b0e06253b 100644
--- a/include/svx/xgrad.hxx
+++ b/include/svx/xgrad.hxx
@@ -23,6 +23,7 @@
#include <tools/color.hxx>
#include <svx/svxdllapi.h>
#include <com/sun/star/awt/GradientStyle.hpp>
+#include <boost/property_tree/json_parser.hpp>
class Gradient;
@@ -39,6 +40,8 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC XGradient final
sal_uInt16 nIntensEnd;
sal_uInt16 nStepCount;
+ static std::string GradientStyleToString(css::awt::GradientStyle eStyle);
+
public:
XGradient();
XGradient( const Color& rStart, const Color& rEnd,
@@ -70,6 +73,8 @@ public:
sal_uInt16 GetStartIntens() const { return nIntensStart; }
sal_uInt16 GetEndIntens() const { return nIntensEnd; }
sal_uInt16 GetSteps() const { return nStepCount; }
+
+ boost::property_tree::ptree dumpAsJSON() const;
};
#endif
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 118412c24822..e2ef0c75a173 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -48,6 +48,7 @@
#include <svx/svdoole2.hxx>
#include <svx/svdocapt.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xflgrit.hxx>
#include <comphelper/lok.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -57,54 +58,29 @@ using namespace com::sun::star::drawing;
using namespace com::sun::star;
namespace {
- OUString lcl_fillStyleEnumToString(FillStyle eStyle)
- {
- switch (eStyle)
- {
- case FillStyle_NONE:
- return "NONE";
-
- case FillStyle_SOLID:
- return "SOLID";
-
- case FillStyle_GRADIENT:
- return "GRADIENT";
-
- case FillStyle_HATCH:
- return "HATCH";
-
- case FillStyle_BITMAP:
- return "BITMAP";
-
- default:
- return "";
- }
- }
-
void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
{
if (!pShell)
return;
- OUString sPayload;
- const SfxPoolItem* pItem = rSet.GetItem(SID_ATTR_FILL_STYLE);
+ boost::property_tree::ptree aTree;
+ boost::property_tree::ptree anArray;
- if (pItem)
+ for(int i = 0; i < rSet.Count(); i++)
{
- const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem);
- FillStyle eStyle;
- css::uno::Any aAny;
-
- pFillStyleItem->QueryValue(aAny);
- aAny >>= eStyle;
- sPayload = ".uno:FillStyle=" + lcl_fillStyleEnumToString(eStyle);
+ sal_uInt16 nWhich = rSet.GetWhichByPos(i);
+ if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich))
+ {
+ boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON();
+ if (!aItem.empty())
+ anArray.push_back(std::make_pair("", aItem));
+ }
}
+ aTree.add_child("items", anArray);
- if (!sPayload.isEmpty())
- {
- pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
- }
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree);
+ pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str());
}
}
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index ec37b68d3417..daa676a9e458 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -552,6 +552,12 @@ void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
+boost::property_tree::ptree SfxPoolItem::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree;
+ return aTree;
+}
+
std::unique_ptr<SfxPoolItem> SfxPoolItem::CloneSetWhich( sal_uInt16 nNewWhich ) const
{
std::unique_ptr<SfxPoolItem> pItem(Clone());
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index af477725dc23..7061211a8f57 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -88,6 +88,8 @@
#include <unotools/intlwrapper.hxx>
#include <unotools/syslocale.hxx>
#include <vcl/gradient.hxx>
+#include <svx/svxids.hrc>
+#include <string>
#include <libxml/xmlwriter.h>
@@ -1909,6 +1911,35 @@ bool XSecondaryFillColorItem::GetPresentation
return true;
}
+std::string XGradient::GradientStyleToString(css::awt::GradientStyle eStyle)
+{
+ switch (eStyle)
+ {
+ case css::awt::GradientStyle::GradientStyle_LINEAR:
+ return "Linear";
+
+ case css::awt::GradientStyle::GradientStyle_AXIAL:
+ return "Axial";
+
+ case css::awt::GradientStyle::GradientStyle_RADIAL:
+ return "Radial";
+
+ case css::awt::GradientStyle::GradientStyle_ELLIPTICAL:
+ return "Elliptical";
+
+ case css::awt::GradientStyle::GradientStyle_SQUARE:
+ return "Square";
+
+ case css::awt::GradientStyle::GradientStyle_RECT:
+ return "Rect";
+
+ case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE:
+ return "FixedSize";
+ }
+
+ return "";
+}
+
XGradient::XGradient() :
eStyle( css::awt::GradientStyle_LINEAR ),
aStartColor( COL_BLACK ),
@@ -1955,6 +1986,23 @@ bool XGradient::operator==(const XGradient& rGradient) const
nStepCount == rGradient.nStepCount );
}
+boost::property_tree::ptree XGradient::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree;
+
+ aTree.put("style", XGradient::GradientStyleToString(eStyle));
+ aTree.put("startcolor", aStartColor.AsRGBHexString());
+ aTree.put("endcolor", aEndColor.AsRGBHexString());
+ aTree.put("angle", std::to_string(nAngle));
+ aTree.put("border", std::to_string(nBorder));
+ aTree.put("x", std::to_string(nOfsX));
+ aTree.put("y", std::to_string(nOfsY));
+ aTree.put("intensstart", std::to_string(nIntensStart));
+ aTree.put("intensend", std::to_string(nIntensEnd));
+ aTree.put("stepcount", std::to_string(nStepCount));
+
+ return aTree;
+}
SfxPoolItem* XFillGradientItem::CreateDefault() { return new XFillGradientItem; }
@@ -2255,6 +2303,18 @@ std::unique_ptr<XFillGradientItem> XFillGradientItem::checkForUniqueItem( SdrMod
return nullptr;
}
+boost::property_tree::ptree XFillGradientItem::dumpAsJSON() const
+{
+ boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+ if (Which() == XATTR_FILLGRADIENT)
+ aTree.put("which", ".uno:FillGradient");
+
+ aTree.push_back(std::make_pair("data", GetGradientValue().dumpAsJSON()));
+
+ return aTree;
+}
+
SfxPoolItem* XFillFloatTransparenceItem::CreateDefault() { return new XFillFloatTransparenceItem; }
commit ede64fa86036f906b9d1f324c2098965700e6efa
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Nov 27 11:30:06 2019 +0100
Commit: Szymon Kłos <eszkadev at gmail.com>
CommitDate: Wed May 13 19:52:45 2020 +0200
jsdiloag: export SvxColorBox to JSON
Change-Id: I1a1296ed2981867af6dac22ba03423a3e5f3d5b5
Reviewed-on: https://gerrit.libreoffice.org/83898
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
index 373b8cf11403..802d82dd0c45 100644
--- a/include/svx/colorbox.hxx
+++ b/include/svx/colorbox.hxx
@@ -71,6 +71,8 @@ public:
void EnsurePaletteManager();
DECL_LINK(WindowEventListener, VclWindowEvent&, void);
+
+ virtual boost::property_tree::ptree DumpAsPropertyTree() override;
};
class ListBoxColorWrapper
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 7fc12c76a47d..6741954f7581 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -4109,6 +4109,13 @@ void SvxColorListBox::SelectEntry(const Color& rColor)
ShowPreview(m_aSelectedColor);
}
+boost::property_tree::ptree SvxColorListBox::DumpAsPropertyTree()
+{
+ boost::property_tree::ptree aTree = MenuButton::DumpAsPropertyTree();
+ aTree.put("type", "colorlistbox");
+ return aTree;
+}
+
ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Window* pTopLevel)
: m_xButton(std::move(pControl))
, m_pTopLevel(pTopLevel)
More information about the Libreoffice-commits
mailing list