summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-02-19 23:41:57 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2019-02-20 06:20:21 +0100
commit98384e98e59506d08c48b41b70a660655a8f83d7 (patch)
tree6a3385071edaaa3a979e3f29187c85a7ea10189a /sd
parent12a59a1f2948274c6a845ab4a0963bab8aff45b8 (diff)
Use named shapes for redaction
Change-Id: Ibb55bd503d264b618c3fbebfdbcf3fe9958c6783 Reviewed-on: https://gerrit.libreoffice.org/68031 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/func/fuconbez.cxx18
-rw-r--r--sd/source/ui/func/fuconrec.cxx7
-rw-r--r--sd/source/ui/inc/fuconbez.hxx3
-rw-r--r--sd/source/ui/inc/fuconrec.hxx1
-rw-r--r--sd/uiconfig/sdraw/toolbar/redactionbar.xml4
5 files changed, 27 insertions, 6 deletions
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index 978e27ddca3d..31f0ea0b7feb 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -56,7 +56,8 @@ namespace sd {
/*//Extra attributes coming from parameters
sal_uInt16 mnTransparence; // Default: 0
OUString msColor; // Default: ""
- sal_uInt16 mnWidth; // Default: 0*/
+ sal_uInt16 mnWidth; // Default: 0
+ OUString msShapeName; // Default: ""*/
FuConstructBezierPolygon::FuConstructBezierPolygon (
ViewShell* pViewSh,
::sd::Window* pWin,
@@ -114,9 +115,13 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
if (nSlotId != SID_DRAW_FREELINE_NOFILL)
return;
+ // This piece is only relevant for SID_DRAW_FREELINE_NOFILL
+ // Adding this note for the future because the if-block gets auto-flattened
+ // by loplugins
const SfxUInt16Item* pTransparence = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
const SfxStringItem* pColor = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
const SfxUInt16Item* pWidth = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
+ const SfxStringItem* pShapeName = rReq.GetArg<SfxStringItem>(SID_SHAPE_NAME);
if (pTransparence && pTransparence->GetValue() > 0)
{
@@ -130,6 +135,11 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
{
mnWidth = pWidth->GetValue();
}
+ if (pShapeName && !pShapeName->GetValue().isEmpty())
+ {
+ msShapeName = pShapeName->GetValue();
+ }
+ // End of the SID_DRAW_FREELINE_NOFILL block
}
bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
@@ -174,7 +184,7 @@ bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
{
SfxItemSet aAttr(mpDoc->GetPool());
SetStyleSheet(aAttr, pObj);
- SetAttributes(aAttr);
+ SetAttributes(aAttr, pObj);
pObj->SetMergedItemSet(aAttr);
}
}
@@ -352,7 +362,7 @@ Color strToColor(const OUString& sColor)
}
}
-void FuConstructBezierPolygon::SetAttributes(SfxItemSet& rAttr)
+void FuConstructBezierPolygon::SetAttributes(SfxItemSet& rAttr, SdrObject *pObj)
{
if (nSlotId == SID_DRAW_FREELINE_NOFILL)
{
@@ -362,6 +372,8 @@ void FuConstructBezierPolygon::SetAttributes(SfxItemSet& rAttr)
rAttr.Put(XLineColorItem(OUString(), strToColor(msColor)));
if (mnWidth > 0)
rAttr.Put(XLineWidthItem(mnWidth));
+ if (!msShapeName.isEmpty())
+ pObj->SetName(msShapeName);
}
}
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index bee469d76e09..edaf97aee68e 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -156,6 +156,7 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
const SfxUInt16Item* pFillTransparence = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
const SfxStringItem* pFillColor = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
const SfxUInt16Item* pLineStyle = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
+ const SfxStringItem* pShapeName = rReq.GetArg<SfxStringItem>(SID_SHAPE_NAME);
if (pFillTransparence && pFillTransparence->GetValue() > 0)
{
@@ -169,6 +170,10 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
{
mnLineStyle = pLineStyle->GetValue();
}
+ if (pShapeName && !pShapeName->GetValue().isEmpty())
+ {
+ msShapeName = pShapeName->GetValue();
+ }
if (!pMouseStartX || !pMouseStartY || !pMouseEndX || !pMouseEndY)
break;
@@ -565,6 +570,8 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
rAttr.Put(XFillTransparenceItem(mnFillTransparence));
if (!msFillColor.isEmpty())
rAttr.Put(XFillColorItem(OUString(), strToColor(msFillColor)));
+ if (!msShapeName.isEmpty())
+ pObj->SetName(msShapeName);
switch(mnLineStyle)
{
diff --git a/sd/source/ui/inc/fuconbez.hxx b/sd/source/ui/inc/fuconbez.hxx
index 21b4a5ba6aa6..907ebebfa930 100644
--- a/sd/source/ui/inc/fuconbez.hxx
+++ b/sd/source/ui/inc/fuconbez.hxx
@@ -50,7 +50,7 @@ public:
/**
* set attribute for the object to be created
*/
- void SetAttributes(SfxItemSet& rAttr);
+ void SetAttributes(SfxItemSet& rAttr, SdrObject* pObj);
virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override;
@@ -69,6 +69,7 @@ private:
sal_uInt16 mnTransparence; // Default: 0
OUString msColor; // Default: ""
sal_uInt16 mnWidth; // Default: 0
+ OUString msShapeName; // Default: ""
};
} // end of namespace sd
diff --git a/sd/source/ui/inc/fuconrec.hxx b/sd/source/ui/inc/fuconrec.hxx
index 978dc133bab2..1c8ce15a0dff 100644
--- a/sd/source/ui/inc/fuconrec.hxx
+++ b/sd/source/ui/inc/fuconrec.hxx
@@ -38,6 +38,7 @@ private:
sal_uInt16 mnFillTransparence; // Default: 0
OUString msFillColor; // Default: ""
sal_uInt16 mnLineStyle; // Default: SAL_MAX_UINT16
+ OUString msShapeName; // Default: ""
public:
diff --git a/sd/uiconfig/sdraw/toolbar/redactionbar.xml b/sd/uiconfig/sdraw/toolbar/redactionbar.xml
index a0fb06709377..43ce5e856f7a 100644
--- a/sd/uiconfig/sdraw/toolbar/redactionbar.xml
+++ b/sd/uiconfig/sdraw/toolbar/redactionbar.xml
@@ -18,8 +18,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
- <toolbar:toolbaritem xlink:href=".uno:Rect?FillTransparence:short=50&amp;FillColor:string=COL_GRAY7&amp;LineStyle:short=0&amp;IsSticky:bool=true"/>
- <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled?Transparence:short=50&amp;Color:string=COL_GRAY7&amp;Width:short=500&amp;IsSticky:bool=true"/>
+ <toolbar:toolbaritem xlink:href=".uno:Rect?FillTransparence:short=50&amp;FillColor:string=COL_GRAY7&amp;LineStyle:short=0&amp;IsSticky:bool=true&amp;ShapeName:string=RectangleRedactionShape"/>
+ <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled?Transparence:short=50&amp;Color:string=COL_GRAY7&amp;Width:short=500&amp;IsSticky:bool=true&amp;ShapeName:string=FreeformRedactionShape"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF?IsRedactMode:bool=true"/>
</toolbar:toolbar>