summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-01-31 16:19:21 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-01-31 17:23:19 +0100
commit04405edc3fac32938b8940bc767656ea6c7820f9 (patch)
tree3c3f081bcc10f5b597cdf28defb65de7365822b2 /sw/source
parent0a6ec034dc8088d9de399142bb193ae7d338e645 (diff)
tdf#45589 offapi,officecfg,sw: add option to toggle bookmark display
Create specific option to toggle display of the bookmark positions instead of relying on generic IsViewMetaChars(). Add a Bookmarks checkbox to Writer->Formatting Aids page in Options. Add property ShowBookmarks to com::sun::star::text::ViewSettings. Add config setting: org/openoffice/Office/Writer/Content/NonprintingCharacter/Bookmarks Change-Id: I998ecdc16d8e4a5baeeb1bbcff0bf5f1f5636692 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87774 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/text/inftxt.cxx2
-rw-r--r--sw/source/core/text/porrst.cxx2
-rw-r--r--sw/source/ui/config/optpage.cxx4
-rw-r--r--sw/source/uibase/app/appopt.cxx1
-rw-r--r--sw/source/uibase/config/cfgitems.cxx4
-rw-r--r--sw/source/uibase/config/usrpref.cxx47
-rw-r--r--sw/source/uibase/inc/cfgitems.hxx1
-rw-r--r--sw/source/uibase/inc/optpage.hxx1
-rw-r--r--sw/source/uibase/uiview/pview.cxx1
-rw-r--r--sw/source/uibase/uiview/view0.cxx2
-rw-r--r--sw/source/uibase/uno/unomod.cxx4
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx1
12 files changed, 49 insertions, 21 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 8538d6ebabd4..b7d80e1d4f97 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1378,7 +1378,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
case PortionType::Bookmark:
if (!GetOpt().IsPagePreview()
&& !GetOpt().IsReadonly()
- && GetOpt().IsViewMetaChars())
+ && GetOpt().IsShowBookmarks())
{
bDraw = true;
}
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 44d2288eaf9c..92c471d61e01 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -530,7 +530,7 @@ bool SwControlCharPortion::DoPaint(SwTextPaintInfo const&,
bool SwBookmarkPortion::DoPaint(SwTextPaintInfo const& rInf,
OUString & rOutString, SwFont & rTmpFont, int & rDeltaY) const
{
- if (!rInf.GetOpt().IsViewMetaChars())
+ if (!rInf.GetOpt().IsShowBookmarks())
{
return false;
}
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 0ab4db5e5607..fd5f04d57321 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1191,6 +1191,7 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w
, m_xTabCB(m_xBuilder->weld_check_button("tabs"))
, m_xBreakCB(m_xBuilder->weld_check_button("break"))
, m_xCharHiddenCB(m_xBuilder->weld_check_button("hiddentext"))
+ , m_xBookmarkCB(m_xBuilder->weld_check_button("bookmarks"))
, m_xDirectCursorFrame(m_xBuilder->weld_frame("directcrsrframe"))
, m_xOnOffCB(m_xBuilder->weld_check_button("cursoronoff"))
, m_xDirectCursorFillMode(m_xBuilder->weld_combo_box("cxDirectCursorFillMode"))
@@ -1217,6 +1218,7 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w
m_xTabCB->hide();
m_xCharHiddenCB->hide();
+ m_xBookmarkCB->hide();
m_xDirectCursorFrame->hide();
m_xOnOffCB->hide();
@@ -1282,6 +1284,7 @@ bool SwShdwCursorOptionsTabPage::FillItemSet( SfxItemSet* rSet )
aDisp.bNonbreakingSpace = m_xHSpacesCB->get_active();
aDisp.bSoftHyphen = m_xSHyphCB->get_active();
aDisp.bCharHiddenText = m_xCharHiddenCB->get_active();
+ aDisp.bBookmarks = m_xBookmarkCB->get_active();
aDisp.bManualBreak = m_xBreakCB->get_active();
bRet |= (!pOldAttr || aDisp != *pOldAttr);
@@ -1329,6 +1332,7 @@ void SwShdwCursorOptionsTabPage::Reset( const SfxItemSet* rSet )
m_xHSpacesCB->set_active( pDocDisplayAttr->bNonbreakingSpace );
m_xSHyphCB->set_active( pDocDisplayAttr->bSoftHyphen );
m_xCharHiddenCB->set_active( pDocDisplayAttr->bCharHiddenText );
+ m_xBookmarkCB->set_active(pDocDisplayAttr->bBookmarks);
m_xBreakCB->set_active( pDocDisplayAttr->bManualBreak );
}
}
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 20dd6c34f744..dcc59d8d0c58 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -239,6 +239,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
{
if( (!aViewOpt.IsTab( true ) && pDocDispItem->bTab) ||
(!aViewOpt.IsBlank( true ) && pDocDispItem->bSpace) ||
+ (!aViewOpt.IsShowBookmarks(true) && pDocDispItem->bBookmarks) ||
(!aViewOpt.IsParagraph( true ) && pDocDispItem->bParagraphEnd) ||
(!aViewOpt.IsLineBreak( true ) && pDocDispItem->bManualBreak) )
{
diff --git a/sw/source/uibase/config/cfgitems.cxx b/sw/source/uibase/config/cfgitems.cxx
index 5f283f520d44..0f26565c10d1 100644
--- a/sw/source/uibase/config/cfgitems.cxx
+++ b/sw/source/uibase/config/cfgitems.cxx
@@ -32,6 +32,7 @@ SwDocDisplayItem::SwDocDisplayItem() :
bNonbreakingSpace =
bSoftHyphen =
bCharHiddenText =
+ bBookmarks =
bManualBreak = true;
};
@@ -45,6 +46,7 @@ SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt ) :
bNonbreakingSpace = rVOpt.IsHardBlank();
bSoftHyphen = rVOpt.IsSoftHyph();
bCharHiddenText = rVOpt.IsShowHiddenChar(true);
+ bBookmarks = rVOpt.IsShowBookmarks(true);
bManualBreak = rVOpt.IsLineBreak(true);
}
@@ -65,6 +67,7 @@ bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
bNonbreakingSpace == rItem.bNonbreakingSpace &&
bSoftHyphen == rItem.bSoftHyphen &&
bCharHiddenText == rItem.bCharHiddenText &&
+ bBookmarks == rItem.bBookmarks &&
bManualBreak == rItem.bManualBreak );
}
@@ -76,6 +79,7 @@ void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const
rVOpt.SetHardBlank (bNonbreakingSpace );
rVOpt.SetSoftHyph (bSoftHyphen );
rVOpt.SetShowHiddenChar(bCharHiddenText );
+ rVOpt.SetShowBookmarks(bBookmarks );
rVOpt.SetLineBreak (bManualBreak );
}
diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx
index 3a331e2d43e1..ee63272c5dd8 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -74,9 +74,11 @@ SwMasterUsrPref::~SwMasterUsrPref()
{
}
+static const auto g_UpdateLinkIndex = 17;
+
Sequence<OUString> SwContentViewConfig::GetPropertyNames() const
{
- static const char* aPropNames[] =
+ static constexpr const char*const aPropNames[] =
{
"Display/GraphicObject", // 0
"Display/Table", // 1
@@ -94,13 +96,18 @@ Sequence<OUString> SwContentViewConfig::GetPropertyNames() const
"NonprintingCharacter/HiddenText", // 13
"NonprintingCharacter/HiddenParagraph", // 14
"NonprintingCharacter/HiddenCharacter", // 15
- "Update/Link", // 16
- "Update/Field", // 17
- "Update/Chart", // 18
- "Display/ShowInlineTooltips", // 19
- "Display/UseHeaderFooterMenu" // 20
+ "NonprintingCharacter/Bookmarks", // 16
+ "Update/Link", // 17
+ "Update/Field", // 18
+ "Update/Chart", // 19
+ "Display/ShowInlineTooltips", // 20
+ "Display/UseHeaderFooterMenu" // 21
};
- const int nCount = bWeb ? 12 : 21;
+#if defined(__GNUC__) && !defined(__clang__)
+ // clang 8.0.0 says strcmp isn't constexpr
+ static_assert(std::strcmp("Update/Link", aPropNames[g_UpdateLinkIndex]) == 0);
+#endif
+ const int nCount = bWeb ? 12 : SAL_N_ELEMENTS(aPropNames);
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
@@ -156,13 +163,14 @@ void SwContentViewConfig::ImplCommit()
case 13: bVal = rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
case 14: bVal = rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
case 15: bVal = rParent.IsShowHiddenChar(true); break;// "NonprintingCharacter/HiddenCharacter",
- case 16: pValues[nProp] <<= rParent.GetUpdateLinkMode(); break;// "Update/Link",
- case 17: bVal = rParent.IsUpdateFields(); break;// "Update/Field",
- case 18: bVal = rParent.IsUpdateCharts(); break;// "Update/Chart"
- case 19: bVal = rParent.IsShowInlineTooltips(); break;// "Display/ShowInlineTooltips"
- case 20: bVal = rParent.IsUseHeaderFooterMenu(); break;// "Display/UseHeaderFooterMenu"
+ case 16: bVal = rParent.IsShowBookmarks(true); break;// "NonprintingCharacter/Bookmarks",
+ case 17: pValues[nProp] <<= rParent.GetUpdateLinkMode(); break;// "Update/Link",
+ case 18: bVal = rParent.IsUpdateFields(); break;// "Update/Field",
+ case 19: bVal = rParent.IsUpdateCharts(); break;// "Update/Chart"
+ case 20: bVal = rParent.IsShowInlineTooltips(); break;// "Display/ShowInlineTooltips"
+ case 21: bVal = rParent.IsUseHeaderFooterMenu(); break;// "Display/UseHeaderFooterMenu"
}
- if(nProp != 16)
+ if (nProp != g_UpdateLinkIndex)
pValues[nProp] <<= bVal;
}
PutProperties(aNames, aValues);
@@ -180,7 +188,7 @@ void SwContentViewConfig::Load()
{
if(pValues[nProp].hasValue())
{
- bool bSet = nProp != 16 && *o3tl::doAccess<bool>(pValues[nProp]);
+ bool bSet = nProp != g_UpdateLinkIndex && *o3tl::doAccess<bool>(pValues[nProp]);
switch(nProp)
{
case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
@@ -199,17 +207,18 @@ void SwContentViewConfig::Load()
case 13: rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
- case 16:
+ case 16: rParent.SetShowBookmarks(bSet); break;// "NonprintingCharacter/Bookmarks",
+ case 17:
{
sal_Int32 nSet = 0;
pValues[nProp] >>= nSet;
rParent.SetUpdateLinkMode(nSet, true);
}
break;// "Update/Link",
- case 17: rParent.SetUpdateFields(bSet); break;// "Update/Field",
- case 18: rParent.SetUpdateCharts(bSet); break;// "Update/Chart"
- case 19: rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips"
- case 20: rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu"
+ case 18: rParent.SetUpdateFields(bSet); break;// "Update/Field",
+ case 19: rParent.SetUpdateCharts(bSet); break;// "Update/Chart"
+ case 20: rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips"
+ case 21: rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu"
}
}
}
diff --git a/sw/source/uibase/inc/cfgitems.hxx b/sw/source/uibase/inc/cfgitems.hxx
index a800704e679f..fab7cd59e66e 100644
--- a/sw/source/uibase/inc/cfgitems.hxx
+++ b/sw/source/uibase/inc/cfgitems.hxx
@@ -49,6 +49,7 @@ class SW_DLLPUBLIC SwDocDisplayItem : public SfxPoolItem
bool bNonbreakingSpace :1;
bool bSoftHyphen :1;
bool bCharHiddenText :1;
+ bool bBookmarks :1;
bool bManualBreak :1;
public:
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index 1f971b2378d3..5670f02b8c9b 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -227,6 +227,7 @@ class SwShdwCursorOptionsTabPage : public SfxTabPage
std::unique_ptr<weld::CheckButton> m_xTabCB;
std::unique_ptr<weld::CheckButton> m_xBreakCB;
std::unique_ptr<weld::CheckButton> m_xCharHiddenCB;
+ std::unique_ptr<weld::CheckButton> m_xBookmarkCB;
std::unique_ptr<weld::Frame> m_xDirectCursorFrame;
std::unique_ptr<weld::CheckButton> m_xOnOffCB;
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index c78c40892201..598d275d6089 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1103,6 +1103,7 @@ void SwPagePreview::Init()
aOpt.SetSoftHyph( false );
aOpt.SetFieldName( false );
aOpt.SetPostIts( false );
+ aOpt.SetShowBookmarks( false );
aOpt.SetShowHiddenChar( false );
aOpt.SetShowHiddenField( false );
aOpt.SetShowHiddenPara( false );
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index adb084dff5ad..ca7657481c30 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -151,6 +151,7 @@ static void lcl_SetViewMetaChars( SwViewOption& rVOpt, bool bOn)
rVOpt.IsTab() ||
rVOpt.IsLineBreak() ||
rVOpt.IsShowHiddenChar() ||
+ rVOpt.IsShowBookmarks() ||
rVOpt.IsBlank()))
{
rVOpt.SetParagraph(bOn);
@@ -158,6 +159,7 @@ static void lcl_SetViewMetaChars( SwViewOption& rVOpt, bool bOn)
rVOpt.SetLineBreak(bOn);
rVOpt.SetBlank(bOn);
rVOpt.SetShowHiddenChar(bOn);
+ rVOpt.SetShowBookmarks(bOn);
}
}
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 23e9db501423..48d84b512ce7 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -93,6 +93,7 @@ enum SwViewSettingsPropertyHandles
HANDLE_VIEWSET_INLINECHANGES_TIPS,
HANDLE_VIEWSET_HIDE_WHITESPACE,
HANDLE_VIEWSET_USE_HEADERFOOTERMENU,
+ HANDLE_VIEWSET_BOOKMARKS,
};
enum SwPrintSettingsPropertyHandles
@@ -136,6 +137,7 @@ static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
{ OUString( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
{ OUString( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE},
{ OUString( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
+ { OUString( "ShowBookmarks" ), HANDLE_VIEWSET_BOOKMARKS, cppu::UnoType<bool>::get(), PROPERTY_NONE },
{ OUString( "ShowBreaks"), HANDLE_VIEWSET_BREAKS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
{ OUString( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
{ OUString( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS , cppu::UnoType<bool>::get(), PROPERTY_NONE},
@@ -579,6 +581,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(*o3tl::doAccess<bool>(rValue)); break;
case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(*o3tl::doAccess<bool>(rValue)); break;
case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_BOOKMARKS : mpViewOption->SetShowBookmarks(*o3tl::doAccess<bool>(rValue)); break;
case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(*o3tl::doAccess<bool>(rValue)); break;
case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(*o3tl::doAccess<bool>(rValue)); break;
case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(*o3tl::doAccess<bool>(rValue)); break;
@@ -820,6 +823,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
case HANDLE_VIEWSET_PROTECTED_SPACES : bBoolVal = mpConstViewOption->IsHardBlank(); break;
case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(true); break;
case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(true); break;
+ case HANDLE_VIEWSET_BOOKMARKS : bBoolVal = mpConstViewOption->IsShowBookmarks(true); break;
case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(true); break;
case HANDLE_VIEWSET_HIDE_WHITESPACE : bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index f5eee610dbc2..7e49697290e8 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -4391,6 +4391,7 @@ SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions,
aRenderViewOptions.SetBlank( false ); // spaces
aRenderViewOptions.SetHardBlank( false ); // non-breaking spaces
aRenderViewOptions.SetTab( false ); // tabs
+ aRenderViewOptions.SetShowBookmarks( false ); // bookmarks
aRenderViewOptions.SetLineBreak( false ); // breaks (type 1)
aRenderViewOptions.SetPageBreak( false ); // breaks (type 2)
aRenderViewOptions.SetColumnBreak( false ); // breaks (type 3)