[Libreoffice-commits] core.git: include/svx sc/source sd/source svx/sdi svx/source sw/source

2021-04-19 Thread merttumer (via logerrit)
 include/svx/svddrag.hxx|   12 
 include/svx/svdoedge.hxx   |2 +-
 include/svx/svdview.hxx|3 ++-
 sc/source/ui/drawfunc/drawsh.cxx   |5 +++--
 sd/source/ui/view/drviews2.cxx |6 --
 svx/sdi/svx.sdi|2 +-
 svx/source/svdraw/svdoedge.cxx |   22 --
 svx/source/svdraw/svdview.cxx  |   17 -
 sw/source/uibase/shells/drawsh.cxx |5 +++--
 sw/source/uibase/uiview/view2.cxx  |5 +++--
 10 files changed, 61 insertions(+), 18 deletions(-)

New commits:
commit b18bff18785cc194f9918f6bdf69523827ef
Author: merttumer 
AuthorDate: Fri Apr 2 16:18:05 2021 +0300
Commit: Mert Tumer 
CommitDate: Tue Apr 20 06:52:26 2021 +0200

lok: Pass object ord num in the uno command

When multiple objects' glue points collide the ordnum
will be used to decide which glue point to connect to
for the connectors. Without that the default logic chooses
the lowest ordered object which is searched and found in the object list

Change-Id: I64579d28bbe6cbd92bab745838fe2995585b6a3f
Signed-off-by: merttumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113517
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114032
Tested-by: Jenkins

diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx
index 80c2406b9046..6718e5f36b5d 100644
--- a/include/svx/svddrag.hxx
+++ b/include/svx/svddrag.hxx
@@ -79,6 +79,16 @@ class SVXCORE_DLLPUBLIC SdrDragStat final
 
 sal_Int32 GetPrevPos() const { return mvPnts.size()-(mvPnts.size()>1 ? 2 : 
1); }
 
+// This is passed all the way through to ApplySpecialDrag of the Edge 
Object
+// For LOK, we cannot really specify which glue point to select by default
+// It selects the nearest glue points after DragEnd event.
+// When multiple objects are on top of each other or somehow their glue 
points
+// collide, the glue point is selected from the lowest order numbered 
object
+// We can pass the ord number information inside the draginfo and choose 
the correct shape
+struct {
+sal_Int32 objectOrdNum = -1;
+} mGlueOptions;
+
 public:
 SdrDragStat(){ Reset(); }
 ~SdrDragStat();
@@ -158,6 +168,8 @@ public:
 
 // Also considering 1stPointAsCenter
 void TakeCreateRect(tools::Rectangle& rRect) const;
+
+auto&GetGlueOptions() { return mGlueOptions; }
 };
 
 #endif // INCLUDED_SVX_SVDDRAG_HXX
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index fe09104dbc4e..17108ad856ec 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -177,7 +177,7 @@ protected:
 XPolygon ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, const 
tools::Rectangle& rBoundRect1, const tools::Rectangle& rBewareRect1,
 const Point& rPt2, tools::Long nAngle2, const tools::Rectangle& 
rBoundRect2, const tools::Rectangle& rBewareRect2,
 sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const;
-static bool ImpFindConnector(const Point& rPt, const SdrPageView& rPV, 
SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=nullptr);
+static bool ImpFindConnector(const Point& rPt, const SdrPageView& rPV, 
SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=nullptr, 
SdrDragStat* pDragStat = nullptr);
 static SdrEscapeDirection ImpCalcEscAngle(SdrObject const * pObj, const 
Point& aPt2);
 void ImpSetTailPoint(bool bTail1, const Point& rPt);
 void ImpUndirtyEdgeTrack();  // potential recalculation of the connection 
track
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
index 149b17f9ece9..7020f6447b4d 100644
--- a/include/svx/svdview.hxx
+++ b/include/svx/svdview.hxx
@@ -242,7 +242,8 @@ public:
 SdrPageWindow& rPageWindow,
 const char* pDebugName) const;
 
-bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint);
+// Interactive Move Action programmaticaly
+bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint, 
const sal_Int32 aObjectOrdNum = -1);
 };
 
 // First of all the app creates a SdrModel.
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 90bf9f8e51cd..4a46f3d69c90 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -205,16 +205,17 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
 case SID_MOVE_SHAPE_HANDLE:
 {
 const SfxItemSet *pArgs = rReq.GetArgs ();
-if (pArgs && pArgs->Count () == 3)
+if (pArgs && pArgs->Count () >= 3)
 {
 const SfxUInt32Item* handleNumItem = 
rReq.GetArg(FN_PARAM_1);
 const SfxUInt32Item* newPosXTwips = 
rReq.GetArg(FN_PARAM_2);
 const SfxUInt32Item* newPosYTwips = 
rReq.GetArg(FN_PARAM_3);
+   

[Libreoffice-commits] core.git: include/svx sc/source sd/source svx/sdi svx/source sw/source

2019-12-10 Thread Szymon Kłos (via logerrit)
 include/svx/svxids.hrc  |1 
 include/svx/xgrad.hxx   |1 
 sc/source/ui/drawfunc/drawsh.cxx|   11 ++
 sd/source/ui/view/drviews2.cxx  |   11 ++
 svx/sdi/svx.sdi |2 -
 svx/source/xoutdev/xattr.cxx|   58 
 sw/source/uibase/shells/drawdlg.cxx |   11 ++
 7 files changed, 94 insertions(+), 1 deletion(-)

New commits:
commit 1c04f677b53d6e0731f6401bc4c3a0dfd9e6ed01
Author: Szymon Kłos 
AuthorDate: Mon Dec 9 14:47:09 2019 +0100
Commit: Szymon Kłos 
CommitDate: Tue Dec 10 11:07:51 2019 +0100

jsdialog: apply FillGradient with JSON arg

Change-Id: I0ca53a53ff53e66d2f25ad4eb13305edbc3aaa12
Reviewed-on: https://gerrit.libreoffice.org/84798
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 8d4b16389b5d..f12a326d0d2a 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -327,6 +327,7 @@ class SvxSetItem;
 #define SID_FRAME_LINESTYLE 
TypedWhichId( SID_SVX_START + 201 )
 #define SID_FRAME_LINECOLOR 
TypedWhichId( 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 3c9b2b4572a4..8fae7d896c75 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 
 #include 
 #include 
+#include 
 
 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(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 12a2b8919be6..3097f9496542 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -89,6 +89,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -578,6 +579,16 @@ public:
 }
 }
 }
+if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, 
false, &pItem))
+{
+const SfxStringItem* pJSON = static_cast(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 795d4df6f944..9d1d9cbc8747 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 2c50c3e6f263..c94fcdea4d93 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -96,6 +96,8 @@
 
 using namespace ::com::sun::star;
 
+typedef std::map StringMap;
+
 static long ScaleMetricValue( long nVal, long nMul, long nDiv )
 {
 BigInt aVal( nVal );
@@ -1975,6 +1977,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 == "RE