basctl/source/basicide/baside2.cxx | 3 desktop/source/lib/init.cxx | 13 ++ framework/inc/uielement/styletoolbarcontroller.hxx | 4 framework/source/uielement/macrosmenucontroller.cxx | 4 framework/source/uielement/newmenucontroller.cxx | 55 ++++++++-- framework/source/uielement/popuptoolbarcontroller.cxx | 9 + framework/source/uielement/styletoolbarcontroller.cxx | 47 ++++++-- idl/inc/globals.hxx | 2 idl/inc/slot.hxx | 2 idl/source/objects/slot.cxx | 11 ++ idl/source/prj/globals.cxx | 1 include/sfx2/msg.hxx | 5 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 3 officecfg/registry/data/org/openoffice/Office/Accelerators.xcu | 12 -- officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 42 +++++++ officecfg/registry/schema/org/openoffice/Office/Common.xcs | 6 + officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 6 + sc/qa/unit/data/functions/date_time/fods/weeknum.fods | 22 ++-- sc/sdi/scalc.sdi | 52 ++++----- sc/source/ui/docshell/docsh6.cxx | 1 scripting/Library_protocolhandler.mk | 1 scripting/source/protocolhandler/scripthandler.cxx | 3 sfx2/inc/sidebar/DeckDescriptor.hxx | 1 sfx2/sdi/sfx.sdi | 35 ++++++ sfx2/source/appl/appserv.cxx | 5 sfx2/source/appl/linkmgr2.cxx | 25 +++- sfx2/source/control/dispatch.cxx | 14 ++ sfx2/source/dialog/backingwindow.cxx | 13 ++ sfx2/source/doc/docfile.cxx | 4 sfx2/source/doc/objmisc.cxx | 3 sfx2/source/sidebar/DeckDescriptor.cxx | 1 sfx2/source/sidebar/ResourceManager.cxx | 5 sfx2/source/view/frmload.cxx | 5 sfx2/source/view/viewfrm.cxx | 9 + svx/sdi/svx.sdi | 8 - sw/sdi/swriter.sdi | 9 + sw/source/uibase/dochdl/gloshdl.cxx | 5 sw/source/uibase/inc/selglos.hxx | 2 unotools/source/config/securityoptions.cxx | 4 vcl/source/window/dialog.cxx | 4 40 files changed, 356 insertions(+), 100 deletions(-)
New commits: commit e909d4472423bdaac2e27fa7ada3cb1ba63fb194 Author: Andras Timar <[email protected]> AuthorDate: Fri Feb 7 14:27:59 2025 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:40:43 2025 +0100 Respect document specific settings – cool#11103 The purpose of this CheckConfigOptions function is to reset formula separators, when there is a clash with decimal separator. However, ignoring other settings that are coming from the document can cause issues, like that we saw with LOKit, where StringRefAddressSyntax of a German XLSX document was reset to default CONV_UNSPECIFIED, and function =INDIREKT("Sheet1!A1") which was according to CONV_XL_A1 stopped working, and gave error #BEZUG (#REF). Change-Id: I7693deed436ad4e54569a21cc3faeaafceeb459c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181250 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index a453d51793f0..687b943cbcb1 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -491,6 +491,7 @@ void ScDocShell::CheckConfigOptions() // One of arg separators conflicts with the current decimal // separator. Reset them to default. ScFormulaOptions aNew = rOpt; + aNew.GetCalcConfig().MergeDocumentSpecific(m_pDocument->GetCalcConfig()); aNew.ResetFormulaSeparators(); SetFormulaOptions(aNew); pScMod->SetFormulaOptions(aNew); commit 894f04215efe2e2440327d7fabe5da57aa0d4b5e Author: Andras Timar <[email protected]> AuthorDate: Mon Feb 3 14:44:10 2025 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:40:34 2025 +0100 Fixed WEEKNUMBER test sheet, ISERROR(a13ú) did not seem right Change-Id: I01ccd512d38c887bfcf834ef2fbfcf46a2e98246 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181052 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sc/qa/unit/data/functions/date_time/fods/weeknum.fods b/sc/qa/unit/data/functions/date_time/fods/weeknum.fods index 2f84286ae929..4dadb429684f 100644 --- a/sc/qa/unit/data/functions/date_time/fods/weeknum.fods +++ b/sc/qa/unit/data/functions/date_time/fods/weeknum.fods @@ -825,7 +825,7 @@ <table:table-cell office:value-type="string" calcext:value-type="string"> <text:p>Err</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR([.A12])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A12])" office:value-type="string" office:string-value="=WEEKNUM(K10;K1:K2)" calcext:value-type="string"> @@ -840,7 +840,7 @@ <table:table-cell office:value-type="float" office:value="30" calcext:value-type="float"> <text:p>30</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A13]=[.B13]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A13])" office:value-type="string" office:string-value="=WEEKNUM($K$9;11)" calcext:value-type="string"> @@ -855,7 +855,7 @@ <table:table-cell office:value-type="float" office:value="30" calcext:value-type="float"> <text:p>30</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A14]=[.B14]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A14])" office:value-type="string" office:string-value="=WEEKNUM($K$9;12)" calcext:value-type="string"> @@ -871,7 +871,7 @@ <table:table-cell office:value-type="float" office:value="30" calcext:value-type="float"> <text:p>30</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A15]=[.B15]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A15])" office:value-type="string" office:string-value="=WEEKNUM($K$9;13)" calcext:value-type="string"> @@ -886,7 +886,7 @@ <table:table-cell office:value-type="float" office:value="30" calcext:value-type="float"> <text:p>30</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A16]=[.B16]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A16])" office:value-type="string" office:string-value="=WEEKNUM($K$9;14)" calcext:value-type="string"> @@ -901,7 +901,7 @@ <table:table-cell office:value-type="float" office:value="30" calcext:value-type="float"> <text:p>30</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A17]=[.B17]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A17])" office:value-type="string" office:string-value="=WEEKNUM($K$9;15)" calcext:value-type="string"> @@ -919,7 +919,7 @@ <table:table-cell office:value-type="float" office:value="31" calcext:value-type="float"> <text:p>31</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A18]=[.B18]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A18])" office:value-type="string" office:string-value="=WEEKNUM($K$9;16)" calcext:value-type="string"> @@ -934,7 +934,7 @@ <table:table-cell office:value-type="float" office:value="31" calcext:value-type="float"> <text:p>31</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A19]=[.B19]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A19])" office:value-type="string" office:string-value="=WEEKNUM($K$9;17)" calcext:value-type="string"> @@ -949,7 +949,7 @@ <table:table-cell office:value-type="float" office:value="29" calcext:value-type="float"> <text:p>29</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A20]=[.B20]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A20])" office:value-type="string" office:string-value="=WEEKNUM($K$9;21)" calcext:value-type="string"> @@ -964,7 +964,7 @@ <table:table-cell office:value-type="float" office:value="29" calcext:value-type="float"> <text:p>29</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR(a13ú)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A21]=[.B21]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A21])" office:value-type="string" office:string-value="=WEEKNUM($K$9;150)" calcext:value-type="string"> @@ -1008,4 +1008,4 @@ </table:named-expressions> </office:spreadsheet> </office:body> -</office:document> \ No newline at end of file +</office:document> commit 0cad76eb6de1ecc09a2575357f4ef389ac1e7f8e Author: Andras Timar <[email protected]> AuthorDate: Tue Jan 28 13:07:10 2025 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:40:27 2025 +0100 Ctrl+F should focus to the Find bar in German UI, too. Change-Id: I2d7619f09c69036bbd95eaf10838affe10d40619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180829 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index 8de235336bbe..a411e687f773 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -1058,18 +1058,6 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input <value xml:lang="en-US" install:module="unxwnt">.uno:RepeatSearch</value> </prop> </node> - <node oor:name="F_MOD1" oor:op="replace"> - <prop oor:name="Command"> - <value xml:lang="x-no-translate">L10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="de">.uno:Navigator</value> - </prop> - </node> - <node oor:name="F_MOD2" oor:op="replace"> - <prop oor:name="Command"> - <value xml:lang="x-no-translate">L10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="de">vnd.sun.star.findbar:FocusToFindbar</value> - </prop> - </node> <node oor:name="F_MOD1_MOD2" oor:op="replace"> <prop oor:name="Command"> <value xml:lang="x-no-translate">L10N SHORTCUTS - NO TRANSLATE</value> commit c63941068e282bee9a2713e376901cc7a5df638c Author: Andras Timar <[email protected]> AuthorDate: Thu Jan 16 10:56:38 2025 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:40:17 2025 +0100 LOK: preload hyphenators Without this fix the hyphenation feature did not work when bind mounting was not available, e.g. in docker containers. Change-Id: I800012b5229ce5a56a5698db7057e3a27e760be3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180337 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d5ac74a2d14e..06ea11391d80 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -7901,6 +7901,19 @@ static void preloadData() } std::cerr << " "; + // preload all available hyphenators + css::uno::Reference<linguistic2::XHyphenator> xHyphenator(xLngSvcMgr->getHyphenator()); + css::uno::Reference<linguistic2::XSupportedLocales> xHyphLocales(xHyphenator, css::uno::UNO_QUERY_THROW); + aLocales = xHyphLocales->getLocales(); + std::cerr << "Preloading local hyphenators: "; + for (auto &it : std::as_const(aLocales)) + { + std::cerr << LanguageTag::convertToBcp47(it) << " "; + css::beans::PropertyValues aNone; + xHyphenator->createPossibleHyphens(u"forcefed"_ustr, it, aNone); + } + std::cerr << " "; + std::cerr << "Preloading breakiterator "; if (aLocales.getLength()) { diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 1e527c8e8ada..a00b4e5a3d2f 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/uno/Reference.h> +#include <comphelper/lok.hxx> #include <comphelper/sequence.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> @@ -150,6 +151,8 @@ void Hyphenator::ensureLocales() { for (const auto& rLocaleName : dict.aLocaleNames) { + if (!comphelper::LibreOfficeKit::isAllowlistedLanguage(rLocaleName)) + continue; aLocaleNamesSet.insert( rLocaleName ); } } commit dc4cbe4995d0f807b5651aa4ace24f0de021001f Author: Andras Timar <[email protected]> AuthorDate: Tue Jan 14 13:17:22 2025 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:40:08 2025 +0100 The ':' separator without spaces was difficult to read on UI Change-Id: I0886518f254659b6e9c1c242a9331b85e471dd62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180235 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/source/uibase/inc/selglos.hxx b/sw/source/uibase/inc/selglos.hxx index fd5de379631a..4273d43e12d8 100644 --- a/sw/source/uibase/inc/selglos.hxx +++ b/sw/source/uibase/inc/selglos.hxx @@ -37,7 +37,7 @@ public: void InsertGlos(std::u16string_view rRegion, std::u16string_view rGlosName) { - const OUString aTmp = OUString::Concat(rRegion) + ":" + rGlosName; + const OUString aTmp = OUString::Concat(rRegion) + " - " + rGlosName; m_xGlosBox->append_text(aTmp); } sal_Int32 GetSelectedIdx() const commit 97e380ad8fb3384375f29ff812d0c82f8fbb618c Author: Andras Timar <[email protected]> AuthorDate: Tue Jan 14 13:08:50 2025 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:40:00 2025 +0100 Localize "My AutoText" one more place Change-Id: Ia743818dc5aacbc11f41154692bbf79f32eeb50d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180234 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index ec9cb818d9a0..5f746df07528 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -440,7 +440,10 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, ScopedVclPtr<AbstractSwSelGlossaryDlg> pDlg(pFact->CreateSwSelGlossaryDlg(pParent, aShortName)); for(const TextBlockInfo_Impl & i : aFoundArr) { - pDlg->InsertGlos(i.sTitle, i.sLongName); + if (i.sTitle == "My AutoText") + pDlg->InsertGlos(SwResId(STR_MY_AUTOTEXT), i.sLongName); + else + pDlg->InsertGlos(i.sTitle, i.sLongName); } pDlg->SelectEntryPos(0); const sal_Int32 nRet = RET_OK == pDlg->Execute() ? commit bf23e1dde87829c8adb71ba91cf68667ef4f56c7 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Jan 16 13:21:46 2025 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:38:23 2025 +0100 LOK: Do not try to show an "update links" dialog In commit f8528cdda9292c7ae6c9d49b80c1a3a3b4a67094 (LOK: don't crash when trying to show a dialog during file load, 2024-12-26), all not yet async / not properly set up dialogs made to fail gracefully. In the follow-up https://gerrit.libreoffice.org/c/core/+/180334, an assert is added to still fail in debug builds. The specific "update links" dialog case, that triggered the original change in the first place, does not need to appear at all in the LOK case, because there is no external documents available for updating. This change avoids the dialog in that case. Change-Id: I7c6bc755d87656f002829460f4768fed34dc2f17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180335 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 8a54ac946945..6d9bb0476e17 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <comphelper/lok.hxx> #include <comphelper/string.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/sfxsids.hrc> @@ -278,6 +281,12 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, return bRet; } +static void disallowAllLinksUpdate(SvBaseLink* pShellProvider) +{ + if (SfxObjectShell* pShell = pShellProvider->GetLinkManager()->GetPersist()) + pShell->getEmbeddedObjectContainer().setUserAllowsLinkUpdate(false); +} + void LinkManager::UpdateAllLinks( bool bAskUpdate, bool bUpdateGrfLinks, @@ -325,6 +334,13 @@ void LinkManager::UpdateAllLinks( if( bAskUpdate ) { + if (comphelper::LibreOfficeKit::isActive()) + { + // only one document in jail, no update possible + disallowAllLinksUpdate(pLink); + return; + } + OUString aMsg = SfxResId(STR_QUERY_UPDATE_LINKS); INetURLObject aURL(pPersist->getDocumentBaseURL()); aMsg = aMsg.replaceFirst("%{filename}", aURL.GetLastName()); @@ -336,14 +352,7 @@ void LinkManager::UpdateAllLinks( int nRet = xQueryBox->run(); if( RET_YES != nRet ) { - SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); - - if(pShell) - { - comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer(); - rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); - } - + disallowAllLinksUpdate(pLink); return ; // nothing should be updated } bAskUpdate = false; // once is enough commit 85a9f568bd6420bc6342a7890ac067de73dd61e8 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Jan 16 13:04:25 2025 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:37:28 2025 +0100 Add an assert to allow debugging not yet async dialogs Commit f8528cdda9292c7ae6c9d49b80c1a3a3b4a67094 (LOK: don't crash when trying to show a dialog during file load, 2024-12-26) fixed a crash when a not async / not properly set up dialog was attempted in Online. This is reasonable in release builds, but the added assert helps to find the problem in development (debug) builds. Change-Id: Ie75574cc7a69de06f6b63925249a5da2e50abb6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180334 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 430ef9136d4e..989b95cf5cd1 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -939,6 +939,10 @@ bool Dialog::ImplStartExecute() // Also pNotifier may be nullptr when a dialog (e.g., "update // links?") is to be shown when loading a document. + // Never crash in release builds (assume "cancel"), but allow + // to see the not yet async / not properly set up dialogs in + // debug builds. + assert(!"A dialog without a notifier: make me async / properly set up"); return false; } } commit 111d8e56294e99d701ef820468e30f39fa059d45 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Dec 11 11:42:46 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:36:52 2025 +0100 Use SvtSecurityOptions::IsMacroDisabled() instead of officecfg check The change is most important for Viewer app mode, which also disables macros Change-Id: Ie305649dafbb3717e7986a4b437c38b09ffc1802 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178275 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index dd75a88b06fc..4d805f65113a 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -58,6 +58,7 @@ #include <svl/whiter.hxx> #include <svx/svxids.hrc> #include <tools/debug.hxx> +#include <unotools/securityoptions.hxx> #include <utility> #include <vcl/locktoplevels.hxx> #include <vcl/errinf.hxx> @@ -318,7 +319,7 @@ void ModulWindow::BasicExecute() { // #116444# check security settings before macro execution ScriptDocument aDocument( GetDocument() ); - bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); + bool bMacrosDisabled = SvtSecurityOptions::IsMacroDisabled(); if (bMacrosDisabled || (aDocument.isDocument() && !aDocument.allowMacros())) { std::unique_ptr<weld::MessageDialog> xBox( diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 9899b9fa6ac2..1e78355d7738 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -28,6 +28,7 @@ #include <osl/mutex.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/supportsservice.hxx> +#include <unotools/securityoptions.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -67,8 +68,7 @@ MacrosMenuController::~MacrosMenuController() // private function void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & rPopupMenu ) { - bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); - if (bMacrosDisabled) + if (SvtSecurityOptions::IsMacroDisabled()) return; SolarMutexGuard aSolarMutexGuard; diff --git a/scripting/Library_protocolhandler.mk b/scripting/Library_protocolhandler.mk index 31599c3d865b..d0fb4169625a 100644 --- a/scripting/Library_protocolhandler.mk +++ b/scripting/Library_protocolhandler.mk @@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_libraries,protocolhandler,\ sal \ sfx \ tl \ + utl \ vcl \ )) diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index bcf53854ebf6..5e87f1623e7d 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -43,6 +43,7 @@ #include <cppuhelper/supportsservice.hxx> #include <framework/documentundoguard.hxx> #include <officecfg/Office/Common.hxx> +#include <unotools/securityoptions.hxx> #include <com/sun/star/uri/XUriReference.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp> @@ -117,7 +118,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( const URL& aURL, const Sequence < PropertyValue >& lArgs, const Reference< XDispatchResultListener >& xListener ) { - if (officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get()) + if (SvtSecurityOptions::IsMacroDisabled()) return; sal_Int16 aState = css::frame::DispatchResultState::FAILURE; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 7331194d83a6..f0c95f049e5c 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -72,6 +72,7 @@ #include <vcl/toolbox.hxx> #include <unotools/moduleoptions.hxx> +#include <unotools/securityoptions.hxx> #include <rtl/bootstrap.hxx> #include <com/sun/star/frame/ModuleManager.hpp> @@ -2085,9 +2086,7 @@ void SfxApplication::OfaState_Impl(SfxItemSet &rSet) if ( comphelper::LibreOfficeKit::isActive() ) rSet.DisableItem( SID_AUTO_CORRECT_DLG ); - bool bMacrosDisabled - = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); - if (bMacrosDisabled) + if (SvtSecurityOptions::IsMacroDisabled()) { rSet.DisableItem(SID_RUNMACRO); rSet.DisableItem(SID_MACROORGANIZER); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 312ad182ca0e..e70cceeffe70 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3402,8 +3402,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_RECORDMACRO : { const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()}; - bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); - if (bMacrosDisabled || + if (SvtSecurityOptions::IsMacroDisabled() || !officecfg::Office::Common::Misc::MacroRecorderMode::get() || ( sName!="swriter" && sName!="scalc" ) ) { commit ce817bcc83d7fca5d70ccd874469a732a41da24d Author: Mike Kaganski <[email protected]> AuthorDate: Wed Dec 11 06:24:54 2024 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:36:35 2025 +0100 Disable macros in Viewer Mode Prevents "This document contains macros" dialog on file open. Change-Id: I92cbd6b5f919ccfa5812b4a90ec72ad4378d009a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178273 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index 263a32808aec..19fa71b3beba 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -205,7 +205,9 @@ void SetMacroSecurityLevel( sal_Int32 _nLevel ) bool IsMacroDisabled() { - return comphelper::IsFuzzing() || officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); + return comphelper::IsFuzzing() + || officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get() + || officecfg::Office::Common::Misc::ViewerAppMode::get(); } std::vector< SvtSecurityOptions::Certificate > GetTrustedAuthors() commit 23caef07a79b6299123d0479a07322b14cdb81db Author: Mike Kaganski <[email protected]> AuthorDate: Tue Dec 10 17:23:47 2024 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:36:14 2025 +0100 These slots don't make sense even in read-only mode Thanks Miklos for spotting this! Change-Id: Ic4e85b2357f5cd98ce2932e50e8e84e8bcb25f9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178261 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 4b067f001f07..e1e00a4b80b2 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -4565,8 +4565,7 @@ SfxVoidItem ChangePicture SID_CHANGE_PICTURE [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, - ViewerApp = FALSE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -4600,8 +4599,7 @@ SfxVoidItem CompressGraphic SID_COMPRESS_GRAPHIC [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, - ViewerApp = FALSE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, commit c8887f45c8b60f0a5a1343e1367efbe84d1c66c9 Author: Mike Kaganski <[email protected]> AuthorDate: Tue Dec 10 15:57:20 2024 +0100 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:35:55 2025 +0100 Simplify the slot status check, and add some comments Change-Id: Ie2a77f0c5157a03a3461ae54d372382b1e57fe2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178238 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 4172ffad04f4a72d9865612530ae4d9117f1eb59) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178245 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index ffb08179dc43..613e1cb1b657 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -56,26 +56,12 @@ using namespace com::sun::star::ui; namespace { +/** + * A simple status listener, storing the "enabled" status from the last status notification + */ class SlotStatusGetter : public comphelper::WeakImplHelper<css::frame::XStatusListener> { public: - SlotStatusGetter(const css::util::URL& url, - const css::uno::Reference<css::frame::XFrame>& frame) - { - if (auto provider = frame.query<css::frame::XDispatchProvider>()) - { - if (auto xDispatch = provider->queryDispatch(url, {}, 0)) - { - // Avoid self-destruction - osl_atomic_increment(&m_refCount); - // Adding as listener will automatically emit an initial notification - xDispatch->addStatusListener(this, url); - xDispatch->removeStatusListener(this, url); - osl_atomic_decrement(&m_refCount); - } - } - } - bool isEnabled() const { return m_bEnabled; } private: @@ -94,11 +80,23 @@ private: bool isSlotActive(const OUString& slot, const css::uno::Reference<css::frame::XFrame>& frame, const css::uno::Reference<css::util::XURLTransformer>& transformer) { - css::util::URL url; - url.Complete = slot; - transformer->parseStrict(url); - rtl::Reference slotStatus(new SlotStatusGetter(url, frame)); - return slotStatus->isEnabled(); + if (auto provider = frame.query<css::frame::XDispatchProvider>()) + { + css::util::URL url; + url.Complete = slot; + transformer->parseStrict(url); + if (auto dispatch = provider->queryDispatch(url, {}, 0)) + { + rtl::Reference slotStatus(new SlotStatusGetter); + // Adding as listener will automatically emit an initial notification. The status + // reported in the notification will be stored in the SlotStatusGetter instance. + dispatch->addStatusListener(slotStatus, url); + dispatch->removeStatusListener(slotStatus, url); + return slotStatus->isEnabled(); + } + } + + return false; } } commit b4d5e759694ee014601d048278c57337a7ca7e4d Author: Mike Kaganski <[email protected]> AuthorDate: Mon Dec 9 14:54:47 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:35:37 2025 +0100 Check if the correct slot is active in SaveToolbarController::statusChanged Otherwise, the button may still be active, even with the slot disabled. Change-Id: Id292b69513a7de8248d33fa813a8b09964f30434 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178124 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 4fbbf6839b07..f92aad0451d6 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -458,6 +458,9 @@ void SaveToolbarController::initialize( const css::uno::Sequence< css::uno::Any { PopupMenuToolbarController::initialize( aArguments ); + // Also listen to the status of the slot used for read-only case + m_aListenerMap.emplace(u".uno:SaveAs"_ustr, css::uno::Reference<css::frame::XDispatch>()); + ToolBox* pToolBox = nullptr; ToolBoxItemId nId; if ( !getToolboxId( nId, &pToolBox ) ) @@ -540,9 +543,9 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& bool bLastReadOnly = m_bReadOnly; m_bReadOnly = m_xStorable.is() && m_xStorable->isReadonly(); + OUString sCommand = m_bReadOnly ? u".uno:SaveAs"_ustr : m_aCommandURL; if ( bLastReadOnly != m_bReadOnly ) { - OUString sCommand = m_bReadOnly ? u".uno:SaveAs"_ustr : m_aCommandURL; auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand, vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame)); pToolBox->SetQuickHelpText( nId, @@ -552,8 +555,8 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& updateImage(); } - if ( !m_bReadOnly ) - pToolBox->EnableItem( nId, rEvent.IsEnabled ); + if (rEvent.FeatureURL.Complete == sCommand) + pToolBox->EnableItem(nId, rEvent.IsEnabled); } void SaveToolbarController::modified( const css::lang::EventObject& /*rEvent*/ ) commit d5b817bbc7f1a0aeb56c751aa999bc2e0a54d338 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 23:14:57 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:34:59 2025 +0100 Check if the slot is active in NewMenuController::fillPopupMenu Otherwise, the popup menu gets filled, even when the respective slot is disabled. Change-Id: I74ff3692500ca76e6e15bf3725dd295f0213403c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178002 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 0aa152028a38..ffb08179dc43 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -45,7 +45,7 @@ // Defines constexpr OUString aSlotNewDocDirect = u".uno:AddDirect"_ustr; -constexpr OUStringLiteral aSlotAutoPilot = u".uno:AutoPilotMenu"; +constexpr OUString aSlotAutoPilot = u".uno:AutoPilotMenu"_ustr; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -54,6 +54,54 @@ using namespace com::sun::star::beans; using namespace com::sun::star::util; using namespace com::sun::star::ui; +namespace +{ +class SlotStatusGetter : public comphelper::WeakImplHelper<css::frame::XStatusListener> +{ +public: + SlotStatusGetter(const css::util::URL& url, + const css::uno::Reference<css::frame::XFrame>& frame) + { + if (auto provider = frame.query<css::frame::XDispatchProvider>()) + { + if (auto xDispatch = provider->queryDispatch(url, {}, 0)) + { + // Avoid self-destruction + osl_atomic_increment(&m_refCount); + // Adding as listener will automatically emit an initial notification + xDispatch->addStatusListener(this, url); + xDispatch->removeStatusListener(this, url); + osl_atomic_decrement(&m_refCount); + } + } + } + + bool isEnabled() const { return m_bEnabled; } + +private: + // XStatusListener + void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& state) override + { + m_bEnabled = state.IsEnabled; + } + + // XEventListener + void SAL_CALL disposing(const css::lang::EventObject&) override {} // unused + + bool m_bEnabled = false; +}; + +bool isSlotActive(const OUString& slot, const css::uno::Reference<css::frame::XFrame>& frame, + const css::uno::Reference<css::util::XURLTransformer>& transformer) +{ + css::util::URL url; + url.Complete = slot; + transformer->parseStrict(url); + rtl::Reference slotStatus(new SlotStatusGetter(url, frame)); + return slotStatus->isEnabled(); +} +} + namespace framework { @@ -295,12 +343,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & if ( !pVCLPopupMenu ) return; - Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - URL aTargetURL; - aTargetURL.Complete = m_bNewMenu ? aSlotNewDocDirect : OUString(aSlotAutoPilot); - m_xURLTransformer->parseStrict( aTargetURL ); - Reference< XDispatch > xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); - if(xMenuItemDispatch == nullptr) + if (!isSlotActive(m_bNewMenu ? aSlotNewDocDirect : aSlotAutoPilot, m_xFrame, m_xURLTransformer)) return; const std::vector< SvtDynMenuEntry > aDynamicMenuEntries = commit 24fe09b592154877cb131ff81a7944f81be8e2c5 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 16:20:25 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:34:39 2025 +0100 tdf#62845: Introduce ViewerApp flag for slots, to hide in Viewer app mode Some slots make sense in read-only files, when the application runs in normal mode; but they make no sense in Viewer app mode. So this new flag is orthogonal to the existing ReadOnlyDoc flag. When it is FALSE, the respective command should not be active in the viewer mode. The default is TRUE. Change-Id: I5b5c75487fdf5a647aeab80129b6e84b42c00745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177965 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/idl/inc/globals.hxx b/idl/inc/globals.hxx index b72d53fafae2..ff7068113fb5 100644 --- a/idl/inc/globals.hxx +++ b/idl/inc/globals.hxx @@ -58,6 +58,7 @@ struct SvGlobalHashNames SvStringHashEntry* MM_SbxObject; SvStringHashEntry* MM_Container; SvStringHashEntry* MM_ReadOnlyDoc; + SvStringHashEntry* MM_ViewerApp; SvStringHashEntry* MM_struct; SvStringHashEntry* MM_DisableFlags; @@ -118,6 +119,7 @@ HASH_INLINE(FastCall) HASH_INLINE(SbxObject) HASH_INLINE(Container) HASH_INLINE(ReadOnlyDoc) +HASH_INLINE(ViewerApp) HASH_INLINE(struct) HASH_INLINE(DisableFlags) diff --git a/idl/inc/slot.hxx b/idl/inc/slot.hxx index 34d60f1831af..00654144db35 100644 --- a/idl/inc/slot.hxx +++ b/idl/inc/slot.hxx @@ -48,6 +48,7 @@ public: SvMetaSlot* pNextSlot; sal_uInt32 nListPos; SvBOOL aReadOnlyDoc; + SvBOOL aViewerApp; void WriteSlot( std::string_view rShellName, sal_uInt16 nCount, std::string_view rSlotId, @@ -101,6 +102,7 @@ public: bool GetFastCall() const; bool GetContainer() const; bool GetReadOnlyDoc() const; + bool GetViewerApp() const; sal_uInt32 GetListPos() const { return nListPos; } diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 8edff3a63efd..33279a5290d2 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -30,6 +30,7 @@ SvMetaSlot::SvMetaSlot() , pNextSlot(nullptr) , nListPos(0) , aReadOnlyDoc ( true ) + , aViewerApp ( true ) { } @@ -40,6 +41,7 @@ SvMetaSlot::SvMetaSlot( SvMetaType * pType ) , pNextSlot(nullptr) , nListPos(0) , aReadOnlyDoc ( true ) + , aViewerApp ( true ) { } @@ -49,6 +51,12 @@ bool SvMetaSlot::GetReadOnlyDoc() const return static_cast<SvMetaSlot *>(GetRef())->GetReadOnlyDoc(); } +bool SvMetaSlot::GetViewerApp() const +{ + if( aViewerApp.IsSet() || !GetRef() ) return aViewerApp; + return static_cast<SvMetaSlot*>(GetRef())->GetViewerApp(); +} + bool SvMetaSlot::IsVariable() const { SvMetaType * pType = GetType(); @@ -171,6 +179,7 @@ void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase, aStateMethod.ReadSvIdl( SvHash_StateMethod(), rInStm ); ReadStringSvIdl( SvHash_DisableFlags(), rInStm, aDisableFlags ); aReadOnlyDoc.ReadSvIdl( SvHash_ReadOnlyDoc(), rInStm ); + aViewerApp.ReadSvIdl( SvHash_ViewerApp(), rInStm ); aToggle.ReadSvIdl( SvHash_Toggle(), rInStm ); aAutoUpdate.ReadSvIdl( SvHash_AutoUpdate(), rInStm ); aAsynchron.ReadSvIdl( SvHash_Asynchron(), rInStm ); @@ -501,6 +510,8 @@ void SvMetaSlot::WriteSlot( std::string_view rShellName, sal_uInt16 nCount, rOutStm.WriteOString( MakeSlotName( SvHash_Container() ) ).WriteChar( '|' ); if ( GetReadOnlyDoc() ) rOutStm.WriteOString( MakeSlotName( SvHash_ReadOnlyDoc() ) ).WriteChar( '|' ); + if ( GetViewerApp() ) + rOutStm.WriteOString( MakeSlotName( SvHash_ViewerApp() ) ).WriteChar( '|' ); rOutStm.WriteOString( "SfxSlotMode::NONE" ); rOutStm.WriteChar( ',' ) << endl; diff --git a/idl/source/prj/globals.cxx b/idl/source/prj/globals.cxx index c4ac9ff20a25..a4d7af15d930 100644 --- a/idl/source/prj/globals.cxx +++ b/idl/source/prj/globals.cxx @@ -77,6 +77,7 @@ SvGlobalHashNames::SvGlobalHashNames() A_ENTRY(SbxObject) A_ENTRY(Container) A_ENTRY(ReadOnlyDoc) + A_ENTRY(ViewerApp) A_ENTRY(struct) A_ENTRY(DisableFlags) {} diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx index 88d9f68cf6ca..9b84bb62b27e 100644 --- a/include/sfx2/msg.hxx +++ b/include/sfx2/msg.hxx @@ -51,12 +51,13 @@ enum class SfxSlotMode { ACCELCONFIG = 0x80000, // configurable keys CONTAINER = 0x100000, // Operated by the container at InPlace - READONLYDOC = 0x200000 // also available for read-only Documents + READONLYDOC = 0x200000, // also available for read-only Documents + VIEWERAPP = 0x400000, // also available in Viewer app mode }; namespace o3tl { - template<> struct typed_flags<SfxSlotMode> : is_typed_flags<SfxSlotMode, 0x13ec72cL> {}; + template<> struct typed_flags<SfxSlotMode> : is_typed_flags<SfxSlotMode, 0x17ec72cL> {}; } #define SFX_EXEC_STUB( aShellClass, aExecMethod) \ diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index aa09ee044235..c07d4bbf7a83 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -196,6 +196,7 @@ SfxStringItem NewDoc SID_NEWDOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -233,6 +234,7 @@ SfxStringItem AddDirect SID_NEWDOCDIRECT AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -326,6 +328,7 @@ SfxStringItem AutoPilotMenu SID_AUTOPILOTMENU AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -383,6 +386,7 @@ SfxVoidItem BasicIDEAppear SID_BASICIDE_APPEAR AutoUpdate = FALSE, FastCall = TRUE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -2346,6 +2350,7 @@ SfxScriptOrganizerItem ScriptOrganizer SID_SCRIPTORGANIZER AutoUpdate = FALSE, FastCall = TRUE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -2364,6 +2369,7 @@ SfxScriptOrganizerItem MacroOrganizer SID_MACROORGANIZER AutoUpdate = FALSE, FastCall = TRUE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -2416,6 +2422,7 @@ SfxVoidItem RunMacro SID_RUNMACRO AutoUpdate = FALSE, FastCall = TRUE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -2433,6 +2440,7 @@ SfxVoidItem MacroManager SID_MACROMANAGER AutoUpdate = FALSE, FastCall = TRUE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -2982,6 +2990,7 @@ SfxVoidItem OpenTemplate SID_OPENTEMPLATE AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3697,6 +3706,7 @@ SfxVoidItem SaveSimple SID_SAVESIMPLE AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = FALSE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3714,6 +3724,7 @@ SfxStringItem Save SID_SAVEDOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = FALSE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3733,6 +3744,7 @@ SfxVoidItem SaveAll SID_SAVEDOCS AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = FALSE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3751,6 +3763,7 @@ SfxStringItem SaveAs SID_SAVEASDOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3768,6 +3781,7 @@ SfxStringItem SaveAsRemote SID_SAVEASREMOTE AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3786,6 +3800,7 @@ SfxVoidItem SaveAsTemplate SID_DOCTEMPLATE AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3805,6 +3820,7 @@ SfxVoidItem SaveACopy SID_SAVEACOPY AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3822,6 +3838,7 @@ SfxVoidItem SaveBasicAs SID_BASICSAVEAS AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3841,6 +3858,7 @@ SfxVoidItem ExportDialog SID_EXPORT_DIALOG AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4096,6 +4114,7 @@ SfxStringItem SendMailDocAsPDF SID_MAIL_SENDDOCASPDF AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4133,6 +4152,7 @@ SfxStringItem SendMailDocAsFormat SID_MAIL_SENDDOCASFORMAT AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4151,6 +4171,7 @@ SfxStringItem SendMailDocAsMS SID_MAIL_SENDDOCASMS AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4169,6 +4190,7 @@ SfxStringItem SendMailDocAsOOo SID_MAIL_SENDDOCASOOO AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4939,6 +4961,7 @@ SfxVoidItem ExportTo SID_EXPORTDOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4957,6 +4980,7 @@ SfxVoidItem ExportToPDF SID_EXPORTDOCASPDF AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4975,6 +4999,7 @@ SfxVoidItem ExportDirectToPDF SID_DIRECTEXPORTDOCASPDF AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -4992,6 +5017,7 @@ SfxVoidItem ExportToEPUB SID_EXPORTDOCASEPUB AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -5009,6 +5035,7 @@ SfxVoidItem ExportDirectToEPUB SID_DIRECTEXPORTDOCASEPUB AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -5026,6 +5053,7 @@ SfxVoidItem RedactDoc SID_REDACTDOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -5043,6 +5071,7 @@ SfxVoidItem AutoRedactDoc SID_AUTOREDACTDOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -5274,6 +5303,7 @@ SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = FALSE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5293,6 +5323,7 @@ SfxVoidItem InsertLabels FN_LABEL AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = FALSE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5312,6 +5343,7 @@ SfxVoidItem NewXForms FN_XFORMS_INIT AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = FALSE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5331,6 +5363,7 @@ SfxVoidItem NewPresentation SID_NEWSD AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -5366,6 +5399,7 @@ SfxVoidItem AutoCorrectDlg SID_AUTO_CORRECT_DLG AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5837,6 +5871,7 @@ SfxBoolItem DevelopmentToolsDockingWindow SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW AutoUpdate = TRUE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = TRUE, Container = FALSE, RecordAbsolute = FALSE, diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 87dc47d8c976..cb0f26e3c4b6 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -40,6 +40,7 @@ #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> +#include <officecfg/Office/Common.hxx> #include <rtl/strbuf.hxx> #include <sal/log.hxx> #include <sfx2/app.hxx> @@ -1156,6 +1157,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne return; StatusBarId eStatBarId = StatusBarId::None; + const bool isViewerAppMode = officecfg::Office::Common::Misc::ViewerAppMode::get(); SfxSlotPool* pSlotPool = &SfxSlotPool::GetSlotPool( GetFrame() ); sal_uInt16 nTotCount = xImp->aStack.size(); @@ -1217,6 +1219,14 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne sal_uInt32 nId = pIFace->GetChildWindowId(nNo); const SfxSlot *pSlot = pSlotPool->GetSlot( static_cast<sal_uInt16>(nId) ); SAL_INFO_IF( !pSlot, "sfx.control", "Childwindow slot missing: " << nId ); + + if (isViewerAppMode) + { + // Skip if the slot is not allowed in viewer app mode + if (pSlot && !pSlot->IsMode(SfxSlotMode::VIEWERAPP)) + continue; + } + if ( bReadOnlyShell ) { // only show ChildWindows if their slot is allowed for readonly documents @@ -1609,6 +1619,7 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer) return false; } + const bool isViewerAppMode = officecfg::Office::Common::Misc::ViewerAppMode::get(); bool bReadOnly = ( SfxSlotFilterState::ENABLED_READONLY != nSlotEnableMode && xImp->bReadOnly ); bool bCheckForCommentCommands = false; @@ -1641,6 +1652,9 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer) ( static_cast<int>(pSlot->nDisableFlags) & static_cast<int>(pObjShell->GetDisableFlags()) ) != 0 ) return false; + if (pSlot && !(pSlot->nFlags & SfxSlotMode::VIEWERAPP) && isViewerAppMode) + return false; + if ( pSlot && !( pSlot->nFlags & SfxSlotMode::READONLYDOC ) && bReadOnly ) return false; diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 8563b1376f60..4b067f001f07 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -4465,6 +4465,7 @@ SfxVoidItem ExternalEdit SID_EXTERNAL_EDIT AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -4565,6 +4566,7 @@ SfxVoidItem ChangePicture SID_CHANGE_PICTURE AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -4599,6 +4601,7 @@ SfxVoidItem CompressGraphic SID_COMPRESS_GRAPHIC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -6071,6 +6074,7 @@ SfxBoolItem OpenReadOnly SID_FM_OPEN_READONLY AutoUpdate = TRUE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = TRUE, Container = FALSE, RecordAbsolute = FALSE, diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index dd123e29f6cf..bba5111a7077 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -1043,6 +1043,7 @@ SfxVoidItem EditGlossary FN_GLOSSARY_DLG AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -4672,6 +4673,7 @@ SfxVoidItem NewGlobalDoc FN_NEW_GLOBAL_DOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -4689,6 +4691,7 @@ SfxVoidItem NewHtmlDoc FN_NEW_HTML_DOC AutoUpdate = FALSE, FastCall = FALSE, ReadOnlyDoc = TRUE, + ViewerApp = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, commit dc9f3be947a5edfc1701749f2ac924a50d79aa89 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 16:19:00 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:34:21 2025 +0100 Mark an svx slot as inactive in readonly mode Change-Id: I4e508c2492025bd7e39a1c67cc68016977843de3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177964 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 53f531866276..8563b1376f60 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12623,7 +12623,7 @@ SfxVoidItem ThemeDialog SID_THEME_DIALOG [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, commit 79369278500c7111b53de1a517e5b2c96f80d611 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 16:17:43 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:33:56 2025 +0100 Mark some Calc slots as inactive in readonly mode Change-Id: If1874a3d85b90e5671abdb026549ac913f990a8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177963 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index b8f8aa2dd505..f8a179a8d3e9 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -917,7 +917,7 @@ SfxVoidItem CreateNames FID_USE_NAME [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1021,7 +1021,7 @@ SfxVoidItem DataFilterAutoFilter SID_AUTO_FILTER [ AutoUpdate = TRUE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1039,7 +1039,7 @@ SfxVoidItem DataFilterHideAutoFilter SID_AUTOFILTER_HIDE [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1057,7 +1057,7 @@ SfxVoidItem DataFilterRemoveFilter SID_UNFILTER [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1075,7 +1075,7 @@ SfxVoidItem DataFilterSpecialFilter SID_SPECIAL_FILTER [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1093,7 +1093,7 @@ SfxVoidItem DataFilterStandardFilter SID_FILTER [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1255,7 +1255,7 @@ SfxVoidItem DefineLabelRange SID_DEFINE_COLROWNAMERANGES [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -1543,7 +1543,7 @@ SfxVoidItem EditHeaderAndFooter SID_HFEDIT [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3240,7 +3240,7 @@ SfxVoidItem AddName FID_ADD_NAME [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3258,7 +3258,7 @@ SfxVoidItem InsertName FID_INSERT_NAME [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3820,7 +3820,7 @@ SfxStringItem NumberFormat SID_NUMBER_FORMAT [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3839,7 +3839,7 @@ SfxBoolItem NumberFormatCurrency SID_NUMBER_CURRENCY [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3857,7 +3857,7 @@ SfxVoidItem NumberFormatDate SID_NUMBER_DATE [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3875,7 +3875,7 @@ SfxVoidItem NumberFormatDecDecimals SID_NUMBER_DECDEC [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3893,7 +3893,7 @@ SfxVoidItem NumberFormatDecimal SID_NUMBER_TWODEC [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3911,7 +3911,7 @@ SfxVoidItem NumberFormatIncDecimals SID_NUMBER_INCDEC [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3929,7 +3929,7 @@ SfxVoidItem NumberFormatPercent SID_NUMBER_PERCENT [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3947,7 +3947,7 @@ SfxVoidItem NumberFormatScientific SID_NUMBER_SCIENTIFIC [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3965,7 +3965,7 @@ SfxVoidItem NumberFormatStandard SID_NUMBER_STANDARD [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -3983,7 +3983,7 @@ SfxVoidItem NumberFormatTime SID_NUMBER_TIME [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -4001,7 +4001,7 @@ SfxVoidItem NumberFormatThousands SID_NUMBER_THOUSANDS [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5649,7 +5649,7 @@ SfxVoidItem TableEvents FID_TAB_EVENTS [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5759,7 +5759,7 @@ SfxVoidItem ToggleRelative SID_TOGGLE_REL [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -5795,7 +5795,7 @@ SfxBoolItem TraceChangeMode FID_CHG_RECORD [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -6140,7 +6140,7 @@ SfxBoolItem WrapText SID_ATTR_ALIGN_LINEBREAK [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -6742,4 +6742,4 @@ SfxVoidItem CopyDelete SID_COPYDELETE MenuConfig = TRUE, ToolBoxConfig = TRUE, GroupId = SfxGroupId::Edit; -] \ No newline at end of file +] commit 2141651a054e378befe68dc59564d372273812b8 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 16:15:30 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:33:35 2025 +0100 Mark some Writer slots as inactive in readonly mode Change-Id: Ic27b5558a835d1adaca5af52ae7ec5c81643a9e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177962 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 77403112479e..dd123e29f6cf 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -4160,7 +4160,7 @@ SfxBoolItem HighlightCharDF FN_HIGHLIGHT_CHAR_DF [ AutoUpdate = TRUE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = TRUE, Container = FALSE, RecordAbsolute = FALSE, @@ -5330,7 +5330,7 @@ SfxVoidItem Repaginate FN_REPAGINATE [ AutoUpdate = FALSE, FastCall = TRUE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -6490,7 +6490,7 @@ SfxBoolItem TableNumberRecognition FN_SET_MODOPT_TBLNUMFMT [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, commit 646d68f277641890cd9eaa4959ac279cb493031d Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 00:55:59 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:33:20 2025 +0100 tdf#62845: Hide some sidebar panels in Viewer app mode These are confusing and cluttering the UI in this mode. Change-Id: I909f17f71846f5a7e82e43f078f32ed7b5daf159 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177961 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index b4a826bcf680..f9a0e6ad7ffe 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -39,6 +39,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>100</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="InspectorDeck" oor:op="replace"> @@ -59,6 +62,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>600</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="WriterPageDeck" oor:op="replace"> @@ -79,6 +85,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="CommentsDeck" oor:op="replace"> @@ -122,6 +131,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>900</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="ShapesDeck" oor:op="replace"> @@ -142,6 +154,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> @@ -165,6 +180,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="SdMasterPagesDeck" oor:op="replace"> @@ -185,6 +203,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>700</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="SdCustomAnimationDeck" oor:op="replace"> @@ -205,6 +226,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>600</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="SdSlideTransitionDeck" oor:op="replace"> @@ -225,6 +249,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="NavigatorDeck" oor:op="replace"> @@ -269,6 +296,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>200</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="ScFunctionsDeck" oor:op="replace"> @@ -289,6 +319,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>500</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="SwManageChangesDeck" oor:op="replace"> @@ -313,6 +346,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>600</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="SwDesignDeck" oor:op="replace"> @@ -336,6 +372,9 @@ <prop oor:name="IsExperimental" oor:type="xs:boolean"> <value>true</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="ElementsDeck" oor:op="replace"> @@ -356,6 +395,9 @@ <prop oor:name="OrderIndex" oor:type="xs:int"> <value>300</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <value>true</value> + </prop> </node> <node oor:name="FindDeck" oor:op="replace"> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs index 28adbee51e30..e619c9028922 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs @@ -140,6 +140,12 @@ </info> <value>false</value> </prop> + <prop oor:name="HiddenInViewer" oor:type="xs:boolean"> + <info> + <desc>This flag controls whether the deck is hidden when viewer application mode is enabled.</desc> + </info> + <value>false</value> + </prop> </group> <group oor:name="Panel"> <info> diff --git a/sfx2/inc/sidebar/DeckDescriptor.hxx b/sfx2/inc/sidebar/DeckDescriptor.hxx index 8fde0c0330f7..dc9174c79383 100644 --- a/sfx2/inc/sidebar/DeckDescriptor.hxx +++ b/sfx2/inc/sidebar/DeckDescriptor.hxx @@ -39,6 +39,7 @@ public: bool mbIsEnabled; sal_Int32 mnOrderIndex; bool mbExperimental; + bool mbHiddenInViewerMode = false; OUString msNodeName; // some impress deck nodes names are different from their Id diff --git a/sfx2/source/sidebar/DeckDescriptor.cxx b/sfx2/source/sidebar/DeckDescriptor.cxx index 29af33e33f22..97aa42cc0f3c 100644 --- a/sfx2/source/sidebar/DeckDescriptor.cxx +++ b/sfx2/source/sidebar/DeckDescriptor.cxx @@ -41,6 +41,7 @@ DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther) mbIsEnabled(rOther.mbIsEnabled), mnOrderIndex(rOther.mnOrderIndex), mbExperimental(rOther.mbExperimental), + mbHiddenInViewerMode(rOther.mbHiddenInViewerMode), mpDeck(rOther.mpDeck) { } diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 93e55d5a0b10..cf333c1b0a8f 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -130,6 +130,8 @@ std::shared_ptr<DeckDescriptor> ResourceManager::ImplGetDeckDescriptor(std::u16s { for (auto const& deck : maDecks) { + if (deck->mbHiddenInViewerMode && officecfg::Office::Common::Misc::ViewerAppMode::get()) + continue; if (deck->mbExperimental && !officecfg::Office::Common::Misc::ExperimentalMode::get()) continue; if (deck->msId == rsDeckId) @@ -169,6 +171,8 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds; for (auto const& deck : maDecks) { + if (deck->mbHiddenInViewerMode && officecfg::Office::Common::Misc::ViewerAppMode::get()) + continue; if (deck->mbExperimental && !officecfg::Office::Common::Misc::ExperimentalMode::get()) continue; @@ -281,6 +285,7 @@ void ResourceManager::ReadDeckList() rDeckDescriptor.msHelpId = "SIDEBAR_" + rDeckDescriptor.msId.toAsciiUpperCase(); rDeckDescriptor.mnOrderIndex = getInt32(aDeckNode, u"OrderIndex"_ustr); rDeckDescriptor.mbExperimental = getBool(aDeckNode, u"IsExperimental"_ustr); + rDeckDescriptor.mbHiddenInViewerMode = getBool(aDeckNode, u"HiddenInViewer"_ustr); rDeckDescriptor.msNodeName = aDeckName; commit 2630bdc2e344f600a3079bd20f4652e27cec11d2 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 17:51:10 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:33:05 2025 +0100 Let StyleDispatcher take the state of StyleApply slot into account Before, it only listened to ParaStyle, or CharStyle, etc. obtained in MapFamilyToCommand; and that meant, that its actual command was ".uno:StyleApply?...", but StyleApply state was ignored. This meant that all respective items under "Style" menu were enabled in read- only mode, where StyleApply itself was inactive. Listen to both. When StyleApply is disabled, that takes priority. Change-Id: Ic087ba6fc6fe6d45b8c8ecc35494734cd8765bd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177971 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/framework/inc/uielement/styletoolbarcontroller.hxx b/framework/inc/uielement/styletoolbarcontroller.hxx index 45b1ad7eccce..c155a7b2242b 100644 --- a/framework/inc/uielement/styletoolbarcontroller.hxx +++ b/framework/inc/uielement/styletoolbarcontroller.hxx @@ -52,8 +52,10 @@ private: OUString m_aStyleName, m_aCommand, m_aStatusCommand; css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer; css::uno::Reference< css::frame::XDispatchProvider > m_xFrame; - css::uno::Reference< css::frame::XDispatch > m_xStatusDispatch; + css::uno::Reference< css::frame::XDispatch > m_xStyleApplyStatusDispatch; + css::uno::Reference< css::frame::XDispatch > m_xStyleFamilyStatusDispatch; css::uno::Reference< css::frame::XStatusListener > m_xOwner; + bool m_bStyleApplyEnabled = true; // If this is disabled, style family state is irrelevant }; class StyleToolbarController final : public svt::ToolboxController diff --git a/framework/source/uielement/styletoolbarcontroller.cxx b/framework/source/uielement/styletoolbarcontroller.cxx index 7e4a02c1423d..acad86db5e25 100644 --- a/framework/source/uielement/styletoolbarcontroller.cxx +++ b/framework/source/uielement/styletoolbarcontroller.cxx @@ -127,9 +127,12 @@ StyleDispatcher::StyleDispatcher( const css::uno::Reference< css::frame::XFrame if ( m_xFrame.is() ) { css::util::URL aStatusURL; + aStatusURL.Complete = u".uno:StyleApply"_ustr; + m_xUrlTransformer->parseStrict( aStatusURL ); + m_xStyleApplyStatusDispatch = m_xFrame->queryDispatch(aStatusURL, OUString(), 0); aStatusURL.Complete = m_aStatusCommand; m_xUrlTransformer->parseStrict( aStatusURL ); - m_xStatusDispatch = m_xFrame->queryDispatch( aStatusURL, OUString(), 0 ); + m_xStyleFamilyStatusDispatch = m_xFrame->queryDispatch(aStatusURL, OUString(), 0); } } @@ -147,32 +150,51 @@ void StyleDispatcher::dispatch( const css::util::URL& rURL, void StyleDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& rListener, const css::util::URL& /*rURL*/ ) { - if ( m_xStatusDispatch.is() ) + if ( !m_xOwner.is() ) + m_xOwner.set( rListener ); + if (m_xStyleApplyStatusDispatch) + { + css::util::URL aStatusURL; + aStatusURL.Complete = u".uno:StyleApply"_ustr; + m_xUrlTransformer->parseStrict(aStatusURL); + m_xStyleApplyStatusDispatch->addStatusListener(this, aStatusURL); + } + if (m_xStyleFamilyStatusDispatch) { - if ( !m_xOwner.is() ) - m_xOwner.set( rListener ); - css::util::URL aStatusURL; aStatusURL.Complete = m_aStatusCommand; m_xUrlTransformer->parseStrict( aStatusURL ); - m_xStatusDispatch->addStatusListener( this, aStatusURL ); + m_xStyleFamilyStatusDispatch->addStatusListener(this, aStatusURL); } } void StyleDispatcher::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*rListener*/, const css::util::URL& /*rURL*/ ) { - if ( m_xStatusDispatch.is() ) + if (m_xStyleFamilyStatusDispatch) { css::util::URL aStatusURL; aStatusURL.Complete = m_aStatusCommand; m_xUrlTransformer->parseStrict( aStatusURL ); - m_xStatusDispatch->removeStatusListener( this, aStatusURL ); + m_xStyleFamilyStatusDispatch->removeStatusListener(this, aStatusURL); + } + if (m_xStyleApplyStatusDispatch) + { + css::util::URL aStatusURL; + aStatusURL.Complete = u".uno:StyleApply"_ustr; + m_xUrlTransformer->parseStrict(aStatusURL); + m_xStyleApplyStatusDispatch->removeStatusListener(this, aStatusURL); } } void StyleDispatcher::statusChanged( const css::frame::FeatureStateEvent& rEvent ) { + if (rEvent.FeatureURL.Complete == ".uno:StyleApply") + { + m_bStyleApplyEnabled = rEvent.IsEnabled; + return; + } + css::frame::status::Template aTemplate; rEvent.State >>= aTemplate; @@ -180,15 +202,18 @@ void StyleDispatcher::statusChanged( const css::frame::FeatureStateEvent& rEvent aEvent.FeatureURL.Complete = m_aCommand; m_xUrlTransformer->parseStrict( aEvent.FeatureURL ); - aEvent.IsEnabled = rEvent.IsEnabled; + aEvent.IsEnabled = m_bStyleApplyEnabled && rEvent.IsEnabled; aEvent.Requery = rEvent.Requery; aEvent.State <<= m_aStyleName == aTemplate.StyleName; m_xOwner->statusChanged( aEvent ); } -void StyleDispatcher::disposing( const css::lang::EventObject& /*rSource*/ ) +void StyleDispatcher::disposing( const css::lang::EventObject& rSource ) { - m_xStatusDispatch.clear(); + if (rSource.Source == m_xStyleFamilyStatusDispatch) + m_xStyleFamilyStatusDispatch.clear(); + if (rSource.Source == m_xStyleApplyStatusDispatch) + m_xStyleApplyStatusDispatch.clear(); } StyleToolbarController::StyleToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rContext, commit c58ebb2f91ba9c767b1037a8f6a167abbe456398 Author: Mike Kaganski <[email protected]> AuthorDate: Fri Dec 6 00:55:59 2024 +0500 Commit: Andras Timar <[email protected]> CommitDate: Sat Feb 8 22:32:48 2025 +0100 tdf#62845: Introduce an application-wide viewer mode Using the new 'ViewerAppMode' expert setting, the UI should disable all the edit controls; all options to create new content (including new documents); i.e., work as a view-only application. This change: 1. Introduces the setting. 2. Checks it in SfxMedium::IsReadOnly, making sure that all documents always have read-only medium. 3. Checks it in SfxFrameLoader_Impl::load, to prevent creation of new documents. 4. Checks it in SfxObjectShell::isEditDocLocked, to prevent entering edit mode. 5. Checks it in BackingWindow::checkInstalledModules, to hide buttons that create new documents. 6. Checks it in SfxViewFrame methods, to avoid showing "readonly" and "macros" infobars. Change-Id: Iaeeb8aab16db83ebdf500fd2bca8b8a9ac2180ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177903 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 4a98b0b06c09..108815678b58 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5570,6 +5570,12 @@ </info> <value>true</value> </prop> + <prop oor:name="ViewerAppMode" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Open all files in read-only mode</desc> + </info> + <value>false</value> + </prop> <prop oor:name="OfferSafeMode" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Offer Safe Mode to the user.</desc> diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 06f6385b8e70..2027d2c08e74 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -431,6 +431,19 @@ void BackingWindow::initializeLocalView() void BackingWindow::checkInstalledModules() { + if (officecfg::Office::Common::Misc::ViewerAppMode::get()) + { + mxTemplateButton->set_visible(false); + mxCreateLabel->set_visible(false); + mxWriterAllButton->set_visible(false); + mxCalcAllButton->set_visible(false); + mxImpressAllButton->set_visible(false); + mxDrawAllButton->set_visible(false); + mxMathAllButton->set_visible(false); + mxDBAllButton->set_visible(false); + return; + } + SvtModuleOptions aModuleOpt; mxWriterAllButton->set_sensitive(aModuleOpt.IsWriterInstalled()); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 13711a5a31c5..2e7a0b15b4cc 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3964,6 +3964,10 @@ void SfxMedium::SaveVersionList_Impl() bool SfxMedium::IsReadOnly() const { + // Application-wide read-only mode first + if (officecfg::Office::Common::Misc::ViewerAppMode::get()) + return true; + // a) ReadOnly filter can't produce read/write contents! bool bReadOnly = pImpl->m_pFilter && (pImpl->m_pFilter->GetFilterFlags() & SfxFilterFlags::OPENREADONLY); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 7fe107ee2045..7d48d40a7439 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -2016,7 +2016,8 @@ bool SfxObjectShell::isEditDocLocked() const Reference<XModel3> xModel = GetModel(); if (!xModel.is()) return false; - if (!officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get()) + if (officecfg::Office::Common::Misc::ViewerAppMode::get() + || !officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get()) return true; try { diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 000c3854046f..7ef7c19d2f63 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -53,6 +53,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <framework/interaction.hxx> +#include <officecfg/Office/Common.hxx> #include <rtl/ref.hxx> #include <sal/log.hxx> #include <svl/eitem.hxx> @@ -626,6 +627,10 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // check for factory URLs to create a new doc, instead of loading one const OUString sURL = aDescriptor.getOrDefault( u"URL"_ustr, OUString() ); const bool bIsFactoryURL = sURL.startsWith( "private:factory/" ); + + if (bIsFactoryURL && officecfg::Office::Common::Misc::ViewerAppMode::get()) + return false; + std::shared_ptr<const SfxFilter> pEmptyURLFilter; bool bInitNewModel = bIsFactoryURL; const bool bIsDefault = bIsFactoryURL && !bExternalModel; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6c7f41239cf8..312ad182ca0e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1267,6 +1267,9 @@ const SvBorder& SfxViewFrame::GetBorderPixelImpl() const void SfxViewFrame::AppendReadOnlyInfobar() { + if (officecfg::Office::Common::Misc::ViewerAppMode::get()) + return; + bool bSignPDF = m_xObjSh->IsSignPDF(); bool bSignWithCert = false; if (bSignPDF) @@ -1345,6 +1348,9 @@ void SfxViewFrame::HandleSecurityInfobar(const OUString& sSecondaryMessage) void SfxViewFrame::AppendContainsMacrosInfobar() { + if (officecfg::Office::Common::Misc::ViewerAppMode::get()) + return; + SfxObjectShell_Impl* pObjImpl = m_xObjSh->Get_Impl(); auto aResId = STR_CONTAINS_MACROS;
