From 423cdbce049d09e0afa0f241b991587e20f7f84a Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Thu, 10 Jul 2025 13:20:16 +0300 Subject: [PATCH] tdf#128968 Remove redundant SwitchXFormsDesignMode option Instead, port code to use SwitchControlDesignMode everywhere. Change-Id: Iaca4bd3c29f9a156c529c526ea7e4e5af64f030f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187620 Reviewed-by: Heiko Tietze Tested-by: Jenkins --- .../integration/forms/DocumentViewHelper.java | 7 ++-- icon-themes/breeze/links.txt | 1 - icon-themes/breeze_dark/links.txt | 1 - icon-themes/colibre/links.txt | 1 - icon-themes/colibre_dark/links.txt | 1 - icon-themes/elementary/links.txt | 1 - icon-themes/sifr/links.txt | 1 - icon-themes/sifr_dark/links.txt | 1 - icon-themes/sukapura/links.txt | 1 - icon-themes/sukapura_dark/links.txt | 1 - .../openoffice/Office/UI/GenericCommands.xcu | 8 ----- sw/inc/cmdid.h | 2 -- sw/inc/view.hxx | 3 ++ sw/sdi/_basesh.sdi | 6 ---- sw/sdi/swriter.sdi | 19 ----------- sw/source/core/view/vnew.cxx | 9 ------ sw/source/uibase/shells/basesh.cxx | 32 ------------------- sw/source/uibase/uiview/view.cxx | 16 ++++++++++ sw/uiconfig/swxform/toolbar/formdesign.xml | 2 +- 19 files changed, 22 insertions(+), 91 deletions(-) diff --git a/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java index d936ea267ff4..870dd517e708 100644 --- a/forms/qa/integration/forms/DocumentViewHelper.java +++ b/forms/qa/integration/forms/DocumentViewHelper.java @@ -186,11 +186,8 @@ public class DocumentViewHelper */ protected void toggleFormDesignMode( ) throws java.lang.Exception { - if ( m_document instanceof XMLDocument ) - dispatch( ".uno:SwitchXFormsDesignMode" ); - else - dispatch( ".uno:SwitchControlDesignMode" ); - // at least SwitchControlDesignMode is async, so wait for it to be done + dispatch( ".uno:SwitchControlDesignMode" ); + // SwitchControlDesignMode is async, so wait for it to be done XToolkitExperimental xToolkit = UnoRuntime.queryInterface( XToolkitExperimental.class, m_orb.createInstance("com.sun.star.awt.Toolkit")); diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt index 1a03e4425e60..3950e18007b9 100644 --- a/icon-themes/breeze/links.txt +++ b/icon-themes/breeze/links.txt @@ -2249,7 +2249,6 @@ res/sx03253.png res/otp_16_8.png res/sx03254.png res/ots_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/breeze_dark/links.txt b/icon-themes/breeze_dark/links.txt index 9ed50a80ec2a..2bd33a6a42e9 100644 --- a/icon-themes/breeze_dark/links.txt +++ b/icon-themes/breeze_dark/links.txt @@ -2249,7 +2249,6 @@ res/sx03253.png res/otp_16_8.png res/sx03254.png res/ots_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/colibre/links.txt b/icon-themes/colibre/links.txt index 47ad12ee4355..7fb6f6e57c07 100644 --- a/icon-themes/colibre/links.txt +++ b/icon-themes/colibre/links.txt @@ -2109,7 +2109,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/colibre_dark/links.txt b/icon-themes/colibre_dark/links.txt index 31fb20c25afb..9ec8b526e650 100644 --- a/icon-themes/colibre_dark/links.txt +++ b/icon-themes/colibre_dark/links.txt @@ -2108,7 +2108,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/elementary/links.txt b/icon-themes/elementary/links.txt index d9252e2ea23f..f7c88a23c72d 100644 --- a/icon-themes/elementary/links.txt +++ b/icon-themes/elementary/links.txt @@ -1996,7 +1996,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/sifr/links.txt b/icon-themes/sifr/links.txt index 3057e780a7d3..660acebca08d 100644 --- a/icon-themes/sifr/links.txt +++ b/icon-themes/sifr/links.txt @@ -2064,7 +2064,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/sifr_dark/links.txt b/icon-themes/sifr_dark/links.txt index 597879305ef5..50b968337e22 100644 --- a/icon-themes/sifr_dark/links.txt +++ b/icon-themes/sifr_dark/links.txt @@ -2063,7 +2063,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/sukapura/links.txt b/icon-themes/sukapura/links.txt index f32501321a7f..90e7a3968797 100644 --- a/icon-themes/sukapura/links.txt +++ b/icon-themes/sukapura/links.txt @@ -2142,7 +2142,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/icon-themes/sukapura_dark/links.txt b/icon-themes/sukapura_dark/links.txt index ad59908a46c1..5e631704fd4d 100644 --- a/icon-themes/sukapura_dark/links.txt +++ b/icon-themes/sukapura_dark/links.txt @@ -2142,7 +2142,6 @@ res/sx03254.png res/ots_16_8.png res/sx03255.png res/ott_16_8.png res/sx03256.png cmd/sc_insertplugin.png res/sx10144.png cmd/sc_checkbox.png -res/sx10593.png cmd/sc_switchxformsdesignmode.png res/sx10594.png cmd/sc_pushbutton.png res/sx10595.png cmd/sc_radiobutton.png res/sx10596.png cmd/sc_checkbox.png diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 4b071fc33870..cd0cde2b0958 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -5836,14 +5836,6 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 9 - - - Design Mode On/Off - - - 9 - - Undo: Data entry diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 6828ad9f2734..6a21d4e2d65a 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -642,8 +642,6 @@ class SwUINumRuleItem; #define FN_UNO_COMPONENT (FN_EXTRA2 + 97) #define FN_WORDCOUNT_DIALOG (FN_EXTRA2 + 98) -#define FN_XFORMS_DESIGN_MODE (FN_EXTRA2 + 99) - #define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 100) #define FN_UNO_GRAPHIC (FN_EXTRA2 + 101) diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 3878d89f0849..4b83f10a01e9 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -358,6 +358,9 @@ class SW_DLLPUBLIC SwView: public SfxViewShell SAL_DLLPRIVATE void ShowAtResize(); + // XForms mode: change XForms mode, based on design mode + SAL_DLLPRIVATE void UpdateXformsViewOption(bool bDesignMode); + SAL_DLLPRIVATE virtual void Move() override; public: // #i123922# Needs to be called from a 2nd place now as a helper method diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi index 009555504e5e..0f2935267d37 100644 --- a/sw/sdi/_basesh.sdi +++ b/sw/sdi/_basesh.sdi @@ -605,12 +605,6 @@ interface BaseTextSelection DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] - FN_XFORMS_DESIGN_MODE - [ - ExecMethod = Execute; - StateMethod = GetState; - ] - SID_GRAPHIC_SIZE_CHECK [ ExecMethod = ExecDlg; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 80b14c9af945..c454415d15ed 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7680,25 +7680,6 @@ SfxVoidItem TableSort FN_TABLE_SORT_DIALOG GroupId = SfxGroupId::Table; ] -// #i31958#: toggle design mode for XForms; copied from SID_FM_DESIGN_MODE -SfxBoolItem SwitchXFormsDesignMode FN_XFORMS_DESIGN_MODE -[ - AutoUpdate = TRUE, - FastCall = FALSE, - ReadOnlyDoc = TRUE, - Toggle = TRUE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - - AccelConfig = TRUE, - MenuConfig = TRUE, - ToolBoxConfig = TRUE, - GroupId = SfxGroupId::Controls; -] - SfxVoidItem RemoveDirectCharFormats FN_REMOVE_DIRECT_CHAR_FORMATS [ AutoUpdate = TRUE, diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 2a57a1e61bcc..024a0f163e80 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -143,15 +143,6 @@ void SwViewShell::Init( const SwViewOption *pNewOpt, tools::Long const nFlags) } SizeChgNotify(); - // XForms mode: initialize XForms mode, based on design mode (draw view) - // MakeDrawView() requires layout - if( GetDoc()->isXForms() ) - { - if( ! HasDrawView() ) - MakeDrawView(); - mpOpt->SetFormView( ! GetDrawView()->IsDesignMode() ); - } - awt::Rectangle aClientVisibleArea = comphelper::LibreOfficeKit::getInitialClientVisibleArea(); if (aClientVisibleArea.Width && aClientVisibleArea.Height) { diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 27e6e005d0ae..cab8f016da8a 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1526,27 +1526,6 @@ void SwBaseShell::Execute(SfxRequest &rReq) } break; - case FN_XFORMS_DESIGN_MODE: - if (pArgs && pArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET) - { - if (const SfxBoolItem* pBoolItem = dynamic_cast(pItem)) - { - bool bDesignMode = pBoolItem->GetValue(); - - // set from design mode - OSL_ENSURE( GetView().GetFormShell() != nullptr, "form shell?" ); - SfxRequest aReq(GetView().GetViewFrame(), SID_FM_DESIGN_MODE); - aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) ); - GetView().GetFormShell()->Execute( aReq ); - aReq.Done(); - - // also set suitable view options - SwViewOption aViewOption = *rSh.GetViewOptions(); - aViewOption.SetFormView( ! bDesignMode ); - rSh.ApplyViewOptions( aViewOption ); - } - } - break; case SID_PROTECTSIZE: case SID_PROTECTPOS: { @@ -2161,17 +2140,6 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) if ( rSh.GetLinkManager().GetLinks().empty() ) rSet.DisableItem(nWhich); break; - case FN_XFORMS_DESIGN_MODE: - // enable if in XForms document - if( rSh.GetDoc()->isXForms() ) - { - // determine current state from view options - bool bValue = ! rSh.GetViewOptions()->IsFormView(); - rSet.Put( SfxBoolItem( nWhich, bValue ) ); - } - else - rSet.Put( SfxVisibilityItem( nWhich, false ) ); - break; case SID_GRAPHIC_SIZE_CHECK: { sal_Int32 nDPI = rSh.GetDoc()->getIDocumentSettingAccess().getImagePreferredDPI(); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 220d0b3e9267..bf0329531984 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1034,6 +1034,8 @@ SwView::SwView(SfxViewFrame& _rFrame, SfxViewShell* pOldSh) SetNewWindowAllowed(!bBrowse); // End of disabled multiple window + UpdateXformsViewOption(GetDrawView()->IsDesignMode()); + m_bVScrollbarEnabled = aUsrPref.IsViewVScrollBar(); m_bHScrollbarEnabled = aUsrPref.IsViewHScrollBar(); if (m_pHScrollbar) @@ -1751,6 +1753,17 @@ SwGlossaryHdl* SwView::GetGlosHdl() return m_pGlosHdl.get(); } +void SwView::UpdateXformsViewOption(bool bDesignMode) +{ + // Set suitable view options when in/out of design mode in XForm documents + if( GetDocShell()->GetDoc()->isXForms() ) + { + SwViewOption aViewOption = *GetWrtShellPtr()->GetViewOptions(); + aViewOption.SetFormView(!bDesignMode); + GetWrtShellPtr()->ApplyViewOptions(aViewOption); + } +} + void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { bool bCallBase = true; @@ -1761,6 +1774,9 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { auto pChangedHint = static_cast(&rHint); bool bDesignMode = pChangedHint->GetDesignMode(); + + UpdateXformsViewOption(bDesignMode); + if (!bDesignMode && GetDrawFuncPtr()) { GetDrawFuncPtr()->Deactivate(); diff --git a/sw/uiconfig/swxform/toolbar/formdesign.xml b/sw/uiconfig/swxform/toolbar/formdesign.xml index f748bcf68e2e..067ddff0675f 100644 --- a/sw/uiconfig/swxform/toolbar/formdesign.xml +++ b/sw/uiconfig/swxform/toolbar/formdesign.xml @@ -44,7 +44,7 @@ - +