sw/inc/viewopt.hxx | 8 ++- sw/source/core/layout/paintfrm.cxx | 6 +- sw/source/ui/config/optpage.cxx | 8 +++ sw/source/uibase/config/cfgitems.cxx | 4 + sw/source/uibase/inc/cfgitems.hxx | 1 sw/source/uibase/inc/optpage.hxx | 2 sw/uiconfig/swriter/ui/optformataidspage.ui | 72 +++++++++++++++++++++++++++- 7 files changed, 96 insertions(+), 5 deletions(-)
New commits: commit 1de5fc4671f789d1a9d0b5679a52349b9913a2f4 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Wed Oct 30 14:58:37 2024 +0100 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Wed Oct 30 17:34:33 2024 +0100 Resolves tdf#74386 - Make Text Boundaries independent from non-printable chars New option introduced under Formatting Aids to switch between full and crop marks, which was done before via NPC Change-Id: I920f68b571da740e47ae367ba1e8d28e03a131e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175828 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 8c51eb88bfbe..9c15ca640b63 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 bTextBoundariesFull : 1; // true = frame around text, false = crop marks at edges ViewOptFlags1() : bUseHeaderFooterMenu(false) @@ -102,6 +103,7 @@ struct ViewOptFlags1 , bShowOutlineContentVisibilityButton(false) , bShowChangesInMargin(false) , bShowChangesInMargin2(false) + , bTextBoundariesFull(true) {} 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 + && bTextBoundariesFull == rOther.bTextBoundariesFull; } void dumpAsXml(xmlTextWriterPtr pWriter) const; @@ -662,6 +665,9 @@ public: bool IsMultipageView() const { return IsViewLayoutBookMode() || GetViewLayoutColumns() == 0; } + bool IsTextBoundariesFull() const { return m_nCoreOptions.bTextBoundariesFull; } + void SetTextBoundariesFull( bool b) { m_nCoreOptions.bTextBoundariesFull = b; } + #ifdef DBG_UTIL // Correspond to statements in ui/config/cfgvw.src. bool IsTest1() const { return m_bTest1; } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index c853a772542d..a69ebc64ff4a 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7378,7 +7378,7 @@ std::vector<basegfx::B2DPolygon> SwPageFrame::GetSubsidiaryLinesPolygons(const S if (aArea.IsEmpty()) return aPolygons; - if (!rViewShell.GetViewOptions()->IsViewMetaChars()) + if (!rViewShell.GetViewOptions()->IsTextBoundariesFull()) aPolygons = lcl_CreatePageAreaDelimiterPolygons(aArea, false /* body */); else aPolygons = lcl_CreateRectangleDelimiterPolygons(aArea); @@ -7470,7 +7470,7 @@ void SwColumnFrame::PaintSubsidiaryLines( const SwPageFrame *, ::SwAlignRect( aArea, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() ); - if ( !gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars( ) ) + if ( !gProp.pSGlobalShell->GetViewOptions()->IsTextBoundariesFull( ) ) ProcessPrimitives( lcl_CreateColumnAreaDelimiterPrimitives( aArea ) ); else ProcessPrimitives( lcl_CreateRectangleDelimiterPrimitives( aArea ) ); @@ -7507,7 +7507,7 @@ std::vector<basegfx::B2DPolygon> SwHeadFootFrame::GetSubsidiaryLinesPolygons(con SwRect aArea( getFramePrintArea() ); aArea.Pos() += getFrameArea().Pos(); - if (!rViewShell.GetViewOptions()->IsViewMetaChars( )) + if (!rViewShell.GetViewOptions()->IsTextBoundariesFull( )) aPolygons = lcl_CreatePageAreaDelimiterPolygons(aArea, true /* header/footer*/); else aPolygons = lcl_CreateRectangleDelimiterPolygons(aArea); diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 476d4957257d..c202a1d0270a 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1726,6 +1726,8 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w , m_xBookmarkCB(m_xBuilder->weld_check_button(u"bookmarks"_ustr)) , m_xBookmarkImg(m_xBuilder->weld_widget(u"lockbookmarks"_ustr)) , m_xBookmarkLabel(m_xBuilder->weld_label(u"bookmarks_label"_ustr)) + , m_xTextBoundariesFull(m_xBuilder->weld_radio_button(u"rbTextBoundariesFull"_ustr)) + , m_xTextBoundariesCrop(m_xBuilder->weld_radio_button(u"rbTextBoundariesCrop"_ustr)) , m_xDirectCursorFrame(m_xBuilder->weld_frame(u"directcrsrframe"_ustr)) , m_xOnOffCB(m_xBuilder->weld_check_button(u"cursoronoff"_ustr)) , m_xOnOffImg(m_xBuilder->weld_widget(u"lockcursoronoff"_ustr)) @@ -1877,6 +1879,7 @@ bool SwShdwCursorOptionsTabPage::FillItemSet( SfxItemSet* rSet ) aDisp.m_bBookmarks = m_xBookmarkCB->get_active(); aDisp.m_bManualBreak = m_xBreakCB->get_active(); aDisp.m_xDefaultAnchor = m_xDefaultAnchorType->get_active(); + aDisp.m_bTextBoundariesFull = m_xTextBoundariesFull->get_active(); bRet |= (!pOldAttr || aDisp != *pOldAttr); if(bRet) @@ -1987,6 +1990,11 @@ void SwShdwCursorOptionsTabPage::Reset( const SfxItemSet* rSet ) m_xDefaultAnchorType->set_active( pDocDisplayAttr->m_xDefaultAnchor ); m_xDefaultAnchorType->set_sensitive(!bReadOnly); m_xDefaultAnchorTypeImg->set_visible(bReadOnly); + + if (pDocDisplayAttr->m_bTextBoundariesFull) + m_xTextBoundariesFull->set_active(true); + else + m_xTextBoundariesCrop->set_active(true); } } diff --git a/sw/source/uibase/config/cfgitems.cxx b/sw/source/uibase/config/cfgitems.cxx index a041169dbba4..27a3690f9b99 100644 --- a/sw/source/uibase/config/cfgitems.cxx +++ b/sw/source/uibase/config/cfgitems.cxx @@ -34,6 +34,7 @@ SwDocDisplayItem::SwDocDisplayItem() : m_bCharHiddenText = m_bBookmarks = m_bManualBreak = true; + m_bTextBoundariesFull = true; m_xDefaultAnchor = 1; //FLY_TO_CHAR }; @@ -49,6 +50,7 @@ SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt ) : m_bCharHiddenText = rVOpt.IsShowHiddenChar(true); m_bBookmarks = rVOpt.IsShowBookmarks(true); m_bManualBreak = rVOpt.IsLineBreak(true); + m_bTextBoundariesFull = rVOpt.IsTextBoundariesFull(); m_xDefaultAnchor = rVOpt.GetDefaultAnchor(); } @@ -71,6 +73,7 @@ bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const m_bCharHiddenText == rItem.m_bCharHiddenText && m_bBookmarks == rItem.m_bBookmarks && m_bManualBreak == rItem.m_bManualBreak && + m_bTextBoundariesFull == rItem.m_bTextBoundariesFull && m_xDefaultAnchor == rItem.m_xDefaultAnchor); } @@ -84,6 +87,7 @@ void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const rVOpt.SetShowHiddenChar(m_bCharHiddenText ); rVOpt.SetShowBookmarks(m_bBookmarks ); rVOpt.SetLineBreak (m_bManualBreak ); + rVOpt.SetTextBoundariesFull(m_bTextBoundariesFull); rVOpt.SetDefaultAnchor( m_xDefaultAnchor ); } diff --git a/sw/source/uibase/inc/cfgitems.hxx b/sw/source/uibase/inc/cfgitems.hxx index 34325af159d6..a02f2ec7864d 100644 --- a/sw/source/uibase/inc/cfgitems.hxx +++ b/sw/source/uibase/inc/cfgitems.hxx @@ -52,6 +52,7 @@ class SW_DLLPUBLIC SwDocDisplayItem final : public SfxPoolItem bool m_bCharHiddenText :1; bool m_bBookmarks :1; bool m_bManualBreak :1; + bool m_bTextBoundariesFull :1; sal_Int32 m_xDefaultAnchor; public: diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index 6279b8ed153f..cdeb071100a7 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -312,6 +312,8 @@ class SwShdwCursorOptionsTabPage final : public SfxTabPage std::unique_ptr<weld::CheckButton> m_xBookmarkCB; std::unique_ptr<weld::Widget> m_xBookmarkImg; std::unique_ptr<weld::Label> m_xBookmarkLabel; + std::unique_ptr<weld::RadioButton> m_xTextBoundariesFull; + std::unique_ptr<weld::RadioButton> m_xTextBoundariesCrop; std::unique_ptr<weld::Frame> m_xDirectCursorFrame; std::unique_ptr<weld::CheckButton> m_xOnOffCB; diff --git a/sw/uiconfig/swriter/ui/optformataidspage.ui b/sw/uiconfig/swriter/ui/optformataidspage.ui index 618c972a7472..de56bcb643a2 100644 --- a/sw/uiconfig/swriter/ui/optformataidspage.ui +++ b/sw/uiconfig/swriter/ui/optformataidspage.ui @@ -8,7 +8,7 @@ <property name="border-width">6</property> <property name="orientation">vertical</property> <child> - <!-- n-columns=2 n-rows=2 --> + <!-- n-columns=2 n-rows=3 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -837,6 +837,75 @@ <property name="top-attach">1</property> </packing> </child> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> + <child> + <!-- n-columns=1 n-rows=2 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-top">6</property> + <property name="row-spacing">3</property> + <child> + <object class="GtkRadioButton" id="rbTextBoundariesCrop"> + <property name="label" translatable="yes" context="optformataidspage|rbTextBoundariesCrop">Crop marks</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="halign">start</property> + <property name="margin-start">12</property> + <property name="use-underline">True</property> + <property name="active">True</property> + <property name="draw-indicator">True</property> + <property name="group">rbTextBoundariesFull</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="rbTextBoundariesFull"> + <property name="label" translatable="yes" context="optformataidspage|rbTextBoundariesFull">Full</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="halign">start</property> + <property name="margin-start">12</property> + <property name="use-underline">True</property> + <property name="active">True</property> + <property name="draw-indicator">True</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="optformataidspage|lbTextBoundaries">Text Boundaries</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -862,4 +931,5 @@ <widget name="lbDefaultAnchor"/> </widgets> </object> + <object class="GtkSizeGroup" id="sgDisplay"/> </interface>