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 <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
This commit is contained in:
Bojidar Marinov
2025-07-10 13:20:16 +03:00
committed by Ilmari Lauhakangas
parent 79034b63b1
commit 423cdbce04
19 changed files with 22 additions and 91 deletions

View File

@ -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"));

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -5836,14 +5836,6 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
<value>9</value>
</prop>
</node>
<node oor:name=".uno:SwitchXFormsDesignMode" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Design Mode On/Off</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>9</value>
</prop>
</node>
<node oor:name=".uno:RecUndo" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Undo: Data entry</value>

View File

@ -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)

View File

@ -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

View File

@ -605,12 +605,6 @@ interface BaseTextSelection
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
FN_XFORMS_DESIGN_MODE
[
ExecMethod = Execute;
StateMethod = GetState;
]
SID_GRAPHIC_SIZE_CHECK
[
ExecMethod = ExecDlg;

View File

@ -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,

View File

@ -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)
{

View File

@ -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<const SfxBoolItem*>(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();

View File

@ -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<const FmDesignModeChangedHint*>(&rHint);
bool bDesignMode = pChangedHint->GetDesignMode();
UpdateXformsViewOption(bDesignMode);
if (!bDesignMode && GetDrawFuncPtr())
{
GetDrawFuncPtr()->Deactivate();

View File

@ -44,7 +44,7 @@
<toolbar:toolbaritem xlink:href=".uno:LeaveGroup" toolbar:visible="false"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SelectObject"/>
<toolbar:toolbaritem xlink:href=".uno:SwitchXFormsDesignMode"/>
<toolbar:toolbaritem xlink:href=".uno:SwitchControlDesignMode"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ControlProperties"/>
<toolbar:toolbaritem xlink:href=".uno:FormProperties"/>