Resolves tdf#58434 - Show formatting marks independently from fields
Field Shading / .uno:Marks toggles now only fields, footnotes, tox etc.
and Tab, SoftHyphen, Blank, as well as ControlChar depends now on
Formatting Marks / .uno:ControlCodes. Field Shading also does not
toggle HardBlank and SoftHyphen, and what control character is shown
respect the options under Formatting Aids
Change-Id: I63c826e7fdc09ec95f17aee9735d4f5de9a1b897
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166033
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 18ad3d1..b293f18 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1407,54 +1407,56 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
return;
bool bDraw = false;
switch( nWhich )
if ( !GetOpt().IsPagePreview()
&& !GetOpt().IsReadonly() )
{
case PortionType::Footnote:
case PortionType::QuoVadis:
case PortionType::Number:
case PortionType::Field:
case PortionType::Hidden:
case PortionType::Tox:
case PortionType::Ref:
case PortionType::Meta:
case PortionType::ContentControl:
case PortionType::ControlChar:
if ( !GetOpt().IsPagePreview()
&& !GetOpt().IsReadonly()
&& GetOpt().IsFieldShadings()
&& ( PortionType::Number != nWhich
|| m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
switch( nWhich )
{
bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
bDraw &= GetOpt().IsHardBlank();
}
break;
case PortionType::Bookmark:
// no shading
break;
case PortionType::InputField:
// input field shading also in read-only mode
if ( !GetOpt().IsPagePreview()
&& GetOpt().IsFieldShadings() )
{
bDraw = true;
}
break;
case PortionType::Tab:
if ( GetOpt().IsTab() ) bDraw = true;
break;
case PortionType::SoftHyphen:
if ( GetOpt().IsSoftHyph() )bDraw = true;
break;
case PortionType::Blank:
if ( GetOpt().IsHardBlank())bDraw = true;
break;
default:
{
OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
case PortionType::Tab:
if ( GetOpt().IsViewMetaChars() )
bDraw = GetOpt().IsTab();
break;
case PortionType::SoftHyphen:
if ( GetOpt().IsViewMetaChars() )
bDraw = GetOpt().IsSoftHyph();
break;
case PortionType::Blank:
if ( GetOpt().IsViewMetaChars() )
bDraw = GetOpt().IsHardBlank();
break;
case PortionType::ControlChar:
if ( GetOpt().IsViewMetaChars() )
bDraw = true;
break;
case PortionType::Bookmark:
// no shading
break;
case PortionType::Footnote:
case PortionType::QuoVadis:
case PortionType::Number:
case PortionType::Hidden:
case PortionType::Tox:
case PortionType::Ref:
case PortionType::Meta:
case PortionType::ContentControl:
case PortionType::Field:
case PortionType::InputField:
// input field shading also in read-only mode
if (GetOpt().IsFieldShadings()
&& ( PortionType::Number != nWhich
|| m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
{
bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
}
break;
default:
{
OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
break;
}
}
}
if ( bDraw )
DrawBackground( rPor, pColor );
}
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index 70c9882..488b32cc 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -128,14 +128,10 @@ std::shared_ptr<SwMailMergeConfigItem> const & SwView::GetMailMergeConfigItem()
static bool lcl_IsViewMarks( const SwViewOption& rVOpt )
{
return rVOpt.IsHardBlank() &&
rVOpt.IsSoftHyph() &&
rVOpt.IsFieldShadings();
return rVOpt.IsFieldShadings();
}
static void lcl_SetViewMarks(SwViewOption& rVOpt, bool bOn )
{
rVOpt.SetHardBlank(bOn);
rVOpt.SetSoftHyph(bOn);
rVOpt.SetAppearanceFlag(
ViewOptFlags::FieldShadings, bOn, true);
}