diff options
author | László Németh <nemeth@numbertext.org> | 2020-10-14 15:29:08 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-15 15:11:12 +0200 |
commit | 1e383097aa929176bac33f46787e16d945a0a98b (patch) | |
tree | 2109021fecc8f1887d6609e390bc0e8711cf9f93 /sw/source/uibase | |
parent | 464f872ea9b5d6d5090cad2ebf9d561e778f3f53 (diff) |
tdf#34355 sw,offapi,officecfg: show track changes in margin
In ShowTrackedChanges mode, hide tracked deletions
in text optionally and show their shortened text
in margin next to the vertical "Changed line" mark
(showing only the first deletion of the line).
Add "Tracked deletions in margin" checkbox to Writer->View page.
Add "Display tracked changes" and "Outline View" sections to View, too.
Add property ShowChangesInMargin to com::sun::star::text::ViewSettings.
Add config setting:
org/openoffice/Office/Writer/Content/Display/ShowChangesInMargin
Show more information in Manage Changes dialog window
about the tracked deletions with restricted visibility
in ShowChangesInMargin mode: show shortened text content
of a deletion in its (otherwise empty) Comment field.
Change-Id: I1d19a4bf8225f536a635c6dd5062344c51e03b79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104350
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/config/cfgitems.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/config/usrpref.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/inc/cfgitems.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/optpage.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomod.cxx | 6 |
7 files changed, 41 insertions, 5 deletions
diff --git a/sw/source/uibase/config/cfgitems.cxx b/sw/source/uibase/config/cfgitems.cxx index 457ced7d6320..fc163193547f 100644 --- a/sw/source/uibase/config/cfgitems.cxx +++ b/sw/source/uibase/config/cfgitems.cxx @@ -96,6 +96,7 @@ SwElemItem::SwElemItem() : m_bNotes = false; m_bShowInlineTooltips = true; m_bShowOutlineContentVisibilityButton = + m_bShowChangesInMargin = m_bFieldHiddenText = m_bShowHiddenPara = false; } @@ -113,6 +114,7 @@ SwElemItem::SwElemItem(const SwViewOption& rVOpt) : m_bNotes = rVOpt.IsPostIts(); m_bShowInlineTooltips = rVOpt.IsShowInlineTooltips(); m_bShowOutlineContentVisibilityButton = rVOpt.IsShowOutlineContentVisibilityButton(); + m_bShowChangesInMargin = rVOpt.IsShowChangesInMargin(); m_bFieldHiddenText = rVOpt.IsShowHiddenField(); m_bShowHiddenPara = rVOpt.IsShowHiddenPara(); } @@ -138,6 +140,7 @@ bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const m_bNotes == rItem.m_bNotes && m_bShowInlineTooltips == rItem.m_bShowInlineTooltips && m_bShowOutlineContentVisibilityButton == rItem.m_bShowOutlineContentVisibilityButton && + m_bShowChangesInMargin == rItem.m_bShowChangesInMargin && m_bFieldHiddenText == rItem.m_bFieldHiddenText && m_bShowHiddenPara == rItem.m_bShowHiddenPara); } @@ -155,6 +158,7 @@ void SwElemItem::FillViewOptions( SwViewOption& rVOpt) const rVOpt.SetPostIts (m_bNotes ); rVOpt.SetShowInlineTooltips( m_bShowInlineTooltips ); rVOpt.SetShowOutlineContentVisibilityButton(m_bShowOutlineContentVisibilityButton); + rVOpt.SetShowChangesInMargin( m_bShowChangesInMargin ); rVOpt.SetShowHiddenField(m_bFieldHiddenText ); rVOpt.SetShowHiddenPara(m_bShowHiddenPara ); } diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index 6d1394daed76..f4261a717998 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -104,7 +104,8 @@ Sequence<OUString> SwContentViewConfig::GetPropertyNames() const "Update/Chart", // 19 "Display/ShowInlineTooltips", // 20 "Display/UseHeaderFooterMenu", // 21 - "Display/ShowOutlineContentVisibilityButton" // 22 + "Display/ShowOutlineContentVisibilityButton", // 22 + "Display/ShowChangesInMargin" // 23 }; #if defined(__GNUC__) && !defined(__clang__) // clang 8.0.0 says strcmp isn't constexpr @@ -173,6 +174,7 @@ void SwContentViewConfig::ImplCommit() case 20: bVal = rParent.IsShowInlineTooltips(); break;// "Display/ShowInlineTooltips" case 21: bVal = rParent.IsUseHeaderFooterMenu(); break;// "Display/UseHeaderFooterMenu" case 22: bVal = rParent.IsShowOutlineContentVisibilityButton(); break;// "Display/ShowOutlineContentVisibilityButton" + case 23: bVal = rParent.IsShowChangesInMargin(); break;// "Display/ShowChangesInMargin" } if (nProp != g_UpdateLinkIndex) pValues[nProp] <<= bVal; @@ -225,6 +227,7 @@ void SwContentViewConfig::Load() case 20: rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips" case 21: rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu" case 22: rParent.SetShowOutlineContentVisibilityButton(bSet); break;// "Display/ShowOutlineContententVisibilityButton" + case 23: rParent.SetShowChangesInMargin(bSet); break;// "Display/ShowChangesInMargin" } } } diff --git a/sw/source/uibase/inc/cfgitems.hxx b/sw/source/uibase/inc/cfgitems.hxx index d52880c69e3a..271fdf2a4715 100644 --- a/sw/source/uibase/inc/cfgitems.hxx +++ b/sw/source/uibase/inc/cfgitems.hxx @@ -78,6 +78,7 @@ class SW_DLLPUBLIC SwElemItem : public SfxPoolItem bool m_bNotes :1; bool m_bShowInlineTooltips :1; bool m_bShowOutlineContentVisibilityButton :1; + bool m_bShowChangesInMargin :1; bool m_bFieldHiddenText :1; bool m_bShowHiddenPara :1; diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index 95f657320af8..4ea45d347687 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -54,6 +54,7 @@ class SwContentOptPage : public SfxTabPage std::unique_ptr<weld::CheckButton> m_xShowInlineTooltips; std::unique_ptr<weld::CheckButton> m_xShowOutlineContentVisibilityButton; + std::unique_ptr<weld::CheckButton> m_xShowChangesInMargin; std::unique_ptr<weld::CheckButton> m_xFieldHiddenCB; std::unique_ptr<weld::CheckButton> m_xFieldHiddenParaCB; diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 81f17f8bfd59..cb7990fcd1fc 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -50,6 +50,7 @@ #include <docsh.hxx> #include <IDocumentRedlineAccess.hxx> +#include <usrpref.hxx> #include <memory> SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(SwRedlineAcceptChild, FN_REDLINE_ACCEPT) @@ -414,6 +415,7 @@ void SwRedlineAcceptDlg::Activate() // check comment weld::TreeView& rTreeView = m_pTable->GetWidget(); + bool bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin(); for (SwRedlineTable::size_type i = 0; i < nCount; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); @@ -421,13 +423,17 @@ void SwRedlineAcceptDlg::Activate() if(rRedln.GetComment() != pParent->sComment) { + bool bShowDeletedTextAsComment = bIsShowChangesInMargin && + RedlineType::Delete == rRedln.GetType() && rRedln.GetComment().isEmpty(); + const OUString sComment = bShowDeletedTextAsComment + ? const_cast<SwRangeRedline&>(rRedln).GetDescr() + : rRedln.GetComment(); if (pParent->xTLBParent) { // update only comment - const OUString& sComment(rRedln.GetComment()); rTreeView.set_text(*pParent->xTLBParent, sComment.replace('\n', ' '), 3); } - pParent->sComment = rRedln.GetComment(); + pParent->sComment = sComment; } } @@ -719,6 +725,8 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli rTreeView.freeze(); if (m_pTable->IsSorted()) rTreeView.make_unsorted(); + + bool bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin(); for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); @@ -727,7 +735,12 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli pRedlineParent = new SwRedlineDataParent; pRedlineParent->pData = pRedlineData; pRedlineParent->pNext = nullptr; - const OUString& sComment(rRedln.GetComment()); + + bool bShowDeletedTextAsComment = bIsShowChangesInMargin && + RedlineType::Delete == rRedln.GetType() && rRedln.GetComment().isEmpty(); + const OUString& sComment = bShowDeletedTextAsComment + ? const_cast<SwRangeRedline&>(rRedln).GetDescr() + : rRedln.GetComment(); pRedlineParent->sComment = sComment.replace('\n', ' '); m_RedlineParents.insert(m_RedlineParents.begin() + i, std::unique_ptr<SwRedlineDataParent>(pRedlineParent)); diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index c4c14d796182..5dc5bc316110 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -339,6 +339,9 @@ void SwView::StateViewOptions(SfxItemSet &rSet) case FN_SHOW_OUTLINECONTENTVISIBILITYBUTTON: aBool.SetValue( pOpt->IsShowOutlineContentVisibilityButton() ); break; + case FN_SHOW_CHANGES_IN_MARGIN: + aBool.SetValue( pOpt->IsShowChangesInMargin() ); + break; } if( nWhich ) @@ -597,6 +600,13 @@ void SwView::ExecViewOptions(SfxRequest &rReq) pOpt->SetShowOutlineContentVisibilityButton( bFlag ); break; + case FN_SHOW_CHANGES_IN_MARGIN: + if( STATE_TOGGLE == eState ) + bFlag = !pOpt->IsShowChangesInMargin(); + + pOpt->SetShowChangesInMargin( bFlag ); + break; + default: OSL_FAIL("wrong request method"); return; diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index c0c5f74bfc07..c17356610646 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -95,7 +95,8 @@ enum SwViewSettingsPropertyHandles HANDLE_VIEWSET_HIDE_WHITESPACE, HANDLE_VIEWSET_USE_HEADERFOOTERMENU, HANDLE_VIEWSET_BOOKMARKS, - HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON + HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON, + HANDLE_VIEWSET_CHANGES_IN_MARGIN }; enum SwPrintSettingsPropertyHandles @@ -135,6 +136,7 @@ static ChainablePropertySetInfo * lcl_createViewSettingsInfo() { OUString( "ShowInlineTooltips" ), HANDLE_VIEWSET_INLINECHANGES_TIPS , cppu::UnoType<bool>::get(), PROPERTY_NONE}, { OUString( "UseHeaderFooterMenu" ), HANDLE_VIEWSET_USE_HEADERFOOTERMENU , cppu::UnoType<bool>::get(), PROPERTY_NONE}, { OUString( "ShowOutlineContentVisibilityButton" ), HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON , cppu::UnoType<bool>::get(), PROPERTY_NONE}, + { OUString( "ShowChangesInMargin" ), HANDLE_VIEWSET_CHANGES_IN_MARGIN, cppu::UnoType<bool>::get(), PROPERTY_NONE}, { OUString( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE}, { OUString( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE}, { OUString( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE}, @@ -598,6 +600,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c case HANDLE_VIEWSET_INLINECHANGES_TIPS : mpViewOption->SetShowInlineTooltips(*o3tl::doAccess<bool>(rValue)); break; case HANDLE_VIEWSET_USE_HEADERFOOTERMENU : mpViewOption->SetUseHeaderFooterMenu(*o3tl::doAccess<bool>(rValue)); break; case HANDLE_VIEWSET_SHOW_OUTLINECONTENTVISIBILITYBUTTON : mpViewOption->SetShowOutlineContentVisibilityButton(*o3tl::doAccess<bool>(rValue)); break; + case HANDLE_VIEWSET_CHANGES_IN_MARGIN : mpViewOption->SetShowChangesInMargin(*o3tl::doAccess<bool>(rValue)); break; case HANDLE_VIEWSET_RASTER_RESOLUTION_X : { sal_Int32 nTmp = 0; @@ -837,6 +840,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u case HANDLE_VIEWSET_SMOOTH_SCROLLING : bBoolVal = mpConstViewOption->IsSmoothScroll(); break; case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : bBoolVal = mpConstViewOption->IsShowContentTips(); break; case HANDLE_VIEWSET_INLINECHANGES_TIPS : bBoolVal = mpConstViewOption->IsShowInlineTooltips(); break; + case HANDLE_VIEWSET_CHANGES_IN_MARGIN : bBoolVal = mpConstViewOption->IsShowChangesInMargin(); break; case HANDLE_VIEWSET_IS_RASTER_VISIBLE : bBoolVal = mpConstViewOption->IsGridVisible(); break; case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : bBoolVal = mpConstViewOption->IsSnap(); break; case HANDLE_VIEWSET_SCROLLBAR_TIPS : bBoolVal = mpConstViewOption->IsShowScrollBarTips(); break; |