helpcontent2 | 2 include/sfx2/strings.hrc | 2 include/sfx2/viewfrm.hxx | 1 officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs | 6 sfx2/source/dialog/infobar.cxx | 2 sfx2/source/view/viewfrm.cxx | 109 ++++++---- sw/inc/strings.hrc | 4 sw/source/uibase/uiview/viewstat.cxx | 29 ++ 8 files changed, 112 insertions(+), 43 deletions(-)
New commits: commit f4bdd40d0d92fd1305e7a6931a02e3ea43e0030e Author: Johnny_M <kla...@partyheld.de> AuthorDate: Mon Apr 12 10:44:57 2021 +0200 Commit: Gerrit Code Review <ger...@gerrit.libreoffice.org> CommitDate: Mon Apr 12 10:44:57 2021 +0200 Update git submodules * Update helpcontent2 from branch 'master' to 50827fc77d659c80f335576e7af189ab81477b44 - tdf#132643 Translate German section IDs Change-Id: Ib9b6773d5df73aeb861d924941b12f606e2e0156 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/113916 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org> diff --git a/helpcontent2 b/helpcontent2 index 43af3c00658c..50827fc77d65 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 43af3c00658cb8495d9a5899a5e46d55d32d0214 +Subproject commit 50827fc77d659c80f335576e7af189ab81477b44 commit d89786054715b44aa983d0752484216825c74ae2 Author: László Németh <nem...@numbertext.org> AuthorDate: Thu Apr 8 10:20:02 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Apr 12 10:44:49 2021 +0200 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 <nem...@numbertext.org> diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index 14e1066447ba..c5d3c003e313 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -292,6 +292,8 @@ #define STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK NC_("STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK", "The certificate could not be validated and the document is only partially signed.") #define STR_SIGNATURE_OK NC_("STR_SIGNATURE_OK", "This document is digitally signed and the signature is valid.") #define STR_SIGNATURE_SHOW NC_("STR_SIGNATURE_SHOW", "Show Signatures") +#define STR_TRACK_CHANGES_BUTTON NC_("STR_TRACK_CHANGES_BUTTON", "Show Toolbar") +#define STR_TRACK_CHANGES_BUTTON_HIDE NC_("STR_TRACK_CHANGES_BUTTON_HIDE", "Hide Toolbar") #define STR_CLOSE_PANE NC_("STR_CLOSE_PANE", "Close Pane") diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index 7692636fd24c..c01da176b847 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -67,6 +67,7 @@ protected: DECL_LINK(WhatsNewHandler, weld::Button&, void); DECL_LINK(SwitchReadOnlyHandler, weld::Button&, void); DECL_LINK(SignDocumentHandler, weld::Button&, void); + DECL_LINK(HiddenTrackChangesHandler, weld::Button&, void); SAL_DLLPRIVATE void KillDispatcher_Impl(); virtual ~SfxViewFrame() override; diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs index a7f996dc4ed8..6b29f0b47e6a 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs @@ -54,6 +54,12 @@ </info> <value>true</value> </prop> + <prop oor:name="HiddenTrackChanges" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Whether an Infobar is shown when hidden Track Changes settings or data are there in a document</desc> + </info> + <value>true</value> + </prop> </group> </component> </oor:component-schema> diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 4844e8eb88df..3af15ee3f62c 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -434,6 +434,8 @@ bool SfxInfoBarContainerWindow::isInfobarEnabled(std::u16string_view sId) return officecfg::Office::UI::Infobar::Enabled::HyphenationMissing::get(); if (sId == u"whatsnew") return officecfg::Office::UI::Infobar::Enabled::WhatsNew::get(); + if (sId == u"hiddentrackchanges") + return officecfg::Office::UI::Infobar::Enabled::HiddenTrackChanges::get(); return true; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 596d8ab3d9fb..09c54757986d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -133,6 +133,8 @@ using ::com::sun::star::container::XIndexContainer; #define ShellClass_SfxViewFrame #include <sfxslots.hxx> +#define CHANGES_STR "private:resource/toolbar/changes" + SFX_IMPL_SUPERCLASS_INTERFACE(SfxViewFrame,SfxShell) void SfxViewFrame::InitInterface_Impl() @@ -1280,6 +1282,28 @@ void SfxViewFrame::AppendReadOnlyInfobar() } } +namespace +{ +css::uno::Reference<css::frame::XLayoutManager> getLayoutManager(const SfxFrame& rFrame) +{ + css::uno::Reference<css::frame::XLayoutManager> xLayoutManager; + css::uno::Reference<css::beans::XPropertySet> xPropSet(rFrame.GetFrameInterface(), + uno::UNO_QUERY); + if (xPropSet.is()) + { + try + { + xLayoutManager.set(xPropSet->getPropertyValue("LayoutManager"), uno::UNO_QUERY); + } + catch (const Exception& e) + { + SAL_WARN("sfx.view", "Failure getting layout manager: " + e.Message); + } + } + return xLayoutManager; +} +} + void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { if(m_pImpl->bIsDowning) @@ -1437,9 +1461,34 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) while (!aPendingInfobars.empty()) { InfobarData& aInfobarData = aPendingInfobars.back(); - AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage, + + // don't show Track Changes infobar, if Track Changes toolbar is visible + if (aInfobarData.msId == "hiddentrackchanges") + { + if (auto xLayoutManager = getLayoutManager(GetFrame())) + { + if ( xLayoutManager->getElement(CHANGES_STR).is() ) + { + aPendingInfobars.pop_back(); + continue; + } + } + } + + VclPtr<SfxInfoBarWindow> pInfoBar = + AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage, aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType, aInfobarData.mbShowCloseButton); + + // Track Changes infobar: add a button to show/hide Track Changes functions + if ( pInfoBar && aInfobarData.msId == "hiddentrackchanges" ) + { + weld::Button& rTrackChangesButton = pInfoBar->addButton(); + rTrackChangesButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON)); + rTrackChangesButton.connect_clicked(LINK(this, + SfxViewFrame, HiddenTrackChangesHandler)); + } + aPendingInfobars.pop_back(); } @@ -1559,6 +1608,27 @@ IMPL_LINK_NOARG(SfxViewFrame, SignDocumentHandler, weld::Button&, void) GetDispatcher()->Execute(SID_SIGNATURE); } +IMPL_LINK(SfxViewFrame, HiddenTrackChangesHandler, weld::Button&, rButton, void) +{ + // enable Track Changes toolbar, if it is disabled. + // Otherwise disable the toolbar, and close the infobar + if (auto xLayoutManager = getLayoutManager(GetFrame())) + { + if (!xLayoutManager->getElement(CHANGES_STR).is()) + { + xLayoutManager->createElement(CHANGES_STR); + xLayoutManager->showElement(CHANGES_STR); + rButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON_HIDE)); + } + else + { + xLayoutManager->hideElement(CHANGES_STR); + xLayoutManager->destroyElement(CHANGES_STR); + RemoveInfoBar(u"hiddentrackchanges"); + } + } +} + void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { m_pImpl->bResizeInToOut = true; @@ -2876,24 +2946,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_TOGGLESTATUSBAR: { - css::uno::Reference< css::frame::XFrame > xFrame = - GetFrame().GetFrameInterface(); - - Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); - Reference< css::frame::XLayoutManager > xLayoutManager; - if ( xPropSet.is() ) - { - try - { - Any aValue = xPropSet->getPropertyValue("LayoutManager"); - aValue >>= xLayoutManager; - } - catch ( Exception& ) - { - } - } - - if ( xLayoutManager.is() ) + if ( auto xLayoutManager = getLayoutManager(GetFrame()) ) { static const OUStringLiteral aStatusbarResString( u"private:resource/statusbar/statusbar" ); // Evaluate parameter. @@ -2929,23 +2982,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) WorkWindow* pWork = static_cast<WorkWindow*>( pTop->GetFrame().GetTopWindow_Impl() ); if ( pWork ) { - css::uno::Reference< css::frame::XFrame > xFrame = - GetFrame().GetFrameInterface(); - - Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); - Reference< css::frame::XLayoutManager > xLayoutManager; - if ( xPropSet.is() ) - { - try - { - Any aValue = xPropSet->getPropertyValue("LayoutManager"); - aValue >>= xLayoutManager; - } - catch ( Exception& ) - { - } - } - + Reference< css::frame::XLayoutManager > xLayoutManager = getLayoutManager(GetFrame()); bool bNewFullScreenMode = pItem ? pItem->GetValue() : !pWork->IsFullScreenMode(); if ( bNewFullScreenMode != pWork->IsFullScreenMode() ) { 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits