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 | 11 ++ 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 | 7 + sw/source/uibase/docvw/edtwin.cxx | 7 + sw/source/uibase/shells/drawsh.cxx | 10 -- sw/source/uibase/shells/drwbassh.cxx | 2 sw/source/uibase/uiview/view0.cxx | 9 ++ 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, 200 insertions(+), 66 deletions(-)
New commits: commit a56e0e2f855c101f9340f15ac416183e338fe030 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Wed Feb 5 13:59:04 2025 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Fri Feb 28 00:23:04 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> (cherry picked from commit c628a26cd3f763b39a2e2441fc766dabf04ed492) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182283 Tested-by: allotropia jenkins <jenk...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 68d02d4a86fc..9047b1131258 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 caffed00b5d4..fa6d0e2b2c0a 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 7880deebb46c..bef44c3b8eac 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -6657,6 +6657,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 b9f74d9724fa..bdde35c32b5a 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1816,6 +1816,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 b2d7d503b35b..6503470418f0 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -901,7 +901,17 @@ <value>1</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 d9e22c9cba78..f67025c5de26 100644 --- a/sc/inc/appoptio.hxx +++ b/sc/inc/appoptio.hxx @@ -74,6 +74,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; } @@ -101,6 +105,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 668608c549ab..6749c3f61c64 100644 --- a/sc/sdi/drawsh.sdi +++ b/sc/sdi/drawsh.sdi @@ -225,6 +225,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 7b44ca39fe4f..892b97c32880 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -78,6 +78,7 @@ void ScAppOptions::SetDefaults() nDefaultObjectSizeHeight = 5000; mbShowSharedDocumentWarning = true; + bClickChangeRotation = false; meKeyBindingType = ScOptionsUtil::KEY_DEFAULT; mbLinksInsertedLikeMSExcel = false; @@ -101,6 +102,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; @@ -185,6 +187,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"; @@ -251,7 +254,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() @@ -442,6 +446,8 @@ void ScAppCfg::ReadMiscCfg() SetDefaultObjectSizeHeight(nIntVal); SetShowSharedDocumentWarning( ScUnoHelpFunctions::GetBoolFromAny(aValues[SCMISCOPT_SHOWSHAREDDOCWARN])); + SetClickChangeRotation( + ScUnoHelpFunctions::GetBoolFromAny(aValues[SCMISCOPT_CLICKCHANGEROTATION])); } void ScAppCfg::ReadCompatCfg() @@ -609,6 +615,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 b24888e5c0f5..02b3d7c61bd8 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> @@ -407,7 +409,14 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) pView->SetAttrToMarked(*pNewArgs, false); rReq.Done(); break; - + case SID_CLICK_CHANGE_ROTATION: + { + ScAppOptions aNewOpts( SC_MOD()->GetAppOptions() ); + aNewOpts.SetClickChangeRotation(!aNewOpts.IsClickChangeRotation()); + SC_MOD()->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..03736e6addeb 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, + SC_MOD()->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 1873a525e9dd..021a368a4349 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -637,6 +637,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..78397f54d6e8 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 + && SC_MOD()->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 4404dbe3b44b..e1dd0baad398 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 7a2334b47ed8..92ca16dd2bc2 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 a765a1fd943d..45e453002a57 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 59bae8338825..b2eebb314632 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12764,3 +12764,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 6e7f0b4d2d05..57f17c5c7d73 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -552,6 +552,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 4f34c7286d3b..216d44fb05af 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -69,6 +69,7 @@ struct ViewOptFlags1 bool bShowOutlineContentVisibilityButton : 1; bool bShowChangesInMargin : 1; //tracked deletions in margin bool bShowChangesInMargin2 : 1; //tracked insertions in margin + bool bClickChangeRotation : 1; // change with single click into rotate mode ViewOptFlags1() : bUseHeaderFooterMenu(false) @@ -102,6 +103,7 @@ struct ViewOptFlags1 , bShowOutlineContentVisibilityButton(false) , bShowChangesInMargin(false) , bShowChangesInMargin2(false) + , bClickChangeRotation(false) {} bool operator==(const ViewOptFlags1& rOther) const @@ -136,7 +138,8 @@ struct ViewOptFlags1 && bPageback == rOther.bPageback && bShowOutlineContentVisibilityButton == rOther.bShowOutlineContentVisibilityButton && bShowChangesInMargin == rOther.bShowChangesInMargin - && bShowChangesInMargin2 == rOther.bShowChangesInMargin2; + && bShowChangesInMargin2 == rOther.bShowChangesInMargin2 + && bClickChangeRotation == rOther.bClickChangeRotation; } void dumpAsXml(xmlTextWriterPtr pWriter) const; @@ -660,6 +663,9 @@ public: bool IsMultipageView() const { return IsViewLayoutBookMode() || GetViewLayoutColumns() == 0; } + 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 1ec913474a44..2e46354842b1 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -1016,6 +1016,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 ea59c279b37e..f5a69afd21e0 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -125,7 +125,8 @@ Sequence<OUString> SwContentViewConfig::GetPropertyNames() const "Display/DefaultAnchor", // 25 "Zoom/DefaultZoom", // 26 "Zoom/ZoomType", // 27 - "Zoom/ZoomValue" //28 + "Zoom/ZoomValue", // 28 + "Draw/ClickChangeRotation" // 34 }; #if defined(__GNUC__) && !defined(__clang__) // clang 8.0.0 says strcmp isn't constexpr @@ -204,6 +205,7 @@ void SwContentViewConfig::ImplCommit() case 26: bVal = m_rParent.IsDefaultZoom(); break;// "Zoom/DefaultZoom" case 27:pValues[nProp] <<= static_cast<sal_Int32>(m_rParent.GetDefaultZoomType()); break; // "Zoom/ZoomType" case 28: pValues[nProp] <<= static_cast<sal_Int32>(m_rParent.GetDefaultZoomValue()); break; // "Zoom/ZoomValue" + case 29: bVal = m_rParent.IsClickChangeRotation(); break; // "Draw/ClickChangeRotation" } if ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor) && (nProp != g_ZoomType) && (nProp != g_ZoomValue)) @@ -280,7 +282,8 @@ void SwContentViewConfig::Load() pValues[nProp] >>= nSet; m_rParent.SetDefaultZoomValue(static_cast<sal_uInt16>(nSet), true); } - break; //"Zoom/ZoomValue" + break; //"Zoom/ZoomValue" // 28 + case 29: m_rParent.SetClickChangeRotation(bSet); break; // "Draw/ClickChangeRotation" } } } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 6893aea25a04..0848e30e9339 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -19,6 +19,7 @@ #include <config_wasm_strip.h> +#include <swmodule.hxx> #include <swtypes.hxx> #include <hintids.hxx> @@ -112,6 +113,7 @@ #include <breakit.hxx> #include <checkit.hxx> #include <pagefrm.hxx> +#include <usrpref.hxx> #include <helpids.h> #include <cmdid.h> @@ -4757,6 +4759,11 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) { pSdrView->UnmarkAllObj(); pSdrView->MarkObj(pObj, pPV); + if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 && + SW_MOD()->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 dd93cb847387..2759d19cbea6 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.IsObjSelected() && 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 1a8f8640b44a..ca1b82e80da9 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -1009,8 +1009,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 8d236be3ce87..c5a924f91ee0 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -352,6 +352,9 @@ void SwView::StateViewOptions(SfxItemSet &rSet) case SID_SPOTLIGHT_CHARSTYLES: aBool.SetValue(m_bIsSpotlightCharStyles); break; + case SID_CLICK_CHANGE_ROTATION: + aBool.SetValue( pOpt->IsClickChangeRotation()); + break; } if( nWhich ) @@ -690,6 +693,12 @@ void SwView::ExecViewOptions(SfxRequest &rReq) pOpt->SetShowChangesInMargin( bFlag ); break; + case SID_CLICK_CHANGE_ROTATION: + if( STATE_TOGGLE == eState ) + bFlag = !pOpt->IsClickChangeRotation(); + pOpt->SetClickChangeRotation(bFlag); + break; + default: OSL_FAIL("wrong request method"); return; diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 68d4a21cc87d..003f884a5959 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->IsObjSelected() && + 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>