include/svx/svxids.hrc                                                   |    
1 
 officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu |    
8 --
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu     |    
8 ++
 officecfg/registry/schema/org/openoffice/Office/Calc.xcs                 |   
10 ++
 officecfg/registry/schema/org/openoffice/Office/Writer.xcs               |   
12 ++-
 sc/inc/appoptio.hxx                                                      |    
5 +
 sc/sdi/drawsh.sdi                                                        |    
1 
 sc/source/core/tool/appoptio.cxx                                         |   
11 ++
 sc/source/ui/drawfunc/drawsh.cxx                                         |   
12 ++-
 sc/source/ui/drawfunc/drawsh2.cxx                                        |    
4 +
 sc/source/ui/drawfunc/drawsh5.cxx                                        |   
16 ----
 sc/source/ui/drawfunc/fupoor.cxx                                         |    
3 
 sc/source/ui/inc/fupoor.hxx                                              |    
6 +
 sc/source/ui/inc/tabview.hxx                                             |    
2 
 sc/source/ui/view/gridwin3.cxx                                           |   
40 ++++++++--
 sc/source/ui/view/tabview5.cxx                                           |   
21 +++++
 sc/uiconfig/scalc/toolbar/drawbar.xml                                    |    
1 
 sd/inc/app.hrc                                                           |    
2 
 sd/sdi/sdraw.sdi                                                         |   
18 ----
 svx/sdi/svx.sdi                                                          |   
16 ++++
 sw/inc/view.hxx                                                          |    
2 
 sw/inc/viewopt.hxx                                                       |    
8 +-
 sw/sdi/_viewsh.sdi                                                       |    
6 +
 sw/source/uibase/config/usrpref.cxx                                      |    
5 +
 sw/source/uibase/docvw/edtwin.cxx                                        |    
6 +
 sw/source/uibase/shells/drawsh.cxx                                       |   
10 --
 sw/source/uibase/shells/drwbassh.cxx                                     |    
2 
 sw/source/uibase/uiview/view0.cxx                                        |    
8 ++
 sw/source/uibase/uiview/viewdraw.cxx                                     |   
14 +++
 sw/uiconfig/sglobal/toolbar/drawbar.xml                                  |    
1 
 sw/uiconfig/swform/toolbar/drawbar.xml                                   |    
1 
 sw/uiconfig/swreport/toolbar/drawbar.xml                                 |    
1 
 sw/uiconfig/swriter/toolbar/drawbar.xml                                  |    
1 
 sw/uiconfig/swxform/toolbar/drawbar.xml                                  |    
1 
 34 files changed, 198 insertions(+), 65 deletions(-)

New commits:
commit c628a26cd3f763b39a2e2441fc766dabf04ed492
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Wed Feb 5 13:59:04 2025 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Feb 27 11:13:38 2025 +0100

    tdf#90293 switch draw selection to rotate mode
    
    Clicking a draw object(selection) switches to rotate mode and
    back in Calc/Writer like it is done in Draw/Impress already.
    By default this function is off an can be activated in
    via toolbar Drawing
    
    Change-Id: I4a11d008e7df97c5278cae987d5c47fa50cddf14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181169
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Tested-by: Jenkins
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index cf2b984ca936..f2a4dd602e2b 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -147,6 +147,7 @@ class XFillGradientItem;
 #define SID_ATTR_SYMBOLSIZE                 
TypedWhichId<SvxSizeItem>(SID_SD_START+116)
 #define SID_HELPLINES_MOVE                  (SID_SD_START+153)
 #define SID_GRID_USE                        (SID_SD_START+154)
+#define SID_CLICK_CHANGE_ROTATION           (SID_SD_START+170)
 #define ID_VAL_MOUSESTART_X                 (SID_SD_START+200)
 #define ID_VAL_MOUSESTART_Y                 (SID_SD_START+201)
   // free
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 38c4485d565c..6d09d6068ac8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -1717,14 +1717,6 @@
           <value xml:lang="en-US">E~dit Style...</value>
         </prop>
       </node>
-      <node oor:name=".uno:ClickChangeRotation" oor:op="replace">
-        <prop oor:name="Label" oor:type="xs:string">
-          <value xml:lang="en-US">Rotation Mode after Clicking Object</value>
-        </prop>
-        <prop oor:name="Properties" oor:type="xs:int">
-          <value>1</value>
-        </prop>
-      </node>
       <node oor:name=".uno:Mirror" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Flip</value>
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index e0a47bb0be5f..21fdf0298162 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6687,6 +6687,14 @@ bit 3 (0x8): #define 
UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:ClickChangeRotation" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Rotation Mode after Clicking Object</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
     </node>
     <node oor:name="Popups">
       <node oor:name=".uno:PasteSpecialMenu" oor:op="replace">
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 854b480bc424..98e1afc76b89 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1875,6 +1875,16 @@
           <value>true</value>
         </prop>
       </group>
+      <group oor:name="Draw">
+        <prop oor:name="ClickChangeRotation" oor:type="xs:boolean" 
oor:nillable="false">
+          <!-- UIHints: Configured into draw toolbar -->
+          <info>
+            <desc>Enables to toggle rotate mode in shapes.</desc>
+            <label>ClickChangeRotation</label>
+          </info>
+          <value>true</value>
+        </prop>
+      </group>
     </group>
     <group oor:name="Compatibility">
       <info>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index af4fcfe28484..1acc49a8c739 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -940,7 +940,17 @@
           <value>true</value>
         </prop>
       </group>
-      <group oor:name="Zoom">
+      <group oor:name="Draw">
+          <prop oor:name="ClickChangeRotation" oor:type="xs:boolean" 
oor:nillable="false">
+              <!-- UIHints: Configured into draw toolbar -->
+              <info>
+                  <desc>Enables to toggle rotate mode in shapes.</desc>
+                  <label>ClickChangeRotation</label>
+              </info>
+              <value>true</value>
+          </prop>
+      </group>
+        <group oor:name="Zoom">
           <info>
               <desc>Contains zoom settings of the document view.</desc>
           </info>
diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx
index af637c5dbdef..d4beeec78c06 100644
--- a/sc/inc/appoptio.hxx
+++ b/sc/inc/appoptio.hxx
@@ -76,6 +76,10 @@ public:
 
     void        SetShowSharedDocumentWarning( bool bNew )   { 
mbShowSharedDocumentWarning = bNew; }
     bool        GetShowSharedDocumentWarning() const        { return 
mbShowSharedDocumentWarning; }
+
+    void        SetClickChangeRotation( bool bNew ) { bClickChangeRotation = 
bNew; }
+    bool        IsClickChangeRotation() const { return bClickChangeRotation; }
+
     ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return 
meKeyBindingType; }
     void        SetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { 
meKeyBindingType = e; }
 
@@ -104,6 +108,7 @@ private:
     sal_Int32       nDefaultObjectSizeWidth;
     sal_Int32       nDefaultObjectSizeHeight;
     bool            mbShowSharedDocumentWarning;
+    bool            bClickChangeRotation;
     ScOptionsUtil::KeyBindingType meKeyBindingType;
     bool            mbLinksInsertedLikeMSExcel;
 };
diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi
index 87688e93f8f7..cf840a07be43 100644
--- a/sc/sdi/drawsh.sdi
+++ b/sc/sdi/drawsh.sdi
@@ -229,6 +229,7 @@ interface TableDraw
     SID_MOVE_SHAPE_HANDLE           [ ExecMethod = ExecDrawAttr; ]
     SID_ATTR_TEXTCOLUMNS_NUMBER     [ ExecMethod = ExecDrawAttr; StateMethod = 
GetDrawAttrState; ]
     SID_ATTR_TEXTCOLUMNS_SPACING    [ ExecMethod = ExecDrawAttr; StateMethod = 
GetDrawAttrState; ]
+    SID_CLICK_CHANGE_ROTATION       [ ExecMethod = ExecDrawAttr; StateMethod = 
GetState; ]
 }
 
 
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index e6137341094d..3825ccf8468b 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -79,6 +79,7 @@ void ScAppOptions::SetDefaults()
     nDefaultObjectSizeHeight = 5000;
 
     mbShowSharedDocumentWarning = true;
+    bClickChangeRotation = false;
 
     meKeyBindingType     = ScOptionsUtil::KEY_DEFAULT;
     mbLinksInsertedLikeMSExcel = false;
@@ -103,6 +104,7 @@ ScAppOptions& ScAppOptions::operator=( const ScAppOptions& 
rCpy )
     nDefaultObjectSizeWidth = rCpy.nDefaultObjectSizeWidth;
     nDefaultObjectSizeHeight = rCpy.nDefaultObjectSizeHeight;
     mbShowSharedDocumentWarning = rCpy.mbShowSharedDocumentWarning;
+    bClickChangeRotation = rCpy.bClickChangeRotation;
     meKeyBindingType  = rCpy.meKeyBindingType;
     mbLinksInsertedLikeMSExcel = rCpy.mbLinksInsertedLikeMSExcel;
     return *this;
@@ -193,6 +195,7 @@ constexpr OUStringLiteral CFGPATH_MISC = 
u"Office.Calc/Misc";
 #define SCMISCOPT_DEFOBJWIDTH       0
 #define SCMISCOPT_DEFOBJHEIGHT      1
 #define SCMISCOPT_SHOWSHAREDDOCWARN 2
+#define SCMISCOPT_CLICKCHANGEROTATION 3
 
 constexpr OUStringLiteral CFGPATH_COMPAT = u"Office.Calc/Compatibility";
 
@@ -260,7 +263,8 @@ Sequence<OUString> ScAppCfg::GetMiscPropertyNames()
 {
     return {u"DefaultObjectSize/Width"_ustr,      // SCMISCOPT_DEFOBJWIDTH
             u"DefaultObjectSize/Height"_ustr,     // SCMISCOPT_DEFOBJHEIGHT
-            u"SharedDocument/ShowWarning"_ustr};  // 
SCMISCOPT_SHOWSHAREDDOCWARN
+            u"SharedDocument/ShowWarning"_ustr,   // 
SCMISCOPT_SHOWSHAREDDOCWARN
+            u"Draw/ClickChangeRotation"_ustr};    // 
SCMISCOPT_CLICKCHANGEROTATION
 }
 
 Sequence<OUString> ScAppCfg::GetCompatPropertyNames()
@@ -465,6 +469,8 @@ void ScAppCfg::ReadMiscCfg()
         SetDefaultObjectSizeHeight(nIntVal);
     SetShowSharedDocumentWarning(
         
ScUnoHelpFunctions::GetBoolFromAny(aValues[SCMISCOPT_SHOWSHAREDDOCWARN]));
+    SetClickChangeRotation(
+        
ScUnoHelpFunctions::GetBoolFromAny(aValues[SCMISCOPT_CLICKCHANGEROTATION]));
 }
 
 void ScAppCfg::ReadCompatCfg()
@@ -635,6 +641,9 @@ IMPL_LINK_NOARG(ScAppCfg, MiscCommitHdl, ScLinkConfigItem&, 
void)
             case SCMISCOPT_SHOWSHAREDDOCWARN:
                 pValues[nProp] <<= GetShowSharedDocumentWarning();
                 break;
+            case SCMISCOPT_CLICKCHANGEROTATION:
+                pValues[nProp] <<= IsClickChangeRotation();
+                break;
         }
     }
     aMiscItem.PutProperties(aNames, aValues);
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index f679b031f3a5..e466ba00b4f7 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -47,6 +47,8 @@
 #include <scslots.hxx>
 
 #include <userdat.hxx>
+#include <scmod.hxx>
+#include <appoptio.hxx>
 #include <svl/macitem.hxx>
 #include <sfx2/evntconf.hxx>
 #include <sfx2/viewsh.hxx>
@@ -411,7 +413,15 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
                 pView->SetAttrToMarked(*pNewArgs, false);
             rReq.Done();
             break;
-
+        case SID_CLICK_CHANGE_ROTATION:
+            {
+                ScModule* pScMod = ScModule::get();
+                ScAppOptions aNewOpts( pScMod->GetAppOptions() );
+                
aNewOpts.SetClickChangeRotation(!aNewOpts.IsClickChangeRotation());
+                pScMod->SetAppOptions(aNewOpts);
+                rReq.Done();
+            }
+            break;
         default:
             break;
     }
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index 04a27dbfd35c..579b55a63f23 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -45,6 +45,8 @@
 #include <drwlayer.hxx>
 #include <drtxtob.hxx>
 #include <gridwin.hxx>
+#include <scmod.hxx>
+#include <appoptio.hxx>
 #include <svx/svdoole2.hxx>
 #include <svx/xflgrit.hxx>
 #include <comphelper/lok.hxx>
@@ -92,6 +94,8 @@ void ScDrawShell::GetState( SfxItemSet& rSet )          // 
Conditions / Toggles
     rSet.Put( SfxBoolItem( SID_OBJECT_ROTATE, eMode == SdrDragMode::Rotate ) );
     rSet.Put( SfxBoolItem( SID_OBJECT_MIRROR, eMode == SdrDragMode::Mirror ) );
     rSet.Put( SfxBoolItem( SID_BEZIER_EDIT, !pView->IsFrameDragSingles() ) );
+    rSet.Put(SfxBoolItem(SID_CLICK_CHANGE_ROTATION,
+                         
ScModule::get()->GetAppOptions().IsClickChangeRotation()));
 
     sal_uInt16 nFWId = ScGetFontWorkId();
     SfxViewFrame& rViewFrm = rViewData.GetViewShell()->GetViewFrame();
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx 
b/sc/source/ui/drawfunc/drawsh5.cxx
index 58b3f3538da6..28452b09dd38 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -417,21 +417,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
             break;
 
         case SID_OBJECT_ROTATE:
-            {
-                SdrDragMode eMode;
-                if (pView->GetDragMode() == SdrDragMode::Rotate)
-                    eMode = SdrDragMode::Move;
-                else
-                    eMode = SdrDragMode::Rotate;
-                pView->SetDragMode( eMode );
-                rBindings.Invalidate( SID_OBJECT_ROTATE );
-                rBindings.Invalidate( SID_OBJECT_MIRROR );
-                if (eMode == SdrDragMode::Rotate && 
!pView->IsFrameDragSingles())
-                {
-                    pView->SetFrameDragSingles();
-                    rBindings.Invalidate( SID_BEZIER_EDIT );
-                }
-            }
+            rViewData.GetViewShell()->SwitchRotateMode();
             break;
         case SID_OBJECT_MIRROR:
             {
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index 93b0e47ce010..1c1aecbb4b2a 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -43,7 +43,8 @@ FuPoor::FuPoor(ScTabViewShell& rViewSh, vcl::Window* pWin, 
ScDrawView* pViewP,
     aDragTimer("sc FuPoor aDragTimer"),
     bIsInDragMode(false),
     // remember MouseButton state
-    mnCode(0)
+    mnCode(0),
+    mbSelectionHasChanged(false)
 {
     aScrollTimer.SetInvokeHandler( LINK(this, FuPoor, ScrollHdl) );
     aScrollTimer.SetTimeout(SELENG_AUTOREPEAT_INTERVAL);
diff --git a/sc/source/ui/inc/fupoor.hxx b/sc/source/ui/inc/fupoor.hxx
index 6f226776b03f..79e1bf86db33 100644
--- a/sc/source/ui/inc/fupoor.hxx
+++ b/sc/source/ui/inc/fupoor.hxx
@@ -60,7 +60,7 @@ protected:
     // of own MouseEvents (like in ScrollHdl)
 private:
     sal_uInt16      mnCode;
-
+    bool            mbSelectionHasChanged;
 public:
     FuPoor(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pView,
            SdrModel* pDoc, const SfxRequest& rReq);
@@ -96,6 +96,10 @@ public:
     // Create default drawing objects via keyboard
     virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 
nID, const tools::Rectangle& rRectangle);
 
+    void ResetSelectionHasChanged() {mbSelectionHasChanged = false;}
+    void SetSelectionHasChanged() {mbSelectionHasChanged = true;}
+    bool HasSelectionChanged() {return mbSelectionHasChanged;}
+
 protected:
     static void ImpForceQuadratic(tools::Rectangle& rRect);
 
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 51dd31c7ab63..5f6dd33668d1 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -638,6 +638,8 @@ public:
     SCCOL GetLOKEndHeaderCol() const { return mnLOKEndHeaderCol; }
 
     void SyncGridWindowMapModeFromDrawMapMode();
+
+    void SwitchRotateMode();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index c0aa97ded4c6..efee2251d880 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -31,15 +31,32 @@
 #include <output.hxx>
 #include <drawview.hxx>
 #include <fupoor.hxx>
+#include <scmod.hxx>
+#include <appoptio.hxx>
 
 #include <drawutil.hxx>
 #include <document.hxx>
 #include <comphelper/lok.hxx>
 
+static bool lcl_HasSelectionChanged(const SdrMarkList & rBeforeList, const 
SdrMarkList & rAfterList)
+{
+    if (rBeforeList.GetMarkCount() != rAfterList.GetMarkCount())
+        return true;
+    for (size_t nObject = 0; nObject < rBeforeList.GetMarkCount(); ++nObject)
+    {
+        if (rBeforeList.GetMark(nObject)->GetMarkedSdrObj() !=
+            rAfterList.GetMark(nObject)->GetMarkedSdrObj())
+            return true;
+    }
+    return false;
+}
+
 bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt)
 {
     bool bRet = false;
     FuPoor* pDraw = mrViewData.GetView()->GetDrawFuncPtr();
+    pDraw->ResetSelectionHasChanged();
+    ScDrawView* pDrView = mrViewData.GetScDrawView();
     if (pDraw && !mrViewData.IsRefMode())
     {
         MapMode aDrawMode = GetDrawMapMode();
@@ -56,9 +73,14 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& 
rMEvt)
         }
         else
         {
+            SdrMarkList aPreMarkList = pDrView->GetMarkedObjectList();
             bRet = pDraw->MouseButtonDown( rMEvt );
-            if ( bRet )
+            if (bRet)
+            {
+                if (lcl_HasSelectionChanged(aPreMarkList, 
pDrView->GetMarkedObjectList()))
+                    pDraw->SetSelectionHasChanged();
                 UpdateStatusPosSize();
+            }
         }
 
         if ( comphelper::LibreOfficeKit::isActive() && aOldMode != aDrawMode )
@@ -66,7 +88,6 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& 
rMEvt)
     }
 
     // cancel draw with right key
-    ScDrawView* pDrView = mrViewData.GetScDrawView();
     if ( pDrView && !rMEvt.IsLeft() && !bRet )
     {
         pDrView->BrkAction();
@@ -79,12 +100,13 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& 
rMEvt)
 {
     ScViewFunc* pView = mrViewData.GetView();
     bool bRet = false;
+    bool bLOKitActive = comphelper::LibreOfficeKit::isActive();
     FuPoor* pDraw = pView->GetDrawFuncPtr();
     if (pDraw && !mrViewData.IsRefMode())
     {
         MapMode aDrawMode = GetDrawMapMode();
         MapMode aOldMode = GetMapMode();
-        if ( comphelper::LibreOfficeKit::isActive() && aOldMode != aDrawMode )
+        if ( bLOKitActive && aOldMode != aDrawMode )
             SetMapMode( aDrawMode );
 
         pDraw->SetWindow( this );
@@ -92,9 +114,9 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt)
 
         // execute "format paint brush" for drawing objects
         SfxItemSet* pDrawBrush = pView->GetDrawBrushSet();
+        ScDrawView* pDrView = mrViewData.GetScDrawView();
         if ( pDrawBrush )
         {
-            ScDrawView* pDrView = mrViewData.GetScDrawView();
             if ( pDrView )
             {
                 pDrView->SetAttrToMarked(*pDrawBrush, true/*bReplaceAll*/);
@@ -103,8 +125,16 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& 
rMEvt)
             if ( !pView->IsPaintBrushLocked() )
                 pView->ResetBrushDocument(); // end paint brush mode if not 
locked
         }
+        else if (!bLOKitActive && 
pDrView->GetMarkedObjectList().GetMarkCount() > 0
+                 && rMEvt.IsLeft()
+                 && rMEvt.GetClicks() == 1
+            && ScModule::get()->GetAppOptions().IsClickChangeRotation()
+            && !pDraw->HasSelectionChanged())
+        {
+            mrViewData.GetView()->SwitchRotateMode();
+        }
 
-        if ( comphelper::LibreOfficeKit::isActive() && aOldMode != aDrawMode )
+        if ( bLOKitActive && aOldMode != aDrawMode )
             SetMapMode( aOldMode );
     }
 
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 6d293ea3f0d5..7bf17f688cd0 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -463,6 +463,27 @@ void ScTabView::ResetDrawDragMode()
         pDrawView->SetDragMode( SdrDragMode::Move );
 }
 
+void ScTabView::SwitchRotateMode()
+{
+    if (pDrawView)
+    {
+        SfxBindings& rBindings = aViewData.GetBindings();
+        SdrDragMode eMode;
+        if (pDrawView->GetDragMode() == SdrDragMode::Rotate)
+            eMode = SdrDragMode::Move;
+        else
+            eMode = SdrDragMode::Rotate;
+        pDrawView->SetDragMode( eMode );
+        rBindings.Invalidate( SID_OBJECT_ROTATE );
+        rBindings.Invalidate( SID_OBJECT_MIRROR );
+        if (eMode == SdrDragMode::Rotate && !pDrawView->IsFrameDragSingles())
+        {
+            pDrawView->SetFrameDragSingles();
+            rBindings.Invalidate( SID_BEZIER_EDIT );
+        }
+    }
+}
+
 void ScTabView::ViewOptionsHasChanged( bool bHScrollChanged, bool 
bGraphicsChanged )
 {
     //  create DrawView when grid should be displayed
diff --git a/sc/uiconfig/scalc/toolbar/drawbar.xml 
b/sc/uiconfig/scalc/toolbar/drawbar.xml
index 368ed8c39c6b..2e20e0c98915 100644
--- a/sc/uiconfig/scalc/toolbar/drawbar.xml
+++ b/sc/uiconfig/scalc/toolbar/drawbar.xml
@@ -59,4 +59,5 @@
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode"/>
  <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation"/>
 </toolbar:toolbar>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 34f0d368b8f9..8ff088781df6 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -217,7 +217,7 @@
 #define SID_PICK_THROUGH                    (SID_SD_START+159)
     // FREE 160 - 168
 #define SID_DOUBLECLICK_TEXTEDIT            (SID_SD_START+169)
-#define SID_CLICK_CHANGE_ROTATION           (SID_SD_START+170)
+// In svxids.hrc: #define SID_CLICK_CHANGE_ROTATION           
(SID_SD_START+170)
 #define SID_HELPLINES_VISIBLE               (SID_SD_START+179)
 #define SID_HELPLINES_FRONT                 (SID_SD_START+180)
 #define SID_BEFORE_OBJ                      (SID_SD_START+181)
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 5cb4bd732c42..3acde8972344 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -294,24 +294,6 @@ SfxVoidItem ChangePolygon SID_CHANGEPOLYGON
     GroupId = SfxGroupId::Drawing;
 ]
 
-SfxBoolItem ClickChangeRotation SID_CLICK_CHANGE_ROTATION
-
-[
-    AutoUpdate = FALSE,
-    FastCall = FALSE,
-    ReadOnlyDoc = FALSE,
-    Toggle = FALSE,
-    Container = FALSE,
-    RecordAbsolute = FALSE,
-    RecordPerSet;
-
-
-    AccelConfig = TRUE,
-    MenuConfig = TRUE,
-    ToolBoxConfig = TRUE,
-    GroupId = SfxGroupId::Options;
-]
-
 SfxVoidItem CloseObject SID_OBJECT_CLOSE
 ()
 [
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index edc54923f4d0..2fdfc5165172 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12841,3 +12841,19 @@ SdrMetricItem TextColumnsSpacing 
SID_ATTR_TEXTCOLUMNS_SPACING
     ToolBoxConfig = FALSE,
     GroupId = SfxGroupId::Format;
 ]
+
+SfxBoolItem ClickChangeRotation SID_CLICK_CHANGE_ROTATION
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Options;
+]
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index ccfeb48b1a4e..a70668a09048 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -556,6 +556,8 @@ public:
     void            SetSelDrawSlot();
     void     FlipDrawSelMode()   { m_bDrawSelMode = !m_bDrawSelMode; }
     void            NoRotate();     // turn off rotate mode
+    void            ToggleRotate();     // switch between move and rotate mode
+
     bool            EnterDrawTextMode(const Point& aDocPos);
     /// Same as EnterDrawTextMode(), but takes an SdrObject instead of 
guessing it by document position.
     bool EnterShapeDrawTextMode(SdrObject* pObject);
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index d5163b26b2c5..fecb5e204f32 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -78,6 +78,7 @@ struct ViewOptFlags1
     bool bSectionBoundaries : 1;   // section boundaries
     bool bTableBoundaries : 1;   // table boundaries
     bool bShowBoundaries : 1;   // show all boundaries
+    bool bClickChangeRotation : 1; // change with single click into rotate mode
 
     ViewOptFlags1()
         : bUseHeaderFooterMenu(false)
@@ -117,6 +118,7 @@ struct ViewOptFlags1
         , bSectionBoundaries(true)
         , bTableBoundaries(true)
         , bShowBoundaries(true)
+        , bClickChangeRotation(false)
     {}
 
     bool operator==(const ViewOptFlags1& rOther) const
@@ -157,7 +159,8 @@ struct ViewOptFlags1
             && bTextBoundariesFull == rOther.bTextBoundariesFull
             && bSectionBoundaries == rOther.bSectionBoundaries
             && bTableBoundaries == rOther.bTableBoundaries
-            && bShowBoundaries == rOther.bShowBoundaries;
+            && bShowBoundaries == rOther.bShowBoundaries
+            && bClickChangeRotation == rOther.bClickChangeRotation;
     }
 
     void dumpAsXml(xmlTextWriterPtr pWriter) const;
@@ -692,6 +695,9 @@ public:
     bool IsShowBoundaries() const { return m_nCoreOptions.bShowBoundaries; }
     void SetShowBoundaries( bool b ) { m_nCoreOptions.bShowBoundaries = b; }
 
+    bool IsClickChangeRotation() const { return 
m_nCoreOptions.bClickChangeRotation; }
+    void SetClickChangeRotation( bool b ) { 
m_nCoreOptions.bClickChangeRotation = b; }
+
 #ifdef DBG_UTIL
     // Correspond to statements in ui/config/cfgvw.src.
     bool IsTest1() const     { return m_bTest1; }
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 71b2c08e0396..30116542a3e8 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -1041,6 +1041,12 @@ interface BaseTextEditView
         MenuConfig , AccelConfig , ToolBoxConfig ;
     ]
 
+    SID_CLICK_CHANGE_ROTATION
+    [
+        ExecMethod = ExecViewOptions ;
+        StateMethod = StateViewOptions ;
+    ]
+
     SID_MOVE_SHAPE_HANDLE
     [
         ExecMethod = Execute ;
diff --git a/sw/source/uibase/config/usrpref.cxx 
b/sw/source/uibase/config/usrpref.cxx
index 2904cd62abed..f6dbae1f63b2 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -129,7 +129,8 @@ Sequence<OUString> SwContentViewConfig::GetPropertyNames() 
const
         "Display/TextBoundariesFull",           // 30
         "Display/SectionBoundaries",            // 31
         "Display/TableBoundaries",              // 32
-        "Display/ShowBoundaries"                // 33
+        "Display/ShowBoundaries",               // 33
+        "Draw/ClickChangeRotation"              // 34
     };
 #if defined(__GNUC__) && !defined(__clang__)
     // clang 8.0.0 says strcmp isn't constexpr
@@ -213,6 +214,7 @@ void SwContentViewConfig::ImplCommit()
             case 31: bVal = m_rParent.IsSectionBoundaries(); break; // 
"Display/SectionBoundaries"
             case 32: bVal = m_rParent.IsTableBoundaries(); break; // 
"Display/TableBoundaries"
             case 33: bVal = m_rParent.IsShowBoundaries(); break; // 
"Display/ShowBoundaries"
+            case 34: bVal = m_rParent.IsClickChangeRotation(); break; // 
"Draw/ClickChangeRotation"
         }
         if ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor) &&
             (nProp != g_ZoomType) && (nProp != g_ZoomValue))
@@ -295,6 +297,7 @@ void SwContentViewConfig::Load()
                 case 31: m_rParent.SetSectionBoundaries(bSet); break; 
//"Display/SectionBoundaries"
                 case 32: m_rParent.SetTableBoundaries(bSet); break; 
//"Display/TableBoundaries"
                 case 33: m_rParent.SetShowBoundaries(bSet); break; 
//"Display/ShowBoundaries"
+                case 34: m_rParent.SetClickChangeRotation(bSet); break; // 
"Draw/ClickChangeRotation"
             }
         }
     }
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 047ebd3f5555..85e7cce4fce3 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -112,6 +112,7 @@
 #include <breakit.hxx>
 #include <checkit.hxx>
 #include <pagefrm.hxx>
+#include <usrpref.hxx>
 
 #include <helpids.h>
 #include <cmdid.h>
@@ -4791,6 +4792,11 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
                     {
                         pSdrView->UnmarkAllObj();
                         pSdrView->MarkObj(pObj, pPV);
+                        if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
+                            SwModule::get()->GetUsrPref(
+                                dynamic_cast<const SwWebView*>(&m_rView) != 
nullptr)->
+                            IsClickChangeRotation())
+                            m_rView.ToggleRotate();
                     }
                     else
                     {
diff --git a/sw/source/uibase/shells/drawsh.cxx 
b/sw/source/uibase/shells/drawsh.cxx
index fa9e71964a5a..b06e0602c389 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -188,15 +188,7 @@ void SwDrawShell::Execute(SfxRequest &rReq)
     switch (nSlotId)
     {
         case SID_OBJECT_ROTATE:
-            if (rSh.GetSelectedObjCount() && pSdrView->IsRotateAllowed())
-            {
-                if (GetView().IsDrawRotate())
-                    rSh.SetDragMode(SdrDragMode::Move);
-                else
-                    rSh.SetDragMode(SdrDragMode::Rotate);
-
-                GetView().FlipDrawRotate();
-            }
+            GetView().ToggleRotate();
             break;
         case SID_MOVE_SHAPE_HANDLE:
         {
diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index e41f76d1b4a7..3abb36d94093 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -1010,8 +1010,6 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
                 }
             }
             break;
-
-
         }
         nWhich = aIter.NextWhich();
     }
diff --git a/sw/source/uibase/uiview/view0.cxx 
b/sw/source/uibase/uiview/view0.cxx
index dab7f898fe51..a3ed716038da 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -371,6 +371,9 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
             case FN_BOOKVIEW:
                 aBool.SetValue( pOpt->IsViewLayoutBookMode());
             break;
+            case SID_CLICK_CHANGE_ROTATION:
+                aBool.SetValue( pOpt->IsClickChangeRotation());
+            break;
         }
 
         if( nWhich )
@@ -734,6 +737,11 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
         pOpt->SetViewLayoutColumns( 2 );
         pOpt->SetViewLayoutBookMode( true );
         break;
+    case SID_CLICK_CHANGE_ROTATION:
+        if( STATE_TOGGLE == eState )
+            bFlag = !pOpt->IsClickChangeRotation();
+        pOpt->SetClickChangeRotation(bFlag);
+    break;
 
     default:
         OSL_FAIL("wrong request method");
diff --git a/sw/source/uibase/uiview/viewdraw.cxx 
b/sw/source/uibase/uiview/viewdraw.cxx
index 0a82e404f331..99c68eb0c132 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -448,6 +448,20 @@ void SwView::NoRotate()
     }
 }
 
+void SwView::ToggleRotate()
+{
+    if (m_pWrtShell->GetSelectedObjCount() &&
+        m_pWrtShell->GetDrawView()->IsRotateAllowed())
+    {
+        if (IsDrawRotate())
+            m_pWrtShell->SetDragMode(SdrDragMode::Move);
+        else
+            m_pWrtShell->SetDragMode(SdrDragMode::Rotate);
+
+        FlipDrawRotate();
+    }
+}
+
 // Enable DrawTextEditMode
 
 static bool lcl_isTextBox(SdrObject const * pObject)
diff --git a/sw/uiconfig/sglobal/toolbar/drawbar.xml 
b/sw/uiconfig/sglobal/toolbar/drawbar.xml
index 1af47ad7b084..a45497fbf9c0 100644
--- a/sw/uiconfig/sglobal/toolbar/drawbar.xml
+++ b/sw/uiconfig/sglobal/toolbar/drawbar.xml
@@ -60,4 +60,5 @@
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode"/>
  <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation"/>
 </toolbar:toolbar>
diff --git a/sw/uiconfig/swform/toolbar/drawbar.xml 
b/sw/uiconfig/swform/toolbar/drawbar.xml
index 1af47ad7b084..a45497fbf9c0 100644
--- a/sw/uiconfig/swform/toolbar/drawbar.xml
+++ b/sw/uiconfig/swform/toolbar/drawbar.xml
@@ -60,4 +60,5 @@
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode"/>
  <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation"/>
 </toolbar:toolbar>
diff --git a/sw/uiconfig/swreport/toolbar/drawbar.xml 
b/sw/uiconfig/swreport/toolbar/drawbar.xml
index a6656f7d1e22..422d435480bb 100644
--- a/sw/uiconfig/swreport/toolbar/drawbar.xml
+++ b/sw/uiconfig/swreport/toolbar/drawbar.xml
@@ -48,4 +48,5 @@
  <toolbar:toolbaritem xlink:href=".uno:InsertGraphic"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation"/>
 </toolbar:toolbar>
diff --git a/sw/uiconfig/swriter/toolbar/drawbar.xml 
b/sw/uiconfig/swriter/toolbar/drawbar.xml
index a350f6ef4f51..a4893395f224 100644
--- a/sw/uiconfig/swriter/toolbar/drawbar.xml
+++ b/sw/uiconfig/swriter/toolbar/drawbar.xml
@@ -62,4 +62,5 @@
  <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle"/>
  <toolbar:toolbaritem xlink:href=".uno:GridVisible" toolbar:visible="false"/>
  <toolbar:toolbaritem xlink:href=".uno:GridUse" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation"/>
 </toolbar:toolbar>
diff --git a/sw/uiconfig/swxform/toolbar/drawbar.xml 
b/sw/uiconfig/swxform/toolbar/drawbar.xml
index 1af47ad7b084..a45497fbf9c0 100644
--- a/sw/uiconfig/swxform/toolbar/drawbar.xml
+++ b/sw/uiconfig/swxform/toolbar/drawbar.xml
@@ -60,4 +60,5 @@
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ToggleObjectBezierMode"/>
  <toolbar:toolbaritem xlink:href=".uno:ExtrusionToggle"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClickChangeRotation"/>
 </toolbar:toolbar>

Reply via email to