diff options
author | László Németh <nemeth@numbertext.org> | 2021-04-08 10:20:02 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-04-12 10:44:49 +0200 |
commit | d89786054715b44aa983d0752484216825c74ae2 (patch) | |
tree | 55e4a6e4c771eae960af6754a27eac003d3fc3be /sw | |
parent | 02529315289b8a5ef546e5df33283a424d68d8fd (diff) |
tdf#125909 tdf#141298 sw: show (Hidden) Track Changes infobar
instead of enabling Track Changes toolbar automatically,
when there are hidden track changes data or settings in
the document, i.e. Track Changes toolbar and Show Changes
are disabled, but
– the document contains (not visible) recorded changes, or
– Record Track Changes is enabled (which will result hidden
recording, e.g. unintended publishing of the deletions of
the document); or
– both of them.
Messages of the infobar show these cases.
Button of the Track Changes infobar allows to show/hide the
Track Changes toolbar. Hiding the Track Changes toolbar with
button of the Track Changes infobar closes the infobar, too.
Regression from commit afbbfb3b55beb937555a972d9edbb47ede91001a
"tdf#83958: sw: enable Track Changes toolbar automatically" and
commit 1989201c56c03b1ef13a282cfd09af69620040ea
"tdf#138870 sw: fix Track Changes toolbar reappearing".
Change-Id: I9162102d63d671b412fa0228e6bbfb5c356ee03e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113792
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/strings.hrc | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewstat.cxx | 29 |
2 files changed, 27 insertions, 6 deletions
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index b4017a06cc80..bb1c568a09bb 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -404,6 +404,10 @@ #define STR_HYPH_TITLE NC_("STR_HYPH_TITLE", "Hyphenation") #define STR_HYPH_MISSING NC_("STR_HYPH_MISSING", "Missing hyphenation data") #define STR_HYPH_MISSING_DETAIL NC_("STR_HYPH_MISSING", "Please install the hyphenation package for locale “%1”.") +#define STR_HIDDEN_CHANGES NC_("STR_HIDDEN_CHANGES", "Track Changes") +#define STR_HIDDEN_CHANGES_DETAIL NC_("STR_HIDDEN_CHANGES_DETAIL", "Document contains tracked changes and recording is enabled.") +#define STR_HIDDEN_CHANGES_DETAIL2 NC_("STR_HIDDEN_CHANGES_DETAIL2", "Recording of changes is enabled.") +#define STR_HIDDEN_CHANGES_DETAIL3 NC_("STR_HIDDEN_CHANGES_DETAIL3", "Document contains tracked changes.") // Undo #define STR_CANT_UNDO NC_("STR_CANT_UNDO", "not possible") diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 30c18bdc0180..06b740042bb0 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -49,6 +49,9 @@ #include <redline.hxx> #include <rootfrm.hxx> #include <docary.hxx> +#include <sfx2/infobar.hxx> +#include <docsh.hxx> +#include <strings.hrc> #include <cmdid.h> #include <IDocumentRedlineAccess.hxx> @@ -324,13 +327,27 @@ void SwView::GetState(SfxItemSet &rSet) break; case FN_REDLINE_ON: rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) ); - // switch on the disabled Tracked Changes toolbar if the view is - // new (e.g. on load), and if recording of changes is enabled - // or if it contains tracked changes. - if ( m_bForceChangesToolbar && ( GetDocShell()->IsChangeRecording() || - m_pWrtShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size() ) ) + // When the view is new (e.g. on load), show the Hidden Track Changes infobar + // if Show Changes is disabled, but recording of changes is enabled + // or hidden tracked changes are there already in the document. + // Note: the infobar won't be shown, if the Track Changes toolbar is already + // enabled, see in sfx2. + if ( m_bForceChangesToolbar && m_pWrtShell->GetLayout()->IsHideRedlines() ) { - ShowUIElement("private:resource/toolbar/changes"); + bool isRecording = GetDocShell()->IsChangeRecording(); + bool hasRecorded = + m_pWrtShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size(); + if ( isRecording || hasRecorded ) + { + GetDocShell()->AppendInfoBarWhenReady( + "hiddentrackchanges", SwResId(STR_HIDDEN_CHANGES), + SwResId( (isRecording && hasRecorded) + ? STR_HIDDEN_CHANGES_DETAIL + : isRecording + ? STR_HIDDEN_CHANGES_DETAIL2 + : STR_HIDDEN_CHANGES_DETAIL3 ), + InfobarType::INFO); + } } m_bForceChangesToolbar = false; break; |