sw/source/uibase/uiview/viewstat.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit afbbfb3b55beb937555a972d9edbb47ede91001a
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Tue Nov 10 12:22:11 2020 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Nov 10 14:58:29 2020 +0100

    tdf#83958: sw: enable Track Changes toolbar automatically
    
    Switch on the disabled Tracked Changes toolbar if the document hasn't
    modified, yet (i.e. on load), only if recording of changes is enabled
    or the document contains tracked changes.
    
    Note: the toolbar stays there, but there is no need for it to manage
    changes only with the menus Edit/View, keyboard shortcuts or the
    experimental sidebar, so it may worth to add a View option for this
    behaviour.
    
    Change-Id: Ia46b552b3669e147cdcbf0cc0be164883e9fb2cc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105519
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/source/uibase/uiview/viewstat.cxx 
b/sw/source/uibase/uiview/viewstat.cxx
index 904af3e672a4..1e501d3d02b7 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -52,6 +52,7 @@
 
 #include <cmdid.h>
 #include <IDocumentRedlineAccess.hxx>
+#include <IDocumentState.hxx>
 
 #include <doc.hxx>
 
@@ -311,6 +312,17 @@ 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 
document hasn't
+                // modified, yet (i.e. on load), and if recording of changes 
is enabled
+                // or if it contains tracked changes. TODO: the toolbar stays 
there, but
+                // there is no need for it to manage changes only with the 
menus Edit/View,
+                // keyboard shortcuts or the experimental sidebar, so it's 
worth to add
+                // a View option for this behaviour.
+                if ( !GetDocShell()->IsModified() && ( 
GetDocShell()->IsChangeRecording() ||
+                    
m_pWrtShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size() ) )
+                {
+                    ShowUIElement("private:resource/toolbar/changes");
+                }
             break;
             case FN_REDLINE_PROTECT :
                 rSet.Put( SfxBoolItem( nWhich, 
GetDocShell()->HasChangeRecordProtection() ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to