officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 22 ++++++++++ sw/inc/cmdid.h | 2 sw/sdi/_viewsh.sdi | 6 ++ sw/sdi/swriter.sdi | 16 +++++++ sw/source/uibase/app/appopt.cxx | 4 + sw/source/uibase/uiview/view0.cxx | 8 +++ sw/uiconfig/sglobal/menubar/menubar.xml | 3 - sw/uiconfig/swriter/menubar/menubar.xml | 3 - 8 files changed, 62 insertions(+), 2 deletions(-)
New commits: commit 2f1136f178a7b74a5af3856342d3e1cb332e3fc7 Author: Tamás Zolnai <[email protected]> AuthorDate: Fri Dec 12 11:25:20 2025 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Wed Dec 17 11:28:23 2025 +0100 tdf#169806: Add baseline grid feature to Writer menu. * Create a "Display Baseline Grid" menu item, which triggers the rendering of the baseline grid. * Rename the parent menu item from "Grid and Helplines" to "Grids and Helplines" (plural grids). * Display the new menu items for Writer normal mode and master document mode (not shown in web mode, for example). Change-Id: I2c45c2ebf6557efa96de012c74e83535be653bdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195705 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <[email protected]> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index ab2f9b6256de..ec26db44a0e1 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3575,6 +3575,28 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:GridsMenu" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Gr~ids and Helplines</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + <prop oor:name="TargetURL" oor:type="xs:string"> + <value>.uno:GridMenu</value> + </prop> + </node> + <node oor:name=".uno:BaselineGridVisible" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Display ~Baseline Grid</value> + </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string"> + <value xml:lang="en-US">Display the baseline grid for page line-spacing</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> </node> <node oor:name="Popups"> <node oor:name=".uno:CharacterMenu" oor:op="replace"> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 5b1b63310c53..9a32d2b85d7b 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -211,6 +211,8 @@ class SwUINumRuleItem; #define FN_TRACK_CHANGES_IN_THIS_VIEW (FN_VIEW + 72) /* Record track changes only in this view */ #define FN_TRACK_CHANGES_IN_ALL_VIEWS (FN_VIEW + 73) /* Record track changes only in all views */ +#define FN_VIEW_BASELINE_GRID_VISIBLE (FN_VIEW + 74) /* Menu for displaying baseline grid */ + // Region: Insert #define FN_INSERT_BOOKMARK (FN_INSERT + 2 ) /* Bookmark */ // FN_INSERT + 3 is FN_INSERT_BREAK diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 5db24b03bc07..73099317370a 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -1105,4 +1105,10 @@ interface BaseTextEditView ExecMethod = Execute ; ] + FN_VIEW_BASELINE_GRID_VISIBLE + [ + ExecMethod = ExecViewOptions ; + StateMethod = StateViewOptions ; + ] + } diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 2bf53f9ed34c..cd6598cd3996 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -9051,3 +9051,19 @@ SfxVoidItem CopyFieldDialog FN_COPY_FIELD ToolBoxConfig = FALSE, GroupId = SfxGroupId::Edit; ] + +SfxBoolItem BaselineGridVisible FN_VIEW_BASELINE_GRID_VISIBLE +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::View; +] diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 927eeae82842..399b6b55df14 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -380,6 +380,10 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if( const SfxBoolItem* pItem = rSet.GetItemIfSet( FN_PARAM_BASELINE_GRID_VISIBLE, false )) { aViewOpt.SetBaselineGridVisible(pItem->GetValue()); + if(pBindings) + { + pBindings->Invalidate(FN_VIEW_BASELINE_GRID_VISIBLE); + } } // Interpret Writer Printer Options diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 0ee6dab7bf72..5eea15c5ef86 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -386,6 +386,9 @@ void SwView::StateViewOptions(SfxItemSet &rSet) case SID_CLICK_CHANGE_ROTATION: aBool.SetValue( pOpt->IsClickChangeRotation()); break; + case FN_VIEW_BASELINE_GRID_VISIBLE: + aBool.SetValue(pOpt->IsBaselineGridVisible()); + break; } if( nWhich ) @@ -820,6 +823,11 @@ void SwView::ExecViewOptions(SfxRequest &rReq) bFlag = !pOpt->IsClickChangeRotation(); pOpt->SetClickChangeRotation(bFlag); break; + case FN_VIEW_BASELINE_GRID_VISIBLE: + if( STATE_TOGGLE == eState ) + bFlag = !pOpt->IsBaselineGridVisible(); + pOpt->SetBaselineGridVisible( bFlag ); + break; default: OSL_FAIL("wrong request method"); diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index be8eeca4acec..5c248926cf4f 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -190,11 +190,12 @@ <menu:menuitem menu:id=".uno:VScroll" menu:style="text"/> </menu:menupopup> </menu:menu> - <menu:menu menu:id=".uno:GridMenu"> + <menu:menu menu:id=".uno:GridsMenu"> <menu:menupopup> <menu:menuitem menu:id=".uno:GridVisible" menu:style="text"/> <menu:menuitem menu:id=".uno:GridUse" menu:style="text"/> <menu:menuitem menu:id=".uno:HelplinesMove" menu:style="text"/> + <menu:menuitem menu:id=".uno:BaselineGridVisible" menu:style="text"/> </menu:menupopup> </menu:menu> <menu:menuseparator/> diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index a0e0dd1b27a4..cc34835b73c4 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -206,11 +206,12 @@ <menu:menuitem menu:id=".uno:VScroll" menu:style="text"/> </menu:menupopup> </menu:menu> - <menu:menu menu:id=".uno:GridMenu"> + <menu:menu menu:id=".uno:GridsMenu"> <menu:menupopup> <menu:menuitem menu:id=".uno:GridVisible"/> <menu:menuitem menu:id=".uno:GridUse"/> <menu:menuitem menu:id=".uno:HelplinesMove"/> + <menu:menuitem menu:id=".uno:BaselineGridVisible"/> </menu:menupopup> </menu:menu> <menu:menuseparator/>
