diff options
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 6 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sfxdlg.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sfxsids.hrc | 1 | ||||
-rw-r--r-- | include/sfx2/strings.hrc | 5 | ||||
-rw-r--r-- | include/sfx2/viewfrm.hxx | 2 | ||||
-rw-r--r-- | include/unotools/securityoptions.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 69 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 29 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 40 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 10 |
16 files changed, 116 insertions, 81 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 086fd01c5af3..63bfdbddbe39 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -854,16 +854,18 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog(weld::Wind } VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Window* pParent, const Reference< frame::XFrame >& rxFrame, - sal_uInt32 nResId, const OUString& rParameter ) + sal_uInt32 nResId, sal_uInt16 nPageId, const OUString& rParameter) { std::unique_ptr<OfaTreeOptionsDialog> xDlg; if (SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId) { // only activate last page if we don't want to activate a special page - bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() ); + bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() && !nPageId); xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, rxFrame, bActivateLastSelection); if ( nResId == SID_OPTIONS_DATABASES ) xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS); + else if (nPageId) + xDlg->ActivatePage(nPageId); else if ( !rParameter.isEmpty() ) xDlg->ActivatePage( rParameter ); } diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 38ca4beded0a..b57fe2995718 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -439,8 +439,7 @@ public: const SfxItemSet& rAttr, const css::uno::Reference< css::frame::XFrame >& rFrame) override; virtual VclPtr<VclAbstractDialog> CreateFrameDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, - sal_uInt32 nResId, - const OUString& rParameter ) override; + sal_uInt32 nResId, sal_uInt16 nPageId, const OUString& rParameter) override; virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) override; virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet, diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 7e5cb97827a6..ea2596658a5d 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -440,7 +440,7 @@ public: virtual bool PrepareClose(bool bUI = true); virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates ); - sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, weld::Window* pParent ); + void QueryHiddenInformation( HiddenWarningFact eFact ); bool IsSecurityOptOpenReadOnly() const; void SetSecurityOptOpenReadOnly( bool bOpenReadOnly ); diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx index 62e2f8013c3e..2513bbbb00f1 100644 --- a/include/sfx2/sfxdlg.hxx +++ b/include/sfx2/sfxdlg.hxx @@ -119,7 +119,7 @@ class SFX2_DLLPUBLIC SfxAbstractDialogFactory : virtual public VclAbstractDialog public: virtual ~SfxAbstractDialogFactory() override; // needed for export of vtable static SfxAbstractDialogFactory* Create(); - virtual VclPtr<VclAbstractDialog> CreateFrameDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rFrame, sal_uInt32 nResId, const OUString& rParameter) = 0; + virtual VclPtr<VclAbstractDialog> CreateFrameDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rFrame, sal_uInt32 nResId, sal_uInt16 nPageId, const OUString& rParameter) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet, diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index cc94d98ac664..9789cc8a0ac1 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -300,6 +300,7 @@ class SvxZoomItem; #define SID_WIDGET_TEST_DIALOG (SID_SFX_START + 1744) #define FN_CHANGE_THEME (SID_SFX_START + 1745) #define FN_PARAM_NEW_THEME TypedWhichId<SfxStringItem>(SID_SFX_START + 1746) +#define SID_OPTIONS_PAGEID TypedWhichId<SfxUInt16Item>(SID_SFX_START + 1747) // SID_SFX_free_END (SID_SFX_START + 3999) diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index 451012131537..300e1036169b 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -46,10 +46,6 @@ #define STR_HIDDENINFO_RECORDCHANGES NC_("STR_HIDDENINFO_RECORDCHANGES", "Recorded changes") #define STR_HIDDENINFO_NOTES NC_("STR_HIDDENINFO_NOTES", "Notes") #define STR_HIDDENINFO_DOCVERSIONS NC_("STR_HIDDENINFO_DOCVERSIONS", "Document versions") -#define STR_HIDDENINFO_CONTINUE_SAVING NC_("STR_HIDDENINFO_CONTINUE_SAVING", "Do you want to continue saving the document?") -#define STR_HIDDENINFO_CONTINUE_PRINTING NC_("STR_HIDDENINFO_CONTINUE_PRINTING", "Do you want to continue printing the document?") -#define STR_HIDDENINFO_CONTINUE_SIGNING NC_("STR_HIDDENINFO_CONTINUE_SIGNING", "Do you want to continue signing the document?") -#define STR_HIDDENINFO_CONTINUE_CREATEPDF NC_("STR_HIDDENINFO_CONTINUE_CREATEPDF", "Do you want to continue creating a PDF file?") #define STR_NEW_FILENAME_SAVE NC_("STR_NEW_FILENAME_SAVE", "If you do not want to overwrite the original document, you should save your work under a new filename.") // Used in the title of a shared document. #define STR_SHARED NC_("STR_SHARED", " (shared)") @@ -298,6 +294,7 @@ #define STR_MACROS_DISABLED NC_("STR_MACROS_DISABLED", "Macros are disabled due to the Macro Security settings.") #define STR_MACROS_DISABLED_CONTENT_UNSIGNED NC_("STR_MACROS_DISABLED_CONTENT_UNSIGNED", "Macros are signed, but the document (containing document events) is not signed.") #define STR_MACROS NC_("STR_MACROS", "Show Macros") +#define STR_SECURITY_OPTIONS NC_("STR_MACROS", "Show Security Options") #define STR_EVENTS NC_("STR_EVENTS", "Show Events") // Translators: default Impress template names diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index a5deb63a7ebf..7e038e9d6b96 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -65,6 +65,7 @@ class SFX2_DLLPUBLIC SfxViewFrame final : public SfxShell, public SfxListener DECL_DLLPRIVATE_LINK(DonationHandler, weld::Button&, void); DECL_DLLPRIVATE_LINK(WhatsNewHandler, weld::Button&, void); DECL_DLLPRIVATE_LINK(MacroButtonHandler, weld::Button&, void); + DECL_DLLPRIVATE_LINK(SecurityButtonHandler, weld::Button&, void); DECL_DLLPRIVATE_LINK(EventButtonHandler, weld::Button&, void); DECL_DLLPRIVATE_LINK(SwitchReadOnlyHandler, weld::Button&, void); DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button&, void); @@ -174,6 +175,7 @@ public: InfobarType eType); bool HasInfoBarWithID(std::u16string_view sId); void AppendReadOnlyInfobar(); + void HandleSecurityInfobar(const OUString& sSecondaryMessage); SAL_DLLPRIVATE void GetDocNumber_Impl(); SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh ); diff --git a/include/unotools/securityoptions.hxx b/include/unotools/securityoptions.hxx index 366317476fd2..dfc405cd89a1 100644 --- a/include/unotools/securityoptions.hxx +++ b/include/unotools/securityoptions.hxx @@ -143,6 +143,8 @@ namespace SvtSecurityOptions UNOTOOLS_DLLPUBLIC bool IsOptionSet ( EOption eOption ); UNOTOOLS_DLLPUBLIC void SetOption ( EOption eOption, bool bValue ); + UNOTOOLS_DLLPUBLIC bool IsInfobarSecurityWarningEnable(); + } // namespace SvtSecurityOptions // map personal info strings, e.g. authors to 1, 2, 3... for removing personal info diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 493361fabc0f..5b0ef2ca491f 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1440,10 +1440,16 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) const SfxStringItem* pURLItem = rReq.GetArg<SfxStringItem>(SID_OPTIONS_PAGEURL); if ( pURLItem ) sPageURL = pURLItem->GetValue(); + + sal_uInt16 nPageID = 0; + const SfxUInt16Item* pIDItem = rReq.GetArg<SfxUInt16Item>(SID_OPTIONS_PAGEID); + if (pIDItem) + nPageID = pIDItem->GetValue(); + Reference <XFrame> xFrame(GetRequestFrame(rReq)); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); VclPtr<VclAbstractDialog> pDlg = - pFact->CreateFrameDialog(rReq.GetFrameWeld(), xFrame, rReq.GetSlot(), sPageURL ); + pFact->CreateFrameDialog(rReq.GetFrameWeld(), xFrame, rReq.GetSlot(), nPageID, sPageURL); short nRet = pDlg->Execute(); pDlg.disposeAndClear(); SfxViewFrame* pView = SfxViewFrame::GetFirst(); diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index e4443b7f46fc..7290ec77eb78 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -887,12 +887,15 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert if ( "OptionsTreeDialog" == pSlot->pUnoName ) { auto pProp = std::find_if(rArgs.begin(), rArgs.end(), - [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL"; }); + [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL" || rProp.Name == "OptionsPageID"; }); if (pProp != rArgs.end()) { OUString sURL; - if ( pProp->Value >>= sURL ) + sal_uInt16 nPageID; + if ( pProp->Name == "OptionsPageURL" && (pProp->Value >>= sURL) ) rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) ); + else if ( pProp->Name == "OptionsPageID" && (pProp->Value >>= nPageID) ) + rSet.Put( SfxUInt16Item( SID_OPTIONS_PAGEID, nPageID ) ); } } } diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 2ab8704c1da4..ca848813f09e 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -15,6 +15,7 @@ #include <drawinglayer/processor2d/processor2dtools.hxx> #include <memory> #include <officecfg/Office/UI/Infobar.hxx> +#include <officecfg/Office/Common.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/infobar.hxx> @@ -438,6 +439,13 @@ bool SfxInfoBarContainerWindow::isInfobarEnabled(std::u16string_view sId) return officecfg::Office::UI::Infobar::Enabled::HiddenTrackChanges::get(); if (sId == u"macro") return officecfg::Office::UI::Infobar::Enabled::MacrosDisabled::get(); + if (sId == u"securitywarn") + { + return officecfg::Office::Common::Security::Scripting::WarnSaveOrSendDoc::get() + || officecfg::Office::Common::Security::Scripting::WarnSignDoc::get() + || officecfg::Office::Common::Security::Scripting::WarnPrintDoc::get() + || officecfg::Office::Common::Security::Scripting::WarnCreatePDF::get(); + } return true; } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index fb62f3768163..023780d4db50 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -535,49 +535,48 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if( SID_SIGNATURE == nId || SID_MACRO_SIGNATURE == nId ) { - if ( QueryHiddenInformation( HiddenWarningFact::WhenSigning, nullptr ) == RET_YES ) + QueryHiddenInformation(HiddenWarningFact::WhenSigning); + + if (SID_SIGNATURE == nId) { - if (SID_SIGNATURE == nId) + uno::Reference<security::XCertificate> xCertificate = GetSignPDFCertificate(); + if (xCertificate.is()) { - uno::Reference<security::XCertificate> xCertificate = GetSignPDFCertificate(); - if (xCertificate.is()) - { - bHaveWeSigned |= SignDocumentContentUsingCertificate(xCertificate); + bHaveWeSigned |= SignDocumentContentUsingCertificate(xCertificate); - // Reload to show how the PDF actually looks like after signing. This also - // changes "finish signing" on the infobar back to "sign document" as a side - // effect. - SfxViewFrame* pFrame = GetFrame(); - if (pFrame) + // Reload to show how the PDF actually looks like after signing. This also + // changes "finish signing" on the infobar back to "sign document" as a side + // effect. + SfxViewFrame* pFrame = GetFrame(); + if (pFrame) + { + // Store current page before reload. + SfxAllItemSet aSet(SfxGetpApp()->GetPool()); + uno::Reference<drawing::XDrawView> xController( + GetBaseModel()->getCurrentController(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPage(xController->getCurrentPage(), + uno::UNO_QUERY); + sal_Int32 nPage{}; + xPage->getPropertyValue("Number") >>= nPage; + if (nPage > 0) { - // Store current page before reload. - SfxAllItemSet aSet(SfxGetpApp()->GetPool()); - uno::Reference<drawing::XDrawView> xController( - GetBaseModel()->getCurrentController(), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xPage(xController->getCurrentPage(), - uno::UNO_QUERY); - sal_Int32 nPage{}; - xPage->getPropertyValue("Number") >>= nPage; - if (nPage > 0) - { - // nPage is 1-based. - aSet.Put(SfxInt32Item(SID_PAGE_NUMBER, nPage - 1)); - } - SfxRequest aReq(SID_RELOAD, SfxCallMode::SLOT, aSet); - pFrame->ExecReload_Impl(aReq); + // nPage is 1-based. + aSet.Put(SfxInt32Item(SID_PAGE_NUMBER, nPage - 1)); } - } - else - { - bHaveWeSigned |= SignDocumentContent(pDialogParent); + SfxRequest aReq(SID_RELOAD, SfxCallMode::SLOT, aSet); + pFrame->ExecReload_Impl(aReq); } } else { - bHaveWeSigned |= SignScriptingContent(pDialogParent); + bHaveWeSigned |= SignDocumentContent(pDialogParent); } } + else + { + bHaveWeSigned |= SignScriptingContent(pDialogParent); + } if ( bHaveWeSigned && HasValidSignatures() ) { @@ -1057,13 +1056,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if (bIsAsync && SfxViewShell::Current()) SfxViewShell::Current()->SetStoringHelper(xHelper); - if ( QueryHiddenInformation( bIsPDFExport ? HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving, nullptr ) != RET_YES ) - { - // the user has decided not to store the document - throw task::ErrorCodeIOException( - "SfxObjectShell::ExecFile_Impl: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); - } + QueryHiddenInformation(bIsPDFExport ? HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving); const SfxBoolItem *pItem = nId != SID_DIRECTEXPORTDOCASPDF ? nullptr : dynamic_cast<const SfxBoolItem*>( GetSlotState(SID_MAIL_PREPAREEXPORT) ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 8a1978681f99..b17b67a851a4 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -110,6 +110,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/sfxuno.hxx> #include <sfx2/event.hxx> +#include <sfx2/infobar.hxx> #include <fltoptint.hxx> #include <sfx2/viewfrm.hxx> #include "graphhelp.hxx" @@ -3081,35 +3082,29 @@ HiddenInformation SfxObjectShell::GetHiddenInformationState( HiddenInformation n return nState; } -sal_Int16 SfxObjectShell::QueryHiddenInformation(HiddenWarningFact eFact, weld::Window* pParent) +void SfxObjectShell::QueryHiddenInformation(HiddenWarningFact eFact) { - sal_Int16 nRet = RET_YES; - TranslateId pResId; SvtSecurityOptions::EOption eOption = SvtSecurityOptions::EOption(); switch ( eFact ) { case HiddenWarningFact::WhenSaving : { - pResId = STR_HIDDENINFO_CONTINUE_SAVING; eOption = SvtSecurityOptions::EOption::DocWarnSaveOrSend; break; } case HiddenWarningFact::WhenPrinting : { - pResId = STR_HIDDENINFO_CONTINUE_PRINTING; eOption = SvtSecurityOptions::EOption::DocWarnPrint; break; } case HiddenWarningFact::WhenSigning : { - pResId = STR_HIDDENINFO_CONTINUE_SIGNING; eOption = SvtSecurityOptions::EOption::DocWarnSigning; break; } case HiddenWarningFact::WhenCreatingPDF : { - pResId = STR_HIDDENINFO_CONTINUE_CREATEPDF; eOption = SvtSecurityOptions::EOption::DocWarnCreatePdf; break; } @@ -3119,40 +3114,30 @@ sal_Int16 SfxObjectShell::QueryHiddenInformation(HiddenWarningFact eFact, weld:: if ( SvtSecurityOptions::IsOptionSet( eOption ) ) { - OUString sMessage( SfxResId(STR_HIDDENINFO_CONTAINS) ); + OUString sMessage; HiddenInformation nWantedStates = HiddenInformation::RECORDEDCHANGES | HiddenInformation::NOTES; if ( eFact != HiddenWarningFact::WhenPrinting ) nWantedStates |= HiddenInformation::DOCUMENTVERSIONS; HiddenInformation nStates = GetHiddenInformationState( nWantedStates ); - bool bWarning = false; if ( nStates & HiddenInformation::RECORDEDCHANGES ) { sMessage += SfxResId(STR_HIDDENINFO_RECORDCHANGES) + "\n"; - bWarning = true; } if ( nStates & HiddenInformation::NOTES ) { sMessage += SfxResId(STR_HIDDENINFO_NOTES) + "\n"; - bWarning = true; } if ( nStates & HiddenInformation::DOCUMENTVERSIONS ) { sMessage += SfxResId(STR_HIDDENINFO_DOCVERSIONS) + "\n"; - bWarning = true; } - if ( bWarning ) - { - sMessage += "\n" + SfxResId(pResId); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pParent, - VclMessageType::Warning, VclButtonsType::YesNo, sMessage)); - xWarn->set_default_response(RET_NO); - nRet = xWarn->run(); - } - } + SfxViewFrame* pFrame = SfxViewFrame::GetFirst(this); + if (pFrame) + pFrame->HandleSecurityInfobar(!sMessage.isEmpty() ? sMessage.trim().replaceAll("\n", ", ") : sMessage); - return nRet; + } } bool SfxObjectShell::IsSecurityOptOpenReadOnly() const diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b15689e87b9d..d447c8396971 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -27,6 +27,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/classificationhelper.hxx> #include <sfx2/notebookbar/SfxNotebookBar.hxx> +#include <sfx2/pageids.hxx> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/DispatchRecorder.hpp> @@ -1306,6 +1307,38 @@ void SfxViewFrame::AppendReadOnlyInfobar() } } +void SfxViewFrame::HandleSecurityInfobar(const OUString& sSecondaryMessage) +{ + if (!HasInfoBarWithID(u"securitywarn")) + { + // new info bar + if (!sSecondaryMessage.isEmpty()) + { + auto pInfoBar = AppendInfoBar("securitywarn", SfxResId(STR_HIDDENINFO_CONTAINS).replaceAll("\n\n", " "), + sSecondaryMessage, InfobarType::WARNING); + if (!pInfoBar) + return; + + weld::Button& rGetInvolvedButton = pInfoBar->addButton(); + rGetInvolvedButton.set_label(SfxResId(STR_SECURITY_OPTIONS)); + rGetInvolvedButton.connect_clicked(LINK(this, SfxViewFrame, SecurityButtonHandler)); + } + } + else + { + // info bar exists already + if (sSecondaryMessage.isEmpty()) + { + RemoveInfoBar(u"securitywarn"); + } + else + { + UpdateInfoBar(u"securitywarn", SfxResId(STR_HIDDENINFO_CONTAINS).replaceAll("\n\n", " "), + sSecondaryMessage, InfobarType::WARNING); + } + } +} + void SfxViewFrame::AppendContainsMacrosInfobar() { SfxObjectShell_Impl* pObjImpl = m_xObjSh->Get_Impl(); @@ -1808,6 +1841,13 @@ IMPL_LINK_NOARG(SfxViewFrame, MacroButtonHandler, weld::Button&, void) { &aTabItem, &aCurrentDocItem }, { &aDocFrame }); } +IMPL_LINK_NOARG(SfxViewFrame, SecurityButtonHandler, weld::Button&, void) +{ + SfxUInt16Item aPageID(SID_OPTIONS_PAGEID, sal_uInt16(RID_SVXPAGE_INET_SECURITY)); + GetDispatcher()->ExecuteList(SID_OPTIONS_TREEDIALOG, SfxCallMode::SYNCHRON, { &aPageID }); + RemoveInfoBar(u"securitywarn"); +} + IMPL_LINK_NOARG(SfxViewFrame, EventButtonHandler, weld::Button&, void) { SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface()); diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 5ada786ba108..19fddbffdfa0 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -677,8 +677,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) return; } - if ( !bSilent && pDoc->QueryHiddenInformation( HiddenWarningFact::WhenPrinting, nullptr ) != RET_YES ) - return; + pDoc->QueryHiddenInformation(HiddenWarningFact::WhenPrinting); // should we print only the selection or the whole document const SfxBoolItem* pSelectItem = rReq.GetArg<SfxBoolItem>(SID_SELECTION); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 6b36430d7d4c..5e437b45269a 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1598,11 +1598,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) case SID_MAIL_SENDDOCASFORMAT: { SfxObjectShell* pDoc = GetObjectShell(); - if ( pDoc && pDoc->QueryHiddenInformation( - HiddenWarningFact::WhenSaving, GetViewFrame().GetFrameWeld() ) != RET_YES ) + if (!pDoc) break; - - + pDoc->QueryHiddenInformation(HiddenWarningFact::WhenSaving); SfxMailModel aModel; OUString aDocType; @@ -1658,9 +1656,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) { SfxBluetoothModel aModel; SfxObjectShell* pDoc = GetObjectShell(); - if ( pDoc && pDoc->QueryHiddenInformation( - HiddenWarningFact::WhenSaving, GetViewFrame().GetFrameWeld() ) != RET_YES ) + if (!pDoc) break; + pDoc->QueryHiddenInformation(HiddenWarningFact::WhenSaving); uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() ); SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame ); if( eResult == SfxMailModel::SEND_MAIL_ERROR ) |