[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - include/sfx2 officecfg/registry sd/source sd/uiconfig sfx2/source svx/sdi

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 27 20:44:06 UTC 2019


 include/sfx2/sfxsids.hrc                                             |    4 
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |    4 
 sd/source/ui/func/fuconbez.cxx                                       |   14 ++-
 sd/source/ui/func/fuconrec.cxx                                       |    7 +
 sd/source/ui/inc/fuconbez.hxx                                        |    3 
 sd/source/ui/inc/fuconrec.hxx                                        |    1 
 sd/uiconfig/sdraw/toolbar/redactionbar.xml                           |    4 
 sfx2/source/doc/objserv.cxx                                          |   46 +++-------
 svx/sdi/svx.sdi                                                      |    6 -
 9 files changed, 46 insertions(+), 43 deletions(-)

New commits:
commit 6f5466e19e7a645ad0a8215c29a2a3a0213e6dd6
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Tue Feb 19 23:41:57 2019 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Mar 27 21:43:37 2019 +0100

    Use named shapes for redaction
    
    Change-Id: Ibb55bd503d264b618c3fbebfdbcf3fe9958c6783
    Reviewed-on: https://gerrit.libreoffice.org/68031
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/69835
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 68e2055db36c..e275ba953a69 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -406,7 +406,9 @@
 #define SID_PASTE_ONLY_TEXT                 (SID_SFX_START + 802)
 #define SID_PASTE_ONLY_FORMULA              (SID_SFX_START + 803)
 #define SID_PASTE_ONLY_VALUE                (SID_SFX_START + 804)
-    // FREE: SID_SFX_START + 808
+
+// Used for redaction
+#define SID_SHAPE_NAME                      (SID_SFX_START + 808)
     // FREE: SID_SFX_START + 809
     // FREE: SID_SFX_START + 810
 #define SID_ASYNCHRON                       (SID_SFX_START + 811)
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 7f92b83df9e9..1a26c35eb2d1 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2071,7 +2071,7 @@
           <value>1</value>
         </prop>
       </node>
-      <node oor:name=".uno:Rect?FillTransparence:short=50&FillColor:string=COL_GRAY7&LineStyle:short=0&IsSticky:bool=true" oor:op="replace">
+      <node oor:name=".uno:Rect?FillTransparence:short=50&FillColor:string=COL_GRAY7&LineStyle:short=0&IsSticky:bool=true&ShapeName:string=RectangleRedactionShape" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Rectangle</value>
         </prop>
@@ -4666,7 +4666,7 @@
           <value>1</value>
         </prop>
       </node>
-      <node oor:name=".uno:Freeline_Unfilled?Transparence:short=50&Color:string=COL_GRAY7&Width:short=500&IsSticky:bool=true" oor:op="replace">
+      <node oor:name=".uno:Freeline_Unfilled?Transparence:short=50&Color:string=COL_GRAY7&Width:short=500&IsSticky:bool=true&ShapeName:string=FreeformRedactionShape" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Freeform</value>
         </prop>
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index bb7352328d10..b6de7982701a 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -55,7 +55,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,6 +115,7 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
             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)
             {
@@ -127,6 +129,10 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
             {
                 mnWidth = pWidth->GetValue();
             }
+            if (pShapeName && !pShapeName->GetValue().isEmpty())
+            {
+                msShapeName = pShapeName->GetValue();
+            }
         }
     }
 }
@@ -173,7 +179,7 @@ bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
         {
             SfxItemSet aAttr(mpDoc->GetPool());
             SetStyleSheet(aAttr, pObj);
-            SetAttributes(aAttr);
+            SetAttributes(aAttr, pObj);
             pObj->SetMergedItemSet(aAttr);
         }
     }
@@ -351,7 +357,7 @@ Color strToColor(const OUString& sColor)
 }
 }
 
-void FuConstructBezierPolygon::SetAttributes(SfxItemSet& rAttr)
+void FuConstructBezierPolygon::SetAttributes(SfxItemSet& rAttr, SdrObject *pObj)
 {
     if (nSlotId == SID_DRAW_FREELINE_NOFILL)
     {
@@ -361,6 +367,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 6631a8705294..91c629240380 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -152,6 +152,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)
                 {
@@ -165,6 +166,10 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
                 {
                     mnLineStyle = pLineStyle->GetValue();
                 }
+                if (pShapeName && !pShapeName->GetValue().isEmpty())
+                {
+                    msShapeName = pShapeName->GetValue();
+                }
 
                 if (!pMouseStartX || !pMouseStartY || !pMouseEndX || !pMouseEndY)
                     break;
@@ -564,6 +569,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 2ec20f0a0488..c7a14915911c 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 SdrObject* 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 d792fa822fb9..14884fe2f452 100644
--- a/sd/source/ui/inc/fuconrec.hxx
+++ b/sd/source/ui/inc/fuconrec.hxx
@@ -40,6 +40,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&FillColor:string=COL_GRAY7&LineStyle:short=0&IsSticky:bool=true"/>
- <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled?Transparence:short=50&Color:string=COL_GRAY7&Width:short=500&IsSticky:bool=true"/>
+ <toolbar:toolbaritem xlink:href=".uno:Rect?FillTransparence:short=50&FillColor:string=COL_GRAY7&LineStyle:short=0&IsSticky:bool=true&ShapeName:string=RectangleRedactionShape"/>
+ <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled?Transparence:short=50&Color:string=COL_GRAY7&Width:short=500&IsSticky:bool=true&ShapeName:string=FreeformRedactionShape"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF?IsRedactMode:bool=true"/>
 </toolbar:toolbar>
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 1cc2a0f4f8fc..b0a3b933d8bc 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -720,45 +720,27 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                         if (!xInfo.is())
                             continue;
 
+                        OUString sShapeName;
+                        if (xInfo->hasPropertyByName("Name"))
+                        {
+                            uno::Any aAnyShapeName = xPropSet->getPropertyValue("Name");
+                            aAnyShapeName >>= sShapeName;
+                        }
+                        else
+                            continue;
                         // Rectangle redaction
-                        if (xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor"))
+                        if (sShapeName == "RectangleRedactionShape"
+                                && xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor"))
                         {
-                            uno::Any aAnyTransp = xPropSet->getPropertyValue("FillTransparence");
-                            uno::Any aAnyColor = xPropSet->getPropertyValue("FillColor");
-
-                            sal_Int16 nTransp = 0;
-                            const OUString sRectangleName("RectangleRedactionShape");
-
-                            aAnyTransp >>= nTransp;
-                            Color aColor(aAnyColor.get<sal_Int32>());
-
-
-                            if (nTransp == 50 && aColor == COL_GRAY7)
-                            {
-                                xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast<sal_Int16>(0)));
-                                xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK));
-                                xPropSet->setPropertyValue("Name", css::uno::makeAny(sRectangleName));
-                            }
+                            xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast<sal_Int16>(0)));
+                            xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK));
                         }
-                        //FIXME: Turn this into an else-if when we have the name-check
                         // Freeform redaction
-                        if (xInfo->hasPropertyByName("LineTransparence") && xInfo->hasPropertyByName("LineColor"))
+                        else if (sShapeName == "FreeformRedactionShape"
+                                 && xInfo->hasPropertyByName("LineTransparence") && xInfo->hasPropertyByName("LineColor"))
                         {
-                            uno::Any aAnyTransp = xPropSet->getPropertyValue("LineTransparence");
-                            uno::Any aAnyColor = xPropSet->getPropertyValue("LineColor");
-
-                            sal_Int16 nTransp = 0;
-                            const OUString sFreeformName("FreeformRedactionShape");
-
-                            aAnyTransp >>= nTransp;
-                            Color aColor(aAnyColor.get<sal_Int32>());
-
-                            if (nTransp == 50 && aColor == COL_GRAY7)
-                            {
                                 xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(static_cast<sal_Int16>(0)));
                                 xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_BLACK));
-                                xPropSet->setPropertyValue("Name", css::uno::makeAny(sFreeformName));
-                            }
                         }
                     }
                 }
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index bc06f302d339..f929e6625276 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -3456,7 +3456,8 @@ SfxBoolItem Freeline SID_DRAW_FREELINE
 
 SfxBoolItem Freeline_Unfilled SID_DRAW_FREELINE_NOFILL
 (SfxUInt16Item Transparence FN_PARAM_1, SfxStringItem Color FN_PARAM_2,
- SfxUInt16Item Width FN_PARAM_3, SfxBoolItem IsSticky FN_PARAM_4)
+ SfxUInt16Item Width FN_PARAM_3, SfxBoolItem IsSticky FN_PARAM_4,
+ SfxStringItem ShapeName SID_SHAPE_NAME)
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,
@@ -6832,7 +6833,8 @@ SfxBoolItem Rect SID_DRAW_RECT
 (SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X, SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,
  SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X, SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y,
  SfxUInt16Item FillTransparence FN_PARAM_1, SfxStringItem FillColor FN_PARAM_2,
- SfxUInt16Item LineStyle FN_PARAM_3, SfxBoolItem IsSticky FN_PARAM_4)
+ SfxUInt16Item LineStyle FN_PARAM_3, SfxBoolItem IsSticky FN_PARAM_4,
+ SfxStringItem ShapeName SID_SHAPE_NAME)
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,


More information about the Libreoffice-commits mailing list