core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) New commits: commit 5995f21774754d306ead2763e1bf4ef357f5a23b Author: Mike Kaganski AuthorDate: Fri May 31 12:56:37 2024 +0200 Commit: Mike Kaganski CommitDate: Fri May 31 20:13:07 2024 +0200 Avoid race There are reports that RuntimeUID may be some unexpected value like 1206137128392, in unclear cases. This is a blind shot at that. Change-Id: I724f082c361243beb4bd2ac14edf3176259f15d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168209 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index cd00bff1a4f7..d52c3cbe7a86 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -198,7 +198,7 @@ void SAL_CALL SfxDocInfoListener_Impl::disposing( const lang::EventObject& ) struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument { // counter for SfxBaseModel instances created. -static sal_Int64 g_nInstanceCounter ; +inline static std::atomic g_nInstanceCounter = 0 ; SfxObjectShellRef m_pObjectShell ; OUString m_sURL ; OUString m_sRuntimeUID ; @@ -256,10 +256,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument , m_bExternalTitle( false ) , m_bDisposing( false ) { -// increase global instance counter. -++g_nInstanceCounter; -// set own Runtime UID -m_sRuntimeUID = OUString::number( g_nInstanceCounter ); +// increase global instance counter, and set own Runtime UID +m_sRuntimeUID = OUString::number(++g_nInstanceCounter); } virtual ~IMPL_SfxBaseModel_DataContainer() @@ -340,9 +338,6 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument } }; -// static member initialization. -sal_Int64 IMPL_SfxBaseModel_DataContainer::g_nInstanceCounter = 0; - namespace { // Listener that forwards notifications from the PrintHelper to the "real" listeners
core.git: sfx2/source
sfx2/source/doc/objstor.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 72b5eb77aa3388dc0832ca4f94a8122bb9f66694 Author: Andrea Gelmini AuthorDate: Fri May 31 13:06:38 2024 +0200 Commit: Julien Nabet CommitDate: Fri May 31 17:32:49 2024 +0200 Fix typos Change-Id: I1abaec8ec9a678d31e62bb685c39e9bc9d406edb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168291 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index cee4847022ed..6816b7c29613 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1022,7 +1022,7 @@ void SfxObjectShell::DetectCsvSeparators(SvStream& stream, rtl_TextEncoding& eCh nLinesCount ++; -// For each character count the lines that contain it and different number of occurences. +// For each character count the lines that contain it and different number of occurrences. // And the global maximum for the first statistic. for (auto aCurLineChar=aCharsCount.cbegin(); aCurLineChar != aCharsCount.cend(); aCurLineChar++) { @@ -1041,7 +1041,7 @@ void SfxObjectShell::DetectCsvSeparators(SvStream& stream, rtl_TextEncoding& eCh break; } if (aPrevLineChar == aLinesCharsCount.cend()) -aCurStats->second.second ++;// Increment number of different number of occurences. +aCurStats->second.second ++;// Increment number of different number of occurrences. // Update the maximum of number of lines that contain the same character. This is a global value. if (nMaxLinesSameChar < aCurStats->second.first) @@ -1053,14 +1053,14 @@ void SfxObjectShell::DetectCsvSeparators(SvStream& stream, rtl_TextEncoding& eCh aLinesCharsCount[aLinesCharsCount.size() - 1].swap(aCharsCount); } -// Compute the global minimum of different number of occurences. +// Compute the global minimum of different number of occurrences. // But only for characters which occur in a maximum number of lines (previously computed). for (auto it=aStats.cbegin(); it != aStats.cend(); it++) if (it->second.first == nMaxLinesSameChar && nMinDiffs > it->second.second) nMinDiffs = it->second.second; -// Compute the initial list of separators: those with the maximum lines of occurence and -// the minimum of different number of occurences. +// Compute the initial list of separators: those with the maximum lines of occurrence and +// the minimum of different number of occurrences. for (auto it=aStats.cbegin(); it != aStats.cend(); it++) if (it->second.first == nMaxLinesSameChar && it->second.second == nMinDiffs) sInitSeps += OUStringChar(it->first);
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 9f55ef05d6ed0732217729d90f79a57ab0a21ff0 Author: Thorsten Behrens AuthorDate: Sun May 26 21:23:10 2024 +0200 Commit: Thorsten Behrens CommitDate: Mon May 27 00:00:53 2024 +0200 Fix WASM build Wrong line for closing brace, after 1bd9747a126a3e82b6093c2b4af3b3a74774a3e9 Change-Id: I552853f0eafc92c3d5435e4292de6c88db4d1260 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168078 Reviewed-by: Thorsten Behrens Tested-by: Jenkins diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index cb93b9c000de..59a31cf55d87 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1746,12 +1746,11 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch); batch->commit(); } +} #else (void) bIsInfobarShown; #endif -} - break; } default: break;
core.git: sfx2/source
sfx2/source/doc/objxtor.cxx |6 +++--- sfx2/source/view/viewfrm.cxx |8 sfx2/source/view/viewsh.cxx |8 3 files changed, 11 insertions(+), 11 deletions(-) New commits: commit fe599b2e081aa671d19ccbcea922c201f66eb955 Author: Caolán McNamara AuthorDate: Fri May 17 17:01:47 2024 +0100 Commit: Caolán McNamara CommitDate: Sat May 18 11:34:09 2024 +0200 drop SAL_RET_MAYBENULL from bodies looks like we can get away without it and its tidier for us if we don't need to do it Change-Id: I29a68724a0cd2f33367c700b11c0d40397f607cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167788 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index deb64e6186ac..592b1e7468a5 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -458,7 +458,7 @@ OUString SfxObjectShell::CreateShellID( const SfxObjectShell* pShell ) // returns a pointer the first SfxDocument of specified type -SAL_RET_MAYBENULL SfxObjectShell* SfxObjectShell::GetFirst +SfxObjectShell* SfxObjectShell::GetFirst ( const std::function& isObjectShell, bool bOnlyVisible @@ -483,7 +483,7 @@ SAL_RET_MAYBENULL SfxObjectShell* SfxObjectShell::GetFirst // returns a pointer to the next SfxDocument of specified type behind *pDoc -SAL_RET_MAYBENULL SfxObjectShell* SfxObjectShell::GetNext +SfxObjectShell* SfxObjectShell::GetNext ( const SfxObjectShell& rPrev, const std::function& isObjectShell, @@ -512,7 +512,7 @@ SAL_RET_MAYBENULL SfxObjectShell* SfxObjectShell::GetNext return nullptr; } -SAL_RET_MAYBENULL SfxObjectShell* SfxObjectShell::Current() +SfxObjectShell* SfxObjectShell::Current() { SfxViewFrame *pFrame = SfxViewFrame::Current(); return pFrame ? pFrame->GetObjectShell() : nullptr; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1838700e9cb1..c77de75697fc 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2067,14 +2067,14 @@ void SfxViewFrame::KillDispatcher_Impl() } } -SAL_RET_MAYBENULL SfxViewFrame* SfxViewFrame::Current() +SfxViewFrame* SfxViewFrame::Current() { SfxApplication* pApp = SfxApplication::Get(); return pApp ? pApp->Get_Impl()->pViewFrame : nullptr; } // returns the first window of spec. type viewing the specified doc. -SAL_RET_MAYBENULL SfxViewFrame* SfxViewFrame::GetFirst +SfxViewFrame* SfxViewFrame::GetFirst ( const SfxObjectShell* pDoc, boolbOnlyIfVisible @@ -2097,7 +2097,7 @@ SAL_RET_MAYBENULL SfxViewFrame* SfxViewFrame::GetFirst } // returns the next window of spec. type viewing the specified doc. -SAL_RET_MAYBENULL SfxViewFrame* SfxViewFrame::GetNext +SfxViewFrame* SfxViewFrame::GetNext ( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc, @@ -2448,7 +2448,7 @@ SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell const & i_rDoc, c ); } -SAL_RET_MAYBENULL SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, const SfxObjectShell* i_pDoc ) +SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, const SfxObjectShell* i_pDoc ) { if ( !i_rController.is() ) return nullptr; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 5204f8306c67..df122f41054f 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2835,7 +2835,7 @@ bool SfxViewShell::PrepareClose return true; } -SAL_RET_MAYBENULL SfxViewShell* SfxViewShell::Current() +SfxViewShell* SfxViewShell::Current() { SfxViewFrame *pCurrent = SfxViewFrame::Current(); return pCurrent ? pCurrent->GetViewShell() : nullptr; @@ -2849,7 +2849,7 @@ bool SfxViewShell::IsCurrentLokViewReadOnly() return pCurrent && pCurrent->IsLokReadOnlyView(); } -SAL_RET_MAYBENULL SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) +SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) { if ( !i_rController.is() ) return nullptr; @@ -3009,7 +3009,7 @@ void SfxViewShell::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue // returns the first shell of spec. type viewing the specified doc. -SAL_RET_MAYBENULL SfxViewShell* SfxViewShell::GetFirst +SfxViewShell* SfxViewShell::GetFirst ( bool bOnlyVisible, const std::function< bool ( const SfxViewShell& ) >& isViewShell @@ -3038,7 +3038,7 @@ SAL_RET_MAYBENULL SfxViewShell* SfxViewShell::GetFirst } // returns the next shell of spec. type viewing the specified doc. -SAL_RET_MAYBENULL SfxViewShell* SfxViewShell::GetNext +SfxViewShell* SfxViewShell::GetNext ( const SfxViewShell& rPrev, boolbOnlyVisible,
core.git: sfx2/source
sfx2/source/doc/objstor.cxx | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) New commits: commit a2007364e77aebbbc45fa8fab2c58f95a821dd18 Author: Caolán McNamara AuthorDate: Thu May 16 14:37:52 2024 +0100 Commit: Caolán McNamara CommitDate: Thu May 16 17:36:55 2024 +0200 always restore existing interaction handler after save In an error case we end up removing any existing interaction handler. So in all cases leave with the same interaction handler that existed before the save attempt. See also: commit 3b294f6139028014e72379ebe8eda24a2bd32195 Date: Thu Jun 8 20:53:16 2023 +0100 restore, not clear, existing interaction handler after save where the same problem can be reproduced of every change is a full-document invalidation once someone else joins a document which has had a save-fail. Change-Id: I211183c551b1d64898cfe4aaf11dd9ef23f8ca15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167678 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index b3a7f8847e2e..cee4847022ed 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3046,17 +3046,21 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) if (pImpl->bPreserveVersions) pMediumTmp->TransferVersionList_Impl( *pRetrMedium ); +// Save the original interaction handler +Any aOriginalInteract; +if (const SfxUnoAnyItem *pItem = pRetrMedium->GetItemSet().GetItemIfSet(SID_INTERACTIONHANDLER, false)) +{ +aOriginalInteract = pItem->GetValue(); +// The original pRetrMedium and potential replacement pMediumTmp have the same interaction handler at this point +assert(pMediumTmp->GetItemSet().GetItemIfSet(SID_INTERACTIONHANDLER, false)->GetValue() == aOriginalInteract); +} + // an interaction handler here can acquire only in case of GUI Saving // and should be removed after the saving is done -Any aOriginalInteract; css::uno::Reference< XInteractionHandler > xInteract; const SfxUnoAnyItem* pxInteractionItem = SfxItemSet::GetItem(pArgs, SID_INTERACTIONHANDLER, false); if ( pxInteractionItem && ( pxInteractionItem->GetValue() >>= xInteract ) && xInteract.is() ) -{ -if (const SfxUnoAnyItem *pItem = pMediumTmp->GetItemSet().GetItemIfSet(SID_INTERACTIONHANDLER, false)) -aOriginalInteract = pItem->GetValue(); pMediumTmp->GetItemSet().Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, Any( xInteract ) ) ); -} const SfxBoolItem* pNoFileSync = pArgs->GetItem(SID_NO_FILE_SYNC, false); if (pNoFileSync && pNoFileSync->GetValue()) @@ -3096,7 +3100,10 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) // reconnect to object storage DoSaveCompleted(); -pRetrMedium->GetItemSet().ClearItem( SID_INTERACTIONHANDLER ); +if (aOriginalInteract.hasValue()) + pRetrMedium->GetItemSet().Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, aOriginalInteract)); +else +pRetrMedium->GetItemSet().ClearItem(SID_INTERACTIONHANDLER); pRetrMedium->GetItemSet().ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); delete pMediumTmp;
core.git: sfx2/source
sfx2/source/dialog/backingwindow.cxx | 30 +- 1 file changed, 9 insertions(+), 21 deletions(-) New commits: commit ad7e95531d791e9c16a38aeeeb17ecaea44d69e3 Author: Gabor Kelemen AuthorDate: Mon May 13 09:14:06 2024 +0200 Commit: Gabor Kelemen CommitDate: Wed May 15 08:58:04 2024 +0200 Drop unnecessary ConfigurationAccess Change-Id: I8ae3273ab048df66fa6a7006cb00af7a4958e337 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167569 Reviewed-by: Gabor Kelemen Tested-by: Jenkins diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 0cb8bc258023..e3761327ee60 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -62,8 +62,6 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::document; -constexpr OUStringLiteral SERVICENAME_CFGREADACCESS = u"com.sun.star.configuration.ConfigurationAccess"; - class BrandImage final : public weld::CustomWidgetController { private: @@ -535,26 +533,16 @@ IMPL_LINK(BackingWindow, ExtLinkClickHdl, weld::Button&, rButton,void) try { -uno::Sequence args(comphelper::InitAnyPropertySequence( -{ -{"nodepath", uno::Any(u"/org.openoffice.Office.Common/Help/StartCenter"_ustr)} -})); +OUString sURL(officecfg::Office::Common::Menus::ExtensionsURL::get() + +"?LOvers=" + utl::ConfigManager::getProductVersion() + +"=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47() ); -Reference xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); -Reference xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS, args), UNO_QUERY); -if (xNameAccess.is()) -{ -OUString sURL(officecfg::Office::Common::Menus::ExtensionsURL::get() + -"?LOvers=" + utl::ConfigManager::getProductVersion() + -"=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47() ); - -Reference const -xSystemShellExecute( -css::system::SystemShellExecute::create( -::comphelper::getProcessComponentContext())); -xSystemShellExecute->execute(sURL, OUString(), -css::system::SystemShellExecuteFlags::URIS_ONLY); -} +Reference const +xSystemShellExecute( +css::system::SystemShellExecute::create( +::comphelper::getProcessComponentContext())); +xSystemShellExecute->execute(sURL, OUString(), +css::system::SystemShellExecuteFlags::URIS_ONLY); } catch (const Exception&) {
core.git: sfx2/source
sfx2/source/bastyp/fltfnc.cxx |3 +++ sfx2/source/view/lokhelper.cxx |1 + 2 files changed, 4 insertions(+) New commits: commit 5e6d9c38a7ef4027734064b83ca328df258a575c Author: Caolán McNamara AuthorDate: Mon May 13 14:18:25 2024 +0100 Commit: Caolán McNamara CommitDate: Mon May 13 20:25:14 2024 +0200 WaE: C6011 Dereferencing NULL pointer warnings Change-Id: Ib7a0f2db7e076eb40f65df5b88d617c459611fbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167600 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 8234b10f95e5..3b0fbdcd9478 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -1047,7 +1047,10 @@ void SfxFilterContainer::ReadSingleFilter_Impl( void SfxFilterContainer::ReadFilters_Impl( bool bUpdate ) { if ( !pFilterArr ) +{ CreateFilterArr(); +assert(pFilterArr); +} bFirstRead = false; SfxFilterList_Impl& rList = *pFilterArr; diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index d94ef124b0b5..756fda428273 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -190,6 +190,7 @@ void SfxLokHelper::setView(int nId) return; const SfxViewShell* pViewShell = *itViewShell; +assert(pViewShell); DisableCallbacks dc; bool bIsCurrShell = (pViewShell == SfxViewShell::Current());
core.git: sfx2/source
sfx2/source/control/unoctitm.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit fd0a249ad1f4a55677e97bd6355e5316a863f9e6 Author: Hubert Figuière AuthorDate: Wed May 8 17:34:47 2024 -0400 Commit: Caolán McNamara CommitDate: Thu May 9 17:13:37 2024 +0200 lokit: Properly handle state update for .uno:ToggleSheetGrid This is a follow up on cool#8066 Signed-off-by: Hubert Figuière Change-Id: I7d6ce4c9dfe7c2e9a2dda110e587c8c825c4df2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167370 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice (cherry picked from commit 9bbe40cc2d39f89ffcae57875d4c7ef7688d83d7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167317 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 7d518f435d81..6fb25977796e 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -940,8 +940,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "SpacePara15" || aEvent.FeatureURL.Path == "SpacePara2" || aEvent.FeatureURL.Path == "DataFilterAutoFilter" || -aEvent.FeatureURL.Path == "CellProtection" || -aEvent.FeatureURL.Path == "ToggleSheetGrid") +aEvent.FeatureURL.Path == "CellProtection") { bool bTemp = false; aEvent.State >>= bTemp; @@ -1222,7 +1221,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra } } else if (aEvent.FeatureURL.Path == "ToggleMergeCells" || - aEvent.FeatureURL.Path == "SheetRightToLeft") + aEvent.FeatureURL.Path == "SheetRightToLeft" || + aEvent.FeatureURL.Path == "ToggleSheetGrid") { bool aBool;
core.git: sfx2/source
sfx2/source/dialog/backingwindow.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 2fdcdad742bc26be509dde53f061f96a9620fd0a Author: Balazs Varga AuthorDate: Fri May 3 11:10:57 2024 +0200 Commit: Samuel Mehrbrodt CommitDate: Mon May 6 21:56:58 2024 +0200 tdf#160961: hide open remote file button from startcenter if the .uno:OpenRemote command is not available (e.g disabled in a config file). We also hide the Open remote file (and other) buttons in the Menubar if they are settled to disable. Change-Id: Ieb45c63b5d6aaf81d0eb7fa8947a9e109bee86f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167040 Reviewed-by: Samuel Mehrbrodt Tested-by: Jenkins diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index efa18f452d51..b1eb7a31f7e9 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -307,7 +308,14 @@ void BackingWindow::initControls() mxExtensionsButton->connect_clicked(LINK(this, BackingWindow, ExtLinkClickHdl)); mxOpenButton->connect_clicked(LINK(this, BackingWindow, ClickHdl)); -mxRemoteButton->connect_clicked(LINK(this, BackingWindow, ClickHdl)); + +// Hide OpenRemote button on startpage if the OpenRemote uno command is not available +SvtCommandOptions aCmdOptions; +if (SvtCommandOptions().HasEntriesDisabled() && aCmdOptions.LookupDisabled("OpenRemote")) +mxRemoteButton->set_visible(false); +else +mxRemoteButton->connect_clicked(LINK(this, BackingWindow, ClickHdl)); + mxWriterAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl)); mxDrawAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl)); mxCalcAllButton->connect_clicked(LINK(this, BackingWindow, ClickHdl));
core.git: sfx2/source
sfx2/source/appl/workwin.cxx | 114 +-- 1 file changed, 57 insertions(+), 57 deletions(-) New commits: commit d19b79e4b4998eddd1baa1ab6a42c4f557889a60 Author: Noel Grandin AuthorDate: Thu May 2 13:18:08 2024 +0200 Commit: Noel Grandin CommitDate: Fri May 3 15:57:46 2024 +0200 replace createFromAscii with OUString literals in sfx2 Change-Id: Ifc60fc260149106f257bf10551f081ce7d8fd6ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167039 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 5414f69c34c3..48eaa6a8226e 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -63,66 +63,66 @@ namespace { struct ResIdToResName { ToolbarId eId; -const char* pName; +OUString pName; }; } -const ResIdToResName pToolBarResToName[] = -{ -{ ToolbarId::FullScreenToolbox, "fullscreenbar"}, -{ ToolbarId::EnvToolbox, "standardbar", }, -{ ToolbarId::SvxTbx_Form_Navigation, "formsnavigationbar" }, -{ ToolbarId::SvxTbx_Form_Filter, "formsfilterbar" }, -{ ToolbarId::SvxTbx_Text_Control_Attributes, "formtextobjectbar"}, -{ ToolbarId::SvxTbx_Controls, "formcontrols" }, -{ ToolbarId::SvxTbx_FormDesign, "formdesign" }, -{ ToolbarId::Math_Toolbox,"toolbar" }, //math -{ ToolbarId::Text_Toolbox_Sc, "textobjectbar"}, //calc -{ ToolbarId::Draw_Objectbar, "drawobjectbar"}, -{ ToolbarId::Graphic_Objectbar, "graphicobjectbar" }, -{ ToolbarId::Objectbar_Format,"formatobjectbar" }, -{ ToolbarId::Objectbar_Preview, "previewbar" }, -{ ToolbarId::Objectbar_Tools, "toolbar" }, //calc -{ ToolbarId::Bezier_Toolbox_Sd, "bezierobjectbar" }, //draw/impress -{ ToolbarId::Gluepoints_Toolbox, "gluepointsobjectbar" }, -{ ToolbarId::Draw_Graf_Toolbox, "graphicobjectbar" }, -{ ToolbarId::Draw_Obj_Toolbox,"drawingobjectbar" }, //impress -{ ToolbarId::Draw_Text_Toolbox_Sd,"textobjectbar"}, //impress -{ ToolbarId::Draw_Toolbox_Sd, "toolbar" }, //impress -{ ToolbarId::Draw_Options_Toolbox,"optionsbar" }, -{ ToolbarId::Draw_CommonTask_Toolbox, "commontaskbar"}, -{ ToolbarId::Graphic_Obj_Toolbox, "drawingobjectbar" }, //draw -{ ToolbarId::Outline_Toolbox, "outlinetoolbar" }, //impress -{ ToolbarId::Slide_Toolbox, "slideviewtoolbar" }, -{ ToolbarId::Slide_Obj_Toolbox, "slideviewobjectbar" }, -{ ToolbarId::Bezier_Toolbox_Sw, "bezierobjectbar" }, -{ ToolbarId::Draw_Toolbox_Sw, "drawingobjectbar" }, -{ ToolbarId::Draw_Text_Toolbox_Sw,"drawtextobjectbar"}, -{ ToolbarId::Frame_Toolbox, "frameobjectbar" }, -{ ToolbarId::Grafik_Toolbox, "graphicobjectbar" }, -{ ToolbarId::Num_Toolbox, "numobjectbar" }, -{ ToolbarId::Ole_Toolbox, "oleobjectbar" }, -{ ToolbarId::Table_Toolbox, "tableobjectbar" }, -{ ToolbarId::Text_Toolbox_Sw, "textobjectbar"}, -{ ToolbarId::PView_Toolbox, "previewobjectbar" }, //writer -{ ToolbarId::Webtools_Toolbox,"toolbar" }, //web -{ ToolbarId::Webtext_Toolbox, "textobjectbar"}, -{ ToolbarId::Tools_Toolbox, "toolbar" }, //writer -{ ToolbarId::Webframe_Toolbox,"frameobjectbar" }, //web -{ ToolbarId::Webgraphic_Toolbox, "graphicobjectbar" }, -{ ToolbarId::Webole_Toolbox, "oleobjectbar" }, -{ ToolbarId::Basicide_Objectbar, "macrobar" }, -{ ToolbarId::Svx_Fontwork_Bar,"fontworkobjectbar"}, //global -{ ToolbarId::Svx_Extrusion_Bar, "extrusionobjectbar" }, -{ ToolbarId::FormLayer_Toolbox, "formsobjectbar" }, -{ ToolbarId::Module_Toolbox, "viewerbar"}, //writer (plugin) -{ ToolbarId::Objectbar_App, "viewerbar"}, //calc (plugin) -{ ToolbarId::Draw_Viewer_Toolbox, "viewerbar"}, //impress(plugin) -{ ToolbarId::Draw_Media_Toolbox, "mediaobjectbar" }, //draw/impress -{ ToolbarId::Media_Objectbar, "mediaobjectbar" }, //calc -{ ToolbarId::Media_Toolbox, "mediaobjectbar" }, //writer -{ ToolbarId::None, "" } +constexpr ResIdToResName pToolBarResToName[] = +{ +{
core.git: sfx2/source
sfx2/source/doc/syspathw32.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 62ee743d3c39e45d7fc6e0bdfa51a80e51af0c03 Author: Noel Grandin AuthorDate: Tue Apr 30 13:11:26 2024 +0200 Commit: Noel Grandin CommitDate: Tue Apr 30 16:00:25 2024 +0200 fix non-PCH windows build after commit a7f8882e4975e4194732506e4ffb9f7af6eb9c72 Author: Noel Grandin Date: Mon Apr 29 14:31:15 2024 +0200 convert HeapAlloc to make_unique Change-Id: Idb2e67285018eeb3373ba11c464df5a00b54a87b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166925 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 38243e2ce7ac..9aa02b51b64e 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef _WIN32
core.git: sfx2/source
sfx2/source/doc/graphhelp.cxx | 41 + 1 file changed, 21 insertions(+), 20 deletions(-) New commits: commit e5c988821db31f285cdd207e2a2ac849c0f1c099 Author: Caolán McNamara AuthorDate: Fri Apr 26 11:11:44 2024 +0100 Commit: Caolán McNamara CommitDate: Mon Apr 29 09:30:48 2024 +0200 WaE: C6011 Derefencing NULL pointer 'pMF' Change-Id: I76e85e8671623f7cdf994dce779c3944b8761acf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166731 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 7cfdf76fe60f..9d7600ae2da7 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -128,28 +128,29 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co if ( hMemory ) { -METAFILEPICT* pMF = static_cast(GlobalLock( hMemory )); - -pMF->hMF = hMeta; -pMF->mm = MM_ANISOTROPIC; - -MapMode aWinMode( MapUnit::Map100thMM ); - -if ( aWinMode == pGDIMeta->GetPrefMapMode() ) +if (METAFILEPICT* pMF = static_cast(GlobalLock(hMemory))) { -pMF->xExt = aMetaSize.Width(); -pMF->yExt = aMetaSize.Height(); +pMF->hMF = hMeta; +pMF->mm = MM_ANISOTROPIC; + +MapMode aWinMode( MapUnit::Map100thMM ); + +if ( aWinMode == pGDIMeta->GetPrefMapMode() ) +{ +pMF->xExt = aMetaSize.Width(); +pMF->yExt = aMetaSize.Height(); +} +else +{ +Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ), + pGDIMeta->GetPrefMapMode(), + aWinMode ); +pMF->xExt = aWinSize.Width(); +pMF->yExt = aWinSize.Height(); +} + +GlobalUnlock(hMemory); } -else -{ -Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ), - pGDIMeta->GetPrefMapMode(), - aWinMode ); -pMF->xExt = aWinSize.Width(); -pMF->yExt = aWinSize.Height(); -} - -GlobalUnlock( hMemory ); pResult = static_cast(hMemory); } else
core.git: sfx2/source
sfx2/source/appl/shutdowniconw32.cxx | 15 --- sfx2/source/doc/syspathw32.cxx | 21 +++-- 2 files changed, 19 insertions(+), 17 deletions(-) New commits: commit a70a8f55973ec3e71f65335be75699f1d2a73d62 Author: Caolán McNamara AuthorDate: Fri Apr 26 11:42:35 2024 +0100 Commit: Caolán McNamara CommitDate: Mon Apr 29 09:30:26 2024 +0200 Unchecked HeapAlloc Change-Id: Icd49d0b5f996d57d8e9518cb08fd3c3fc54fa779 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166732 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 2fb7cd2b7875..a237aac13547 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -681,15 +681,16 @@ static OUString SHGetSpecialFolder( int nFolderID ) if( hHdl == NOERROR ) { -WCHAR *lpFolderA; -lpFolderA = ALLOC( WCHAR, 16000 ); - -SHGetPathFromIDListW( pidl, lpFolderA ); -aFolder = o3tl::toU( lpFolderA ); +if (WCHAR *lpFolderA = ALLOC(WCHAR, 16000)) +{ +SHGetPathFromIDListW(pidl, lpFolderA); +aFolder = o3tl::toU(lpFolderA); -FREE( lpFolderA ); -SHFree_( pidl ); +FREE(lpFolderA); +SHFree_(pidl); +} } + return aFolder; } diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index f60f459829d7..dce19e3625c0 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -37,17 +37,18 @@ static bool SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) if( hHdl == NOERROR ) { -WCHAR *lpFolder = static_cast< WCHAR* >( HeapAlloc( GetProcessHeap(), 0, 16000 )); - -SHGetPathFromIDListW( pidl, lpFolder ); -wcsncpy( pszFolder, lpFolder, nSize ); - -HeapFree( GetProcessHeap(), 0, lpFolder ); -IMalloc *pMalloc; -if( NOERROR == SHGetMalloc() ) +if (WCHAR *lpFolder = static_cast(HeapAlloc(GetProcessHeap(), 0, 16000))) { -pMalloc->Free( pidl ); -pMalloc->Release(); +SHGetPathFromIDListW( pidl, lpFolder ); +wcsncpy( pszFolder, lpFolder, nSize ); + +HeapFree( GetProcessHeap(), 0, lpFolder ); +IMalloc *pMalloc; +if( NOERROR == SHGetMalloc() ) +{ +pMalloc->Free( pidl ); +pMalloc->Release(); +} } } return true;
core.git: sfx2/source
sfx2/source/control/dispatch.cxx |5 +++-- sfx2/source/dialog/basedlgs.cxx | 13 + sfx2/source/dialog/tabdlg.cxx| 12 +--- sfx2/source/doc/guisaveas.cxx| 10 ++ sfx2/source/view/viewsh.cxx |6 +++--- 5 files changed, 30 insertions(+), 16 deletions(-) New commits: commit 064b335cf721db96fe556c78b15d0abe0edec70d Author: Caolán McNamara AuthorDate: Fri Apr 26 10:23:55 2024 +0100 Commit: Caolán McNamara CommitDate: Mon Apr 29 09:28:32 2024 +0200 call SfxViewShell::Current() just once Change-Id: Iea3777cfb86c64c01cf1029ff3ba6a834d8c3619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166706 Reviewed-by: Caolán McNamara Tested-by: Jenkins diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 300f0179b064..c761cb17830e 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1125,10 +1125,11 @@ void SfxDispatcher::Update_Impl( bool bForce ) if ( xLayoutManager.is() ) xLayoutManager->unlock(); -if ( SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() ) +const SfxViewShell* pViewShell = SfxViewShell::Current(); +if (pViewShell && pViewShell->GetDispatcher()) { SfxPoolItemHolder aItem; -SfxViewShell::Current()->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, aItem); +pViewShell->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, aItem); } } diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 29f0cf6532cb..fb7c95e3cc32 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -200,12 +200,17 @@ void SfxModelessDialogController::Close() SfxDialogController::Close(); } +static bool isLOKMobilePhone() +{ +if (!comphelper::LibreOfficeKit::isActive()) +return false; +const SfxViewShell* pCurrentShell = SfxViewShell::Current(); +return pCurrentShell && pCurrentShell->isLOKMobilePhone(); +} + SfxDialogController::SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OUString& rDialogId) -: GenericDialogController(pParent, rUIFile, rDialogId, -comphelper::LibreOfficeKit::isActive() -&& SfxViewShell::Current() -&& SfxViewShell::Current()->isLOKMobilePhone()) +: GenericDialogController(pParent, rUIFile, rDialogId, isLOKMobilePhone()) { m_xDialog->SetInstallLOKNotifierHdl(LINK(this, SfxDialogController, InstallLOKNotifierHdl)); m_xDialog->connect_container_focus_changed(LINK(this, SfxDialogController, FocusChangeHdl)); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 01d6c0e440cf..d38be362dbea 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -137,10 +137,16 @@ css::uno::Reference< css::frame::XFrame > SfxTabPage::GetFrame() const return css::uno::Reference< css::frame::XFrame >(); } +static bool isLOKMobilePhone() +{ +if (!comphelper::LibreOfficeKit::isActive()) +return false; +const SfxViewShell* pCurrentShell = SfxViewShell::Current(); +return pCurrentShell && pCurrentShell->isLOKMobilePhone(); +} + SfxTabPage::SfxTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet *rAttrSet) -: BuilderPage(pPage, pController, rUIXMLDescription, rID, -comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() -&& SfxViewShell::Current()->isLOKMobilePhone()) +: BuilderPage(pPage, pController, rUIXMLDescription, rID, isLOKMobilePhone()) , mpSet(rAttrSet) , mbHasExchangeSupport(false) , mpImpl(new TabPageImpl) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 974aef7384d9..af5057b93beb 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -674,10 +674,12 @@ void SfxStoringHelper::CallFinishGUIStoreModel() IMPL_LINK( ModelData_Impl, OptionsDialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, pEvt, void ) { +SfxViewShell* pNotifier = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr; + if (pEvt->DialogResult == RET_OK && m_xFilterProperties) { -if ( comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() ) -SfxViewShell::Current()->libreOfficeKitViewCallback( LOK_CALLBACK_EXPORT_FILE, "PENDING"_ostr ); +if (pNotifier) +pNotifier->libreOfficeKitViewCallback( LOK_CALLBACK_EXPORT_FILE, "PENDING"_ostr ); const uno::Sequence< beans::PropertyValue > aPropsFromDialog = m_xFilterProperties->getPropertyValues(); for ( const auto& rProp : aPropsFromDialog ) @@ -685,9 +687,9 @@ IMPL_LINK( ModelData_Impl,
core.git: sfx2/source
sfx2/source/appl/appopen.cxx |5 +++-- sfx2/source/doc/objserv.cxx|6 +- sfx2/source/notebookbar/SfxNotebookBar.cxx | 14 +- 3 files changed, 17 insertions(+), 8 deletions(-) New commits: commit 95d3e0d478686c7fa84f0bb8c466a1082333a47b Author: Caolán McNamara AuthorDate: Fri Apr 26 10:20:56 2024 +0100 Commit: Caolán McNamara CommitDate: Mon Apr 29 09:27:38 2024 +0200 SfxViewFrame::Current() dereferenced without null check found with msvc -analyze and _Ret_maybenull_ Change-Id: Ia377822e93448dc61acd1482d34167c35a46836b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166705 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 03ad8039be7b..7ea6fca57d8d 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1044,9 +1044,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if( aFileName.startsWith("#") ) // Mark without URL { SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : nullptr; -if ( !pView ) +if (!pView) pView = SfxViewFrame::Current(); -pView->GetViewShell()->JumpToMark( aFileName.copy(1) ); +if (pView) +pView->GetViewShell()->JumpToMark( aFileName.copy(1) ); rReq.SetReturnValue( SfxViewFrameItem( pView ) ); return; } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 9e0b2697cd74..d721458beb3b 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -452,6 +452,10 @@ static void sendErrorToLOK(ErrCodeMsg error) if (error.GetCode().GetClass() == ErrCodeClass::NONE) return; +SfxViewShell* pNotifier = SfxViewShell::Current(); +if (!pNotifier) +return; + boost::property_tree::ptree aTree; aTree.put("code", error); aTree.put("kind", ""); @@ -464,7 +468,7 @@ static void sendErrorToLOK(ErrCodeMsg error) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); -SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, OString(aStream.str())); +pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, OString(aStream.str())); } namespace diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 41ae9c3c2666..42f11191d057 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -480,6 +480,9 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, if (bIsLOK) { +if (!pViewShell) +return false; + // Notebookbar was loaded too early what caused: // * in LOK: Paste Special feature was incorrectly initialized // Skip first request so Notebookbar will be initialized after document was loaded @@ -672,11 +675,12 @@ void SfxNotebookBar::ToggleMenubar() void SfxNotebookBar::ReloadNotebookBar(std::u16string_view sUIPath) { -if (SfxNotebookBar::IsActive()) -{ -SfxViewShell* pViewShell = SfxViewShell::Current(); - sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(), sUIPath, true); -} +if (!SfxNotebookBar::IsActive()) +return; +SfxViewShell* pViewShell = SfxViewShell::Current(); +if (!pViewShell) +return; + sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(), sUIPath, true); } IMPL_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, pViewShell, void)
core.git: sfx2/source
sfx2/source/doc/objstor.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 45d2d90d2354a6a32297cde52c0041915499b19b Author: Julien Nabet AuthorDate: Sun Apr 28 13:16:59 2024 +0200 Commit: Julien Nabet CommitDate: Sun Apr 28 20:10:30 2024 +0200 tdf#160827: fix crash when retrieving _MarkAsFinal value (docx) (take 2) Change-Id: I3f2ad56a205877be54b0dbfe361b76db3436f5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166798 Reviewed-by: Noel Grandin Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 720e939e3885..e7538813cfdd 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2741,7 +2741,11 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, uno::Reference xPropertySetInfo = xPropertySet->getPropertySetInfo(); if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName("_MarkAsFinal")) { -if (xPropertySet->getPropertyValue("_MarkAsFinal").get()) +Any anyMarkAsFinal = xPropertySet->getPropertyValue("_MarkAsFinal"); +if ( + ( (anyMarkAsFinal.getValueType() == cppu::UnoType::get()) && (anyMarkAsFinal.get()) ) || + ( (anyMarkAsFinal.getValueType() == cppu::UnoType::get()) && (anyMarkAsFinal.get() == "true") ) +) { uno::Reference< lang::XMultiServiceFactory > xFactory(GetModel(), uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
core.git: sfx2/source
sfx2/source/doc/objstor.cxx |8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) New commits: commit 5158104b9294ab85ab7a675b5b627469e303c345 Author: Julien Nabet AuthorDate: Sun Apr 28 13:09:34 2024 +0200 Commit: Julien Nabet CommitDate: Sun Apr 28 13:11:21 2024 +0200 Revert "tdf#160827: fix crash when retrieving _MarkAsFinal value (docx)" As Noel advised in https://gerrit.libreoffice.org/c/core/+/166724, it's better to test type this way: getValueType() == cppu::UnoType::get() This reverts commit f49d74edf76097d014ed891d0025cb2e9b197c5a. Change-Id: Ic148b27761141d1020b63eeba8044fd545bab2d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166797 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 441641d1c65c..720e939e3885 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2741,13 +2741,7 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, uno::Reference xPropertySetInfo = xPropertySet->getPropertySetInfo(); if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName("_MarkAsFinal")) { -Any anyMarkAsFinal = xPropertySet->getPropertyValue("_MarkAsFinal"); -const OUString strValueTypeName = anyMarkAsFinal.getValueTypeName(); - -if ( - ( (strValueTypeName == "boolean") && (anyMarkAsFinal.get()) ) || - ( (strValueTypeName == "string") && (anyMarkAsFinal.get() == "true") ) -) +if (xPropertySet->getPropertyValue("_MarkAsFinal").get()) { uno::Reference< lang::XMultiServiceFactory > xFactory(GetModel(), uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
core.git: sfx2/source
sfx2/source/doc/objstor.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit f49d74edf76097d014ed891d0025cb2e9b197c5a Author: Julien Nabet AuthorDate: Fri Apr 26 23:20:31 2024 +0200 Commit: Julien Nabet CommitDate: Sun Apr 28 11:39:38 2024 +0200 tdf#160827: fix crash when retrieving _MarkAsFinal value (docx) xPropertySet->getPropertyValue("_MarkAsFinal") can retrieve an Any containing a boolean or a string Change-Id: I1c8bafc12cdaf7fb98d3500507ba83b3e90f69cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166763 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 720e939e3885..441641d1c65c 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2741,7 +2741,13 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, uno::Reference xPropertySetInfo = xPropertySet->getPropertySetInfo(); if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName("_MarkAsFinal")) { -if (xPropertySet->getPropertyValue("_MarkAsFinal").get()) +Any anyMarkAsFinal = xPropertySet->getPropertyValue("_MarkAsFinal"); +const OUString strValueTypeName = anyMarkAsFinal.getValueTypeName(); + +if ( + ( (strValueTypeName == "boolean") && (anyMarkAsFinal.get()) ) || + ( (strValueTypeName == "string") && (anyMarkAsFinal.get() == "true") ) +) { uno::Reference< lang::XMultiServiceFactory > xFactory(GetModel(), uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
core.git: sfx2/source
sfx2/source/control/unoctitm.cxx | 35 +-- 1 file changed, 13 insertions(+), 22 deletions(-) New commits: commit 875d99c6e5286b9d56bba32a3abbc37068df61c1 Author: Miklos Vajna AuthorDate: Mon Apr 15 16:47:59 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Apr 16 11:25:51 2024 +0200 sfx2 lok: simplify error handling in InterceptLOKStateChangeEvent() The whole function is pointless without a viewshell, move the check & short-circuit to the top of the function, and drop all the duplicate checks. Also drop two calls to SfxViewShell::Current(): getting it from the view frame is better than getting some global state. Change-Id: I4aa7aeb7c89841bbced760ce2e43d2312bc97f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166139 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 9cbd29034a46..0691a6bad444 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -893,7 +893,8 @@ void SfxDispatchController_Impl::StateChangedAtToolBoxControl( sal_uInt16 nSID, static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState) { -if (!comphelper::LibreOfficeKit::isActive()) +const SfxViewShell* pViewShell = pViewFrame->GetViewShell(); +if (!comphelper::LibreOfficeKit::isActive() || !pViewShell) return; OUStringBuffer aBuffer(aEvent.FeatureURL.Complete + "="); @@ -1121,17 +1122,13 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra else if (aEvent.FeatureURL.Path == "ParaLeftToRight" || aEvent.FeatureURL.Path == "ParaRightToLeft") { -const SfxViewShell* pViewShell = SfxViewShell::Current(); -if (pViewShell) -{ -tools::JsonWriter aTree; -bool bTemp = false; -aEvent.State >>= bTemp; -aTree.put("commandName", aEvent.FeatureURL.Complete); -aTree.put("disabled", !aEvent.IsEnabled); -aTree.put("state", bTemp ? "true" : "false"); -pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aTree.finishAndGetAsOString()); -} +tools::JsonWriter aTree; +bool bTemp = false; +aEvent.State >>= bTemp; +aTree.put("commandName", aEvent.FeatureURL.Complete); +aTree.put("disabled", !aEvent.IsEnabled); +aTree.put("state", bTemp ? "true" : "false"); +pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aTree.finishAndGetAsOString()); return; } else if (aEvent.FeatureURL.Path == "AssignLayout" || @@ -1152,8 +1149,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "TransformWidth" || aEvent.FeatureURL.Path == "TransformHeight") { -const SfxViewShell* pViewShell = SfxViewShell::Current(); -if (aEvent.IsEnabled && pViewShell && pViewShell->isLOKMobilePhone()) +if (aEvent.IsEnabled && pViewShell->isLOKMobilePhone()) { boost::property_tree::ptree aTree; boost::property_tree::ptree aState; @@ -1198,11 +1194,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aTree.put("state", aString); std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); -const SfxViewShell* pShell = pViewFrame->GetViewShell(); -if (pShell) -{ -pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, OString(aStream.str())); -} +pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, OString(aStream.str())); return; } else if (aEvent.FeatureURL.Path == "StateTableCell") @@ -1316,14 +1308,13 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra else { // Try to send JSON state version -SfxLokHelper::sendUnoStatus(pViewFrame->GetViewShell(), pState); +SfxLokHelper::sendUnoStatus(pViewShell, pState); return; } OUString payload = aBuffer.makeStringAndClear(); -if (const SfxViewShell* pViewShell = pViewFrame->GetViewShell()) -pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8()); +pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
core.git: sfx2/source
sfx2/source/appl/appmisc.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 707f59019a5edafb4278a5591f8f6578041f1a3c Author: Mike Kaganski AuthorDate: Sat Apr 13 23:38:03 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 08:58:56 2024 +0200 Use more o3tl::convert Change-Id: I2a4f109b8c1031d0330f249b7666ae65f9fae7ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166062 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 01b278b16506..cb793022a62f 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -170,7 +170,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx , int nWid // cancel out rasterize's mm2pixel conversion // see fFactor100th_mmToInch in // drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx -const double fFakeDPI=2.54 * 1000.0; +constexpr double fFakeDPI = o3tl::convert(1.0, o3tl::Length::in, o3tl::Length::mm100); geometry::RealRectangle2D aRealRect( 0, 0,
core.git: sfx2/source
sfx2/source/control/unoctitm.cxx | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) New commits: commit 1e605412df2ca9aab895b34f256ccd5a8dfdc83d Author: Miklos Vajna AuthorDate: Fri Apr 12 08:52:43 2024 +0200 Commit: Caolán McNamara CommitDate: Sat Apr 13 16:52:50 2024 +0200 sfx2: fix crash in InterceptLOKStateChangeEvent() Notice how e.g. the TransformPosX case already performed the same null pointer check. Crashreport backtrace: > program/libmergedlo.so > InterceptLOKStateChangeEvent > sfx2/source/control/unoctitm.cxx:1143 > program/libmergedlo.so > SfxStateCache::SetState_Impl(SfxItemState, SfxPoolItem const*, bool) > sfx2/source/control/statcach.cxx:432 > program/libmergedlo.so > SfxBindings::Update_Impl(SfxStateCache&) > /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/stl_vector.h:919 (discriminator 2) > program/libmergedlo.so > SfxBindings::NextJob_Impl(Timer const*) > /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:173 Change-Id: I141d4f9ec50d0ce7a0eeaba69752c31390a1f9ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166027 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166046 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 333879c24d0f..f49dc2d7336f 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1118,13 +1118,17 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra else if (aEvent.FeatureURL.Path == "ParaLeftToRight" || aEvent.FeatureURL.Path == "ParaRightToLeft") { -tools::JsonWriter aTree; -bool bTemp = false; -aEvent.State >>= bTemp; -aTree.put("commandName", aEvent.FeatureURL.Complete); -aTree.put("disabled", !aEvent.IsEnabled); -aTree.put("state", bTemp ? "true" : "false"); - SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aTree.finishAndGetAsOString()); +const SfxViewShell* pViewShell = SfxViewShell::Current(); +if (pViewShell) +{ +tools::JsonWriter aTree; +bool bTemp = false; +aEvent.State >>= bTemp; +aTree.put("commandName", aEvent.FeatureURL.Complete); +aTree.put("disabled", !aEvent.IsEnabled); +aTree.put("state", bTemp ? "true" : "false"); +pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aTree.finishAndGetAsOString()); +} return; } else if (aEvent.FeatureURL.Path == "AssignLayout" ||
core.git: sfx2/source
sfx2/source/control/request.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit b4626d809b50f1d5c1aa8a9644dd3913f5b15503 Author: Armin Le Grand (allotropia) AuthorDate: Mon Apr 8 11:03:00 2024 +0200 Commit: Armin Le Grand CommitDate: Mon Apr 8 17:16:49 2024 +0200 tdf#159719 reset SfxPoolItemHolder when Pool changes Change-Id: Ic2724c6e03acaa8cfc74dc2aadfac6b13d8561c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165883 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas Reviewed-by: Armin Le Grand diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 9406ce8b9fd3..e58475c325f1 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -109,7 +109,12 @@ void SfxRequest_Impl::SetPool( SfxItemPool *pNewPool ) { if ( pPool ) EndListening( pPool->BC() ); + +// tdf#159719 reset SfxPoolItemHolder +aRetVal = SfxPoolItemHolder(); + pPool = pNewPool; + if ( pNewPool ) StartListening( pNewPool->BC() ); }
core.git: sfx2/source
sfx2/source/dialog/backingwindow.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 30c6e51fc9cb0fa864e1755271343d847fcced25 Author: Moritz Duge AuthorDate: Wed Apr 3 21:45:09 2024 +0200 Commit: Thorsten Behrens CommitDate: Thu Apr 4 23:23:56 2024 +0200 Remove duplicate code. Change-Id: Ia32b0525ecdf5944c2ebd3045dc3d536941ed394 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165763 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 9e30572d12d3..efa18f452d51 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -354,7 +354,6 @@ void BackingWindow::ApplyStyleSettings() // setup larger fonts setLargerFont(mxOpenButton, aButtonFont); -setLargerFont(mxOpenButton, aButtonFont); setLargerFont(mxRemoteButton, aButtonFont); setLargerFont(mxRecentButton, aButtonFont); setLargerFont(mxTemplateButton, aButtonFont);
core.git: sfx2/source
sfx2/source/dialog/splitwin.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 219dd67d6ad96e1c05e92e36583391946143dba6 Author: Stephan Bergmann AuthorDate: Thu Apr 4 09:53:34 2024 +0200 Commit: Stephan Bergmann CommitDate: Thu Apr 4 14:14:26 2024 +0200 -Werror=maybe-uninitialized ...as reported at least with some recent GCC 14 trunk. Lets assume that those calls to GetWindowPos are never meant to fail. (If it turns out that they can fail after all, the code would presumably need some modifications to mitigate the uninitialized reads from nL/nP.) Change-Id: I7695d3e54de2bf5d1e91b32cfdc84e994ccdd57d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165783 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 210a9dbeaaff..b9597eacfc79 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -456,7 +457,8 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize if ( bNewLine && !pFoundDock ) { // Not known until now in which real line it is located -GetWindowPos( rDock.pWin, nL, nPos ); +[[maybe_unused]] auto const ok = GetWindowPos( rDock.pWin, nL, nPos ); +assert(ok); nLine = static_cast(nL); } @@ -544,7 +546,8 @@ void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize, { sal_uInt16 nL, nP; -GetWindowPos( pDockWin, nL, nP ); +[[maybe_unused]] auto const ok = GetWindowPos( pDockWin, nL, nP ); +assert(ok); if ( nLine > nL && GetItemCount( GetItemId( nL ) ) == 1 ) {
core.git: sfx2/source
sfx2/source/control/dispatch.cxx |3 + sfx2/source/control/unoctitm.cxx | 83 --- 2 files changed, 3 insertions(+), 83 deletions(-) New commits: commit fb471194d04607eb7706f8650f0c92c6e5b8 Author: Gökay Şatır AuthorDate: Mon Mar 25 16:49:08 2024 +0300 Commit: Caolán McNamara CommitDate: Wed Apr 3 13:07:37 2024 +0200 Use sdi properties for checking uno commands'a availability. Signed-off-by: Gökay Şatır Change-Id: Ie70851756d1a4272876b07fefb876d7e6f8d4d81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165287 Reviewed-by: Michael Meeks Tested-by: Jenkins CollaboraOffice (cherry picked from commit 68422af88576a799b22e472c303ed924c360784b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165734 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index ef59094293b9..6ae4d71a6db9 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1590,6 +1590,9 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer) bool bReadOnly = ( SfxSlotFilterState::ENABLED_READONLY != nSlotEnableMode && xImp->bReadOnly ); +if (!bReadOnly && comphelper::LibreOfficeKit::isActive()) +bReadOnly = xImp->pFrame && xImp->pFrame->GetViewShell() && xImp->pFrame->GetViewShell()->IsLokReadOnlyView(); + // search through all the shells of the chained dispatchers // from top to bottom sal_uInt16 nFirstShell = 0; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 23a370a4240f..333879c24d0f 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -520,83 +520,6 @@ void collectUIInformation(const util::URL& rURL, const css::uno::Sequence< css:: } -// Checks if LOK is active and uno command is allowed for the current LOK view. -static bool isCommandAllowedForViewType(const OUString& command) -{ -if (SfxViewShell::IsCurrentLokViewReadOnly()) -{ -// This is a sublist of "sUnoCommands". -constexpr OUString allowedCommandList[] = { -u"Copy"_ustr, -u"SelectAll"_ustr, -u"SelectColumn"_ustr, -u"SelectRow"_ustr, -u"EntireRow"_ustr, -u"EntireColumn"_ustr, -u"EntireCell"_ustr, -u"RowColSelCount"_ustr, -u"SpellOnline"_ustr, -u"StatePageNumber"_ustr, -u"StateWordCount"_ustr, -u"StateTableCell"_ustr, -u"SelectionMode"_ustr, -u"PageStatus"_ustr, -u"LayoutStatus"_ustr, -u"ToolbarMode"_ustr, -u"ChangeTheme"_ustr, -u"CopyHyperlinkLocation"_ustr, -u"ExportDirectToPDF"_ustr, -u"ExportToPDF"_ustr, -u"ExportToEPUB"_ustr, -u"CharRightSel"_ustr, -u"CharLeftSel"_ustr, -u"WordRightSel"_ustr, -u"WordLeftSel"_ustr, -u"EndOfParaSel"_ustr, -u"StartOfParaSel"_ustr, -u"GoRight"_ustr, -u"GoLeft"_ustr, -u"GoToNextWord"_ustr, -u"GoToPrevWord"_ustr, -u"GoToNextPara"_ustr, -u"GoToStartOfPara"_ustr, -u"GoUp"_ustr, -u"GoDown"_ustr, -u"GoRightSel"_ustr, -u"GoLeftSel"_ustr, -u"GoUpSel"_ustr, -u"GoDownSel"_ustr, -u"GoLeftToStartOfData"_ustr, -u"GoRightToEndOfData"_ustr, -u"GoToStart"_ustr, -u"GoToEndOfData"_ustr, -u"GoUpToStartOfData"_ustr, -u"GoDownToEndOfData"_ustr, -u"GoLeftToStartOfDataSel"_ustr, -u"GoRightToEndOfDataSel"_ustr, -u"GoUpToStartOfDataSel"_ustr, -u"GoDownToEndOfDataSel"_ustr -}; - -bool allowed = std::find(std::begin(allowedCommandList), std::end(allowedCommandList), command) != std::end(allowedCommandList); - -if (!allowed && SfxViewShell::Current() && SfxViewShell::Current()->IsAllowChangeComments()) -{ -constexpr OUString allowedCommentCommandList[] = { -u"InsertAnnotation"_ustr, -u"DeleteComment"_ustr, -u"DeleteAnnotation"_ustr, -u"EditAnnotation"_ustr -}; -allowed = std::find(std::begin(allowedCommentCommandList), std::end(allowedCommentCommandList), command) != std::end(allowedCommentCommandList); -} - -return allowed; -} - -return true; -} - void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs, const css::uno::Reference< css::frame::XDispatchResultListener >& rListener ) @@ -623,12 +546,6 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL&
core.git: sfx2/source
sfx2/source/control/unoctitm.cxx | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) New commits: commit 5266c1b215263029fe9b35e5365df65d116edf64 Author: Gökay Şatır AuthorDate: Fri Mar 22 13:34:38 2024 +0300 Commit: Caolán McNamara CommitDate: Wed Apr 3 12:48:41 2024 +0200 Allow more uno commands in readonly view mode. So user can use keyboard for selection. Signed-off-by: Gökay Şatır Change-Id: Ic7812c88110da9fbefe86d145f921e48360b4f34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165157 Reviewed-by: Michael Meeks Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165733 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index d81b191d8623..23a370a4240f 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -547,7 +547,35 @@ static bool isCommandAllowedForViewType(const OUString& command) u"CopyHyperlinkLocation"_ustr, u"ExportDirectToPDF"_ustr, u"ExportToPDF"_ustr, -u"ExportToEPUB"_ustr +u"ExportToEPUB"_ustr, +u"CharRightSel"_ustr, +u"CharLeftSel"_ustr, +u"WordRightSel"_ustr, +u"WordLeftSel"_ustr, +u"EndOfParaSel"_ustr, +u"StartOfParaSel"_ustr, +u"GoRight"_ustr, +u"GoLeft"_ustr, +u"GoToNextWord"_ustr, +u"GoToPrevWord"_ustr, +u"GoToNextPara"_ustr, +u"GoToStartOfPara"_ustr, +u"GoUp"_ustr, +u"GoDown"_ustr, +u"GoRightSel"_ustr, +u"GoLeftSel"_ustr, +u"GoUpSel"_ustr, +u"GoDownSel"_ustr, +u"GoLeftToStartOfData"_ustr, +u"GoRightToEndOfData"_ustr, +u"GoToStart"_ustr, +u"GoToEndOfData"_ustr, +u"GoUpToStartOfData"_ustr, +u"GoDownToEndOfData"_ustr, +u"GoLeftToStartOfDataSel"_ustr, +u"GoRightToEndOfDataSel"_ustr, +u"GoUpToStartOfDataSel"_ustr, +u"GoDownToEndOfDataSel"_ustr }; bool allowed = std::find(std::begin(allowedCommandList), std::end(allowedCommandList), command) != std::end(allowedCommandList);
core.git: sfx2/source
sfx2/source/appl/appbas.cxx|1 - sfx2/source/appl/appbaslib.cxx |1 - sfx2/source/appl/appcfg.cxx|2 -- sfx2/source/appl/appmisc.cxx |1 - sfx2/source/appl/newhelp.cxx |1 - sfx2/source/appl/opengrf.cxx |1 - sfx2/source/appl/sfxhelp.cxx |2 -- sfx2/source/appl/sfxpicklist.cxx |2 -- sfx2/source/bastyp/helper.cxx |1 - sfx2/source/control/recentdocsview.cxx |2 -- sfx2/source/control/thumbnailview.cxx |1 - sfx2/source/dialog/mailmodel.cxx |1 - sfx2/source/doc/objmisc.cxx|1 - sfx2/source/doc/objserv.cxx|1 - sfx2/source/doc/objstor.cxx|1 - sfx2/source/doc/templatedlg.cxx|1 - sfx2/source/inet/inettbc.cxx |1 - sfx2/source/sidebar/ControllerItem.cxx |1 - sfx2/source/sidebar/Deck.cxx |1 - sfx2/source/toolbox/tbxitem.cxx|3 --- sfx2/source/view/frame2.cxx|2 -- sfx2/source/view/viewfrm2.cxx |2 -- sfx2/source/view/viewsh.cxx|1 - 23 files changed, 31 deletions(-) New commits: commit b77ad21d445783d77697470796be5c43f9fc5cd3 Author: Gabor Kelemen AuthorDate: Fri Mar 29 14:07:48 2024 +0100 Commit: Gabor Kelemen CommitDate: Tue Apr 2 08:32:20 2024 +0200 tdf#146619 Drop unused 'using namespace' in: sfx2/ Change-Id: I3748612644c9c4eb88d7fb6e2d512954de9c1002 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165538 Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index d26f9577ee27..8929ccf908cf 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -48,7 +48,6 @@ #include using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; using namespace ::com::sun::star::script; using ::basic::BasicManagerRepository; diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index bfeafa1b1b60..2d32e59ee9bc 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -28,7 +28,6 @@ #include using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::script; using namespace ::com::sun::star::embed; diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index f18b93792236..074ad93b6f74 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -52,8 +52,6 @@ #include "shutdownicon.hxx" using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::beans; namespace { diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 948a1de40fd0..01b278b16506 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -52,7 +52,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; SFX_IMPL_INTERFACE(SfxApplication,SfxShell) diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 7e51602371c1..925ed3a808ad 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -104,7 +104,6 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::view; -using namespace ::com::sun::star::ui; using namespace ::comphelper; diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index 3c94ca7ffbc5..16e0731f310b 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -44,7 +44,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; -using namespace ::cppu; static TranslateId SvxOpenGrfErr2ResId( ErrCode err ) { diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index b297c27578dd..85d60828d2ba 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -83,8 +83,6 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::lang; namespace { diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 9453d8ee8b2c..bd7a0a091189 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -42,8 +42,6 @@ using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::util; class SfxPickListImpl : public SfxListener { diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index
core.git: sfx2/source
sfx2/source/doc/SfxDocumentMetaData.cxx | 391 1 file changed, 197 insertions(+), 194 deletions(-) New commits: commit 35fbe29161871b107f0aabf810a2537df378374d Author: Noel Grandin AuthorDate: Sat Mar 30 21:11:09 2024 +0200 Commit: Noel Grandin CommitDate: Sun Mar 31 08:21:20 2024 +0200 Convert SfxDocumentMetaData to comphelper::WeakComponentImplHelper Change-Id: Ib633595008224ff11486e9ff72b6801d2dbfb887 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165580 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 35f769dd14a5..7ebd0842e092 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include @@ -67,7 +67,6 @@ #include #include #include -#include #include #include #include @@ -122,7 +121,7 @@ namespace { typedef std::vector > > AttrVector; -typedef ::cppu::WeakComponentImplHelper< +typedef ::comphelper::WeakComponentImplHelper< css::lang::XServiceInfo, css::document::XDocumentProperties2, css::lang::XInitialization, @@ -132,7 +131,6 @@ typedef ::cppu::WeakComponentImplHelper< SfxDocumentMetaData_Base; class SfxDocumentMetaData: -private ::cppu::BaseMutex, public SfxDocumentMetaData_Base { public: @@ -149,7 +147,7 @@ public: getSupportedServiceNames() override; // css::lang::XComponent: -virtual void SAL_CALL dispose() override; +virtual void disposing(std::unique_lock& rGuard) override; // css::document::XDocumentProperties: virtual OUString SAL_CALL getAuthor() override; @@ -257,7 +255,7 @@ protected: const css::uno::Reference< css::uno::XComponentContext > m_xContext; /// for notification -::comphelper::OInterfaceContainerHelper3 m_NotifyListeners; +::comphelper::OInterfaceContainerHelper4 m_NotifyListeners; /// flag: false means not initialized yet, or disposed bool m_isInitialized; /// flag @@ -284,38 +282,42 @@ protected: OUString m_DefaultTarget; /// check if we are initialized properly -void checkInit() const; +void checkInit(std::unique_lock& rGuard) const; /// initialize state from given DOM tree -void init(const css::uno::Reference& i_xDom); +void init(std::unique_lock& rGuard, const css::uno::Reference& i_xDom); /// update element in DOM tree -void updateElement(const OUString & i_name, +void updateElement(std::unique_lock& rGuard, +const OUString & i_name, std::vector >* i_pAttrs = nullptr); /// update user-defined meta data and attributes in DOM tree -void updateUserDefinedAndAttributes(); +void updateUserDefinedAndAttributes(std::unique_lock& rGuard); /// create empty DOM tree (XDocument) css::uno::Reference createDOM() const; /// extract base URL (necessary for converting relative links) css::uno::Reference getURLProperties( +std::unique_lock& rGuard, const css::uno::Sequence & i_rMedium) const; /// get text of standard meta data element -OUString getMetaText(const char* i_name) const; +OUString getMetaText(std::unique_lock& rGuard, const char* i_name) const; /// set text of standard meta data element iff not equal to existing text -bool setMetaText(const OUString& i_name, +bool setMetaText(std::unique_lock& g, const OUString& i_name, const OUString & i_rValue); /// set text of standard meta data element iff not equal to existing text void setMetaTextAndNotify(const OUString& i_name, const OUString & i_rValue); /// get text of standard meta data element's attribute -OUString getMetaAttr(const OUString& i_name, +OUString getMetaAttr(std::unique_lock& rGuard, +const OUString& i_name, const OUString& i_attr) const; /// get text of a list of standard meta data elements (multiple occ.) css::uno::Sequence< OUString > getMetaList( +std::unique_lock& rGuard, const char* i_name) const; /// set text of a list of standard meta data elements (multiple occ.) -bool setMetaList(const OUString& i_name, +bool setMetaList(std::unique_lock& rGuard, const OUString& i_name, const css::uno::Sequence< OUString > & i_rValue, AttrVector const*); -void createUserDefined(); +void createUserDefined(std::unique_lock& rGuard); }; typedef ::cppu::ImplInheritanceHelper< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE; @@ -606,6 +608,7 @@ OUString durationToText(sal_Int32 i_value) noexcept // extract base URL (necessary for converting relative links) css::uno::Reference< css::beans::XPropertySet > SfxDocumentMetaData::getURLProperties( +
core.git: sfx2/source
sfx2/source/sidebar/SidebarDockingWindow.cxx | 117 +-- 1 file changed, 60 insertions(+), 57 deletions(-) New commits: commit d4d923f9db926d8b0b6eb3bb7b62f5a7a520c00d Author: Caolán McNamara AuthorDate: Thu Mar 28 11:23:56 2024 + Commit: Caolán McNamara CommitDate: Thu Mar 28 15:53:08 2024 +0100 null deref of mpSidebarController follow the pattern used in the rest of this and skip the branch that depends on mpSidebarController existing git show -w Change-Id: I739754b2af7ad09fa80c36693d8adbf173ece2e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165426 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 23c3b459c3be..d0edf8066332 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -136,75 +136,78 @@ SfxChildAlignment SidebarDockingWindow::CheckAlignment ( bool SidebarDockingWindow::EventNotify(NotifyEvent& rEvent) { -NotifyEventType nType = rEvent.GetType(); -if (NotifyEventType::KEYINPUT == nType) +if (mpSidebarController) { -const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode(); -switch (rKeyCode.GetCode()) +NotifyEventType nType = rEvent.GetType(); +if (NotifyEventType::KEYINPUT == nType) { -case KEY_UP: -case KEY_DOWN: -case KEY_PAGEUP: -case KEY_PAGEDOWN: -case KEY_HOME: -case KEY_END: -case KEY_LEFT: -case KEY_RIGHT: -case KEY_BACKSPACE: -case KEY_DELETE: -case KEY_INSERT: -case KEY_RETURN: -case KEY_ESCAPE: +const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode(); +switch (rKeyCode.GetCode()) { +case KEY_UP: +case KEY_DOWN: +case KEY_PAGEUP: +case KEY_PAGEDOWN: +case KEY_HOME: +case KEY_END: +case KEY_LEFT: +case KEY_RIGHT: +case KEY_BACKSPACE: +case KEY_DELETE: +case KEY_INSERT: +case KEY_RETURN: +case KEY_ESCAPE: +{ +return true; +} +default: +break; +} +if (!mpAccel) +{ +mpAccel = svt::AcceleratorExecute::createAcceleratorHelper(); +mpAccel->init(comphelper::getProcessComponentContext(), mpSidebarController->getXFrame()); +} +const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode))); +if (".uno:DesignerDialog" == aCommand) +{ +std::shared_ptr xPanelDescriptor = + mpSidebarController->GetResourceManager()->GetPanelDescriptor( u"StyleListPanel" ); +if ( xPanelDescriptor && mpSidebarController->IsDeckVisible( xPanelDescriptor->msDeckId ) ) +Close(); +return true; +} +if (".uno:Undo" == aCommand || ".uno:Redo" == aCommand) +{ +comphelper::dispatchCommand(aCommand, {}); return true; } -default: -break; -} -if (!mpAccel) -{ -mpAccel = svt::AcceleratorExecute::createAcceleratorHelper(); -mpAccel->init(comphelper::getProcessComponentContext(), mpSidebarController->getXFrame()); -} -const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode))); -if (".uno:DesignerDialog" == aCommand) -{ -std::shared_ptr xPanelDescriptor = - mpSidebarController->GetResourceManager()->GetPanelDescriptor( u"StyleListPanel" ); -if ( xPanelDescriptor && mpSidebarController->IsDeckVisible( xPanelDescriptor->msDeckId ) ) -Close(); -return true; } -if (".uno:Undo" == aCommand || ".uno:Redo" == aCommand) +else if (NotifyEventType::MOUSEBUTTONDOWN == nType) { -comphelper::dispatchCommand(aCommand, {}); -return true; +const MouseEvent *mEvt = rEvent.GetMouseEvent(); +if (mEvt->IsLeft()) +{ +tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea(); +if ( aGrip.Contains( mEvt->GetPosPixel() ) ) +mbIsReadyToDrag = true; +} } -} -else if (NotifyEventType::MOUSEBUTTONDOWN == nType) -{ -const MouseEvent *mEvt = rEvent.GetMouseEvent(); -if (mEvt->IsLeft()) +else if
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx | 63 --- 1 file changed, 36 insertions(+), 27 deletions(-) New commits: commit 64a5509d9aef88c04dbaad7f553c2b83b23c045a Author: Caolán McNamara AuthorDate: Wed Mar 27 16:42:48 2024 + Commit: Caolán McNamara CommitDate: Thu Mar 28 09:54:58 2024 +0100 show this infobar regardless of the exact reason for presenting it Change-Id: I8af248efe8f9dda868e2f126beead875e391b563 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165402 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 222eb0ff96ec..71ea0e92d4dc 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1344,6 +1344,32 @@ void SfxViewFrame::AppendContainsMacrosInfobar() { SfxObjectShell_Impl* pObjImpl = m_xObjSh->Get_Impl(); +auto aResId = STR_CONTAINS_MACROS; +if (SvtSecurityOptions::IsMacroDisabled()) +aResId = STR_MACROS_DISABLED; +else if (pObjImpl->aMacroMode.hasUnsignedContentError()) +aResId = STR_MACROS_DISABLED_CONTENT_UNSIGNED; +// The idea here is to always present an infobar is there was some +// macro/script related potential hazard disabled in the source document +auto pInfoBar = AppendInfoBar("macro", SfxResId(STR_MACROS_DISABLED_TITLE), + SfxResId(aResId), InfobarType::WARNING); +if (!pInfoBar) +return; + +// Then show buttons to help navigate to whatever that hazard is. Whether +// that is included macros, so the user could delete them. Or events bound +// to scripts which could be cleared. But there are likely other cases not +// captured here, which could be added, various blocked features where its +// likely still worth displaying the infobar that they have been disabled, +// even if we don't currently provide a way to indicate what exactly those +// are and how to remove them. + +// No access to macro dialog when macros are disabled globally, so return +// early without adding buttons to help explore what the macros/script/events +// might be. +if (SvtSecurityOptions::IsMacroDisabled()) +return; + // what's the difference between pObjImpl->documentStorageHasMacros() and pObjImpl->aMacroMode.hasMacroLibrary() ? bool bHasDocumentMacros = pObjImpl->aMacroMode.hasMacroLibrary(); @@ -1380,35 +1406,18 @@ void SfxViewFrame::AppendContainsMacrosInfobar() } } -if (bHasDocumentMacros || bHasBoundConfigEvents) +if (bHasDocumentMacros) { -auto aResId = STR_CONTAINS_MACROS; -if (SvtSecurityOptions::IsMacroDisabled()) -aResId = STR_MACROS_DISABLED; -else if (pObjImpl->aMacroMode.hasUnsignedContentError()) -aResId = STR_MACROS_DISABLED_CONTENT_UNSIGNED; -auto pInfoBar = AppendInfoBar("macro", SfxResId(STR_MACROS_DISABLED_TITLE), - SfxResId(aResId), InfobarType::WARNING); -if (!pInfoBar) -return; - -// No access to macro dialog when macros are disabled globally. -if (SvtSecurityOptions::IsMacroDisabled()) -return; - -if (bHasDocumentMacros) -{ -weld::Button& rMacroButton = pInfoBar->addButton(); -rMacroButton.set_label(SfxResId(STR_MACROS)); -rMacroButton.connect_clicked(LINK(this, SfxViewFrame, MacroButtonHandler)); -} +weld::Button& rMacroButton = pInfoBar->addButton(); +rMacroButton.set_label(SfxResId(STR_MACROS)); +rMacroButton.connect_clicked(LINK(this, SfxViewFrame, MacroButtonHandler)); +} -if (bHasBoundConfigEvents) -{ -weld::Button& rEventButton = pInfoBar->addButton(); -rEventButton.set_label(SfxResId(STR_EVENTS)); -rEventButton.connect_clicked(LINK(this, SfxViewFrame, EventButtonHandler)); -} +if (bHasBoundConfigEvents) +{ +weld::Button& rEventButton = pInfoBar->addButton(); +rEventButton.set_label(SfxResId(STR_EVENTS)); +rEventButton.connect_clicked(LINK(this, SfxViewFrame, EventButtonHandler)); } }
core.git: sfx2/source
sfx2/source/control/unoctitm.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit d5dccc8780c737c0f23164fd98669303e61ba737 Author: Gökay Şatır AuthorDate: Mon Mar 18 15:17:32 2024 +0300 Commit: Miklos Vajna CommitDate: Wed Mar 27 16:57:06 2024 +0100 Allow export commands in readonly view mode. (cherry picked from commit 5c8c5db55e082eed3422e3fb9455943b2f285253) Change-Id: I88e9a45fd9e5c7b6bf1984a424e36b010aaaff4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165389 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index f8c62b3dae19..d81b191d8623 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -544,7 +544,10 @@ static bool isCommandAllowedForViewType(const OUString& command) u"LayoutStatus"_ustr, u"ToolbarMode"_ustr, u"ChangeTheme"_ustr, -u"CopyHyperlinkLocation"_ustr +u"CopyHyperlinkLocation"_ustr, +u"ExportDirectToPDF"_ustr, +u"ExportToPDF"_ustr, +u"ExportToEPUB"_ustr }; bool allowed = std::find(std::begin(allowedCommandList), std::end(allowedCommandList), command) != std::end(allowedCommandList);
core.git: sfx2/source
sfx2/source/control/unoctitm.cxx | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) New commits: commit a69e32a0ca800642a3fb542c0a49a13ba04faecc Author: Darshan11 AuthorDate: Wed Mar 13 16:34:38 2024 +0530 Commit: Caolán McNamara CommitDate: Wed Mar 27 13:09:37 2024 +0100 Send ParaRightToLeft state messageto client side - Before this patch in online text in paragraph was changing according to uno command but client was not getting and info about is RTL true or TRL true - this will send message [:unoParaRightToLeft=true || :unoParaLeftToRight=true] at client side - added more properties like disabled and state information to handle both case at same time in online - which will be helpful to our existing locgic where to add or from where to remove selected class on element according to response Change-Id: Ia443215342d6a81f4e60fa9237149f6b18420e16 Change-Id: I08fb7e474e099822b26c732fe1e5dac8e773c58f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164767 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164817 (cherry picked from commit fa93750070793cd548d028feb39e4d0e0e61ae5a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165324 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 1068b28e0ac8..f8c62b3dae19 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1096,8 +1096,6 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "DeleteNote" || aEvent.FeatureURL.Path == "AcceptChanges" || aEvent.FeatureURL.Path == "SetDefault" || - aEvent.FeatureURL.Path == "ParaLeftToRight" || - aEvent.FeatureURL.Path == "ParaRightToLeft" || aEvent.FeatureURL.Path == "ParaspaceIncrease" || aEvent.FeatureURL.Path == "ParaspaceDecrease" || aEvent.FeatureURL.Path == "TableDialog" || @@ -1169,6 +1167,18 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra { aBuffer.append(aEvent.IsEnabled ? std::u16string_view(u"enabled") : std::u16string_view(u"disabled")); } +else if (aEvent.FeatureURL.Path == "ParaLeftToRight" || + aEvent.FeatureURL.Path == "ParaRightToLeft") +{ +tools::JsonWriter aTree; +bool bTemp = false; +aEvent.State >>= bTemp; +aTree.put("commandName", aEvent.FeatureURL.Complete); +aTree.put("disabled", !aEvent.IsEnabled); +aTree.put("state", bTemp ? "true" : "false"); + SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aTree.finishAndGetAsOString()); +return; +} else if (aEvent.FeatureURL.Path == "AssignLayout" || aEvent.FeatureURL.Path == "StatusSelectionMode" || aEvent.FeatureURL.Path == "Signature" ||
core.git: sfx2/source
sfx2/source/sidebar/DeckTitleBar.cxx |2 +- sfx2/source/sidebar/Panel.cxx|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit ee2afff68ed5b22b2bf635d536584e8cba4ae2a4 Author: Tomoyuki Kubota AuthorDate: Sun Mar 24 12:07:07 2024 +0100 Commit: Noel Grandin CommitDate: Sun Mar 24 17:05:25 2024 +0100 for OSL_DEBUG_LEVEL >= 2, adapt to b55bf0cbdfdc6820 Change-Id: Ie3b9746ca150fba8f9849649b6e6bbd0439e1a1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165234 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx index f425e21a92bc..f62ec6491f40 100644 --- a/sfx2/source/sidebar/DeckTitleBar.cxx +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -27,7 +27,7 @@ #include #if OSL_DEBUG_LEVEL >= 2 -#include +#include #endif namespace sfx2::sidebar { diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 6bc1424e7d41..1a087e177b78 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -28,7 +28,7 @@ #if OSL_DEBUG_LEVEL >= 2 -#include +#include #include #endif
core.git: sfx2/source
sfx2/source/doc/docfile.cxx |4 1 file changed, 4 insertions(+) New commits: commit 5441ed518d36ac12a6bd0c517e2cfc24aff94d50 Author: Justin Luth AuthorDate: Thu Mar 14 11:29:08 2024 -0400 Commit: Miklos Vajna CommitDate: Mon Mar 18 14:20:38 2024 +0100 tdf#40244 tdf#160192: create tempFile elsewhere if LogicBase is RO This avoids a crash/infinite loop in specific read-only folder situation (where the lock file already exists). It also fixes ODF files giving three misleading/unclear notices when attempting to save into a read-only folder. When LO saves a file, it saves to a temporary file and then moves that file overtop of the previous one, IIUC. Prior to 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b that temporary file was stored in the /tmp directory (IIUC), but was changed to be in the same folder for easier renaming, same filesystem etc. Note that typically this situation would fail since a locking file also could not be created. However in the case where the lock file already exists, then all the pieces are in place to actually modify the document. By falling back to the /tmp folder if the document's folder is read-only, we can still modify a writeable document. Change-Id: Ie027fc05934f2c071f7a91007255801c179bff49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164841 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index c90fb794f690..b58d27c95fa4 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -4038,6 +4038,8 @@ void SfxMedium::CreateTempFile( bool bReplace ) OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl); pImpl->pTempFile.reset(new ::utl::TempFileNamed()); +if (!aLogicBase.isEmpty() && pImpl->pTempFile->GetFileName().isEmpty()) +pImpl->pTempFile.reset(new ::utl::TempFileNamed()); pImpl->pTempFile->EnableKillingFile(); pImpl->m_aName = pImpl->pTempFile->GetFileName(); OUString aTmpURL = pImpl->pTempFile->GetURL(); @@ -4134,6 +4136,8 @@ void SfxMedium::CreateTempFileNoCopy() OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl); pImpl->pTempFile.reset(new ::utl::TempFileNamed()); +if (!aLogicBase.isEmpty() && pImpl->pTempFile->GetFileName().isEmpty()) +pImpl->pTempFile.reset(new ::utl::TempFileNamed()); pImpl->pTempFile->EnableKillingFile(); pImpl->m_aName = pImpl->pTempFile->GetFileName(); if ( pImpl->m_aName.isEmpty() )
core.git: sfx2/source
sfx2/source/doc/oleprops.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c615fba780da5ac3073fe5a00848824f59ee376a Author: Justin Luth AuthorDate: Thu Mar 14 12:29:25 2024 -0400 Commit: Justin Luth CommitDate: Fri Mar 15 21:57:44 2024 +0100 tdf#160192: avoid hang when trying to overwrite doc/lockfile in RO dir Bug exposed with 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b sfx2 store: create temp files next to local files tested on .doc format, code-read suggests it affects xls/ppt too, but they throw exceptions, apparently before hitting this section. I was seeing an infinite loop on SfxOleSection::SaveProperty's while((rStrm.Tell() & 3)) rStrm.WriteUChar( 0 ); because nothing checks to confirm that the tempfile is actually created/useable. Now, instead of an infinite loop, we get a crash... Change-Id: I9e093432361a8ad6f928ec9b47290274b3d4ef06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164840 Reviewed-by: Julien Nabet Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 891110c43780..714f58c2f1af 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -1110,7 +1110,7 @@ ErrCode const & SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUS if( pStrg ) { rtl::Reference xStrm = pStrg->OpenSotStream( rStrmName, StreamMode::TRUNC | StreamMode::STD_WRITE ); -if( xStrm.is() ) +if (xStrm.is() && xStrm->IsWritable()) Save( *xStrm ); else SetError( ERRCODE_IO_ACCESSDENIED );
core.git: sfx2/source
sfx2/source/control/request.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 8d76c5bc29b8ed4cb616bed845acc30b96a38c77 Author: Noel Grandin AuthorDate: Tue Mar 12 21:23:39 2024 +0200 Commit: Noel Grandin CommitDate: Wed Mar 13 08:15:06 2024 +0100 remove DBG_ASSERT this is testing the wrong thing anyway. I briefly converted it to a real assert, but surprise surprise, real code appears to now rely on being able to set this more than once, so just remove it. Change-Id: Ib272b002e3038eb8537df4768d980b3c3cf938fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164726 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index f6b7645fef13..9406ce8b9fd3 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -418,7 +418,6 @@ void SfxRequest::RemoveItem( sal_uInt16 nID ) void SfxRequest::SetReturnValue(const SfxPoolItem ) { -DBG_ASSERT(!pImpl, "Set Return value multiple times?"); DBG_ASSERT(nullptr != pImpl->pPool, "Missing SfxItemPool (!)"); if (nullptr != pImpl->pPool) pImpl->aRetVal = SfxPoolItemHolder(*pImpl->pPool, );
core.git: sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit e2708fecb34fb4084f8db5f2c5ffb4d8923002ca Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 12 08:34:39 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3ca938a25439d6f23bbd6830a96e5180ff94f757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164619 Tested-by: Jenkins diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 977c5e8a93dd..ef97d253bd88 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 20e05096d6c4..8e88bdc2c656 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); }
core.git: sfx2/source
sfx2/source/dialog/infobar.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 06d8c1e9d8ba1d04914d1c48c94732cdb5c68846 Author: Heiko Tietze AuthorDate: Wed Mar 6 10:35:53 2024 +0100 Commit: Heiko Tietze CommitDate: Wed Mar 6 11:58:07 2024 +0100 Resolves tdf#159486 - Larger hitbox for close button on infobar Change-Id: I83582c0c1ec7dd5e8f82bdf327e68ce88122ad03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164450 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index ca848813f09e..38a510a2589c 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -103,9 +103,12 @@ void SfxInfoBarWindow::SetCloseButtonImage() aSize = Size(aSize.Width() * 1.5, aSize.Height() * 1.5); ScopedVclPtr xDevice(m_xCloseBtn->create_virtual_device()); -xDevice->SetOutputSizePixel(aSize); +xDevice->SetOutputSizePixel(Size(24, 24)); +xDevice->SetBackground(Color(m_aBackgroundColor)); +xDevice->Erase(); -Point aBtnPos(0, 0); +const int nPos = (24 - aSize.getWidth()) / 2; +Point aBtnPos(nPos, nPos); const ViewInformation2D aNewViewInfos; const std::unique_ptr pProcessor(
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit c39b832e85ae9e172f51c77c40d74949afcc0ac3 Author: Stephan Bergmann AuthorDate: Wed Feb 28 16:33:59 2024 +0100 Commit: Stephan Bergmann CommitDate: Thu Feb 29 07:54:30 2024 +0100 Avoid -Werror,-Wunused-but-set-variable for ENABLE_WASM_STRIP_PINGUSER ...after 607740654f2264e13469e4da1d020448217d7222 "Resolves tdf#131550 - Suppress Donate/Involve infobar if another is visible" Change-Id: I1d788a0f71a5baa8ce427631485643f0fd6e626d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164102 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 31fd9471455c..20e56a6c4076 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1714,6 +1714,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch); batch->commit(); } +#else +(void) bIsInfobarShown; #endif break;
core.git: sfx2/source
sfx2/source/doc/guisaveas.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 5e134896f35d5c3a194090f2af1b84fbaec8b432 Author: Mike Kaganski AuthorDate: Sun Feb 25 19:17:53 2024 +0600 Commit: Mike Kaganski CommitDate: Mon Feb 26 02:24:15 2024 +0100 Use SHGetKnownFolderPath, to avoid MAX_PATH limitation Change-Id: If7e70453bd67ec874fc06af7cd53a8c410a24e52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163912 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 5773fc732ea9..974aef7384d9 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1331,14 +1331,15 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir ) #ifdef _WIN32 if( !bIsInTempPath ) { -wchar_t sPath[MAX_PATH+1]; -HRESULT hRes = SHGetFolderPathW( nullptr, CSIDL_INTERNET_CACHE, nullptr, SHGFP_TYPE_CURRENT, sPath ); +PWSTR sPath; +HRESULT hRes = SHGetKnownFolderPath(FOLDERID_InternetCache, 0, nullptr, ); if( SUCCEEDED(hRes) ) { OUString sTempINetFiles; if( osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(sPath)), sTempINetFiles) == osl::FileBase::E_None ) bIsInTempPath = !sTempINetFiles.isEmpty() && sLocationURL.startsWith( sTempINetFiles ); } +CoTaskMemFree(sPath); } #endif // Suggest somewhere other than the system's temp directory
core.git: sfx2/source
sfx2/source/dialog/dinfdlg.cxx |5 + 1 file changed, 1 insertion(+), 4 deletions(-) New commits: commit f1a780cb6b7b860856de7ce2d8735432523c9e73 Author: Méven Car AuthorDate: Thu Feb 8 17:43:25 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Feb 21 11:01:05 2024 +0100 Allow Document properties tab custom properties for LOK Change-Id: I4860f9bad69b3db0eef7b0e98159ca2b336b4f60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163611 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos (cherry picked from commit f8f89de7a49db563b870dbaada6f010f2f75254f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163619 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index a5d45f322603..f103654f04a9 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1324,10 +1324,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog(weld::Window* pParent, const SfxIte AddTabPage("general", SfxDocumentPage::Create, nullptr); AddTabPage("description", SfxDocumentDescPage::Create, nullptr); -if (!comphelper::LibreOfficeKit::isActive()) -AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); -else -RemoveTabPage("customprops"); +AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); if (rInfoItem.isCmisDocument()) AddTabPage("cmisprops", SfxCmisPropertiesPage::Create, nullptr);
core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 7c0c8a3ae258808012c3514dadeb02fc0c6fc43b Author: Julien Nabet AuthorDate: Wed Feb 14 10:21:20 2024 +0100 Commit: Xisco Fauli CommitDate: Wed Feb 14 14:19:47 2024 +0100 tdf#159707: fix crash when changing to edit mode (calc) bt: 0x7f9eb4b902f2 in com::sun::star::uno::Reference::operator->() const (this=0x55b8c2b54888) at include/com/sun/star/uno/Reference.h:387 0x7f9eb4c03584 in ScVbaEventsHelper::notifyEvent(com::sun::star::document::EventObject const&) (this=0x55b8c2b54840, rEvent=...) at /home/julien/lo/libreoffice/sc/source/ui/vba/vbaeventshelper.cxx:605 0x7f9ef464bd3c in (anonymous namespace)::NotifySingleListenerIgnoreRE::operator()(com::sun::star::uno::Reference const&) const (this=0x7ffc5044dfc0, listener=uno::Reference to (ScVbaEventsHelper *) 0x55b8c2b54870) at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:3293 0x7f9ef463b8aa in comphelper::OInterfaceContainerHelper3::forEach<(anonymous namespace)::NotifySingleListenerIgnoreRE >((anonymous namespace)::NotifySingleListenerIgnoreRE const&) (this=0x55b8c2735c18, func=...) at include/comphelper/interfacecontainer3.hxx:279 0x7f9ef463b010 in SfxBaseModel::postEvent_Impl(rtl::OUString const&, com::sun::star::uno::Reference const&, com::sun::star::uno::Any const&) (this=0x55b8c2308ae0, aName="OnUnload", xController=empty uno::Reference, supplement=uno::Any(void)) at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:3338 0x7f9ef463a089 in SfxBaseModel::Notify(SfxBroadcaster&, SfxHint const&) (this=0x55b8c2308ae0, rBC=..., rHint=...) at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:2960 See full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=192546 Regression from: https://git.libreoffice.org/core/+/d2fccf0117a37f8aab8bb50ece419987f06af6b9%5E%21 "cool#6893 improve listeners in SfxBaseModel" Change-Id: I372808dade20c47275ab599054d8e9572dc3da4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163356 Reviewed-by: Julien Nabet Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index b1862799b6b7..5de773ac01e2 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2509,7 +2509,7 @@ void SAL_CALL SfxBaseModel::removeEventListener( const Reference< document::XEve { SfxModelGuard aGuard( *this ); -m_pData->m_aEventListeners.removeInterface( aListener ); +m_pData->m_aDocumentEventListeners1.removeInterface( aListener ); } // XShapeEventBroadcaster
core.git: sfx2/source
sfx2/source/view/lokhelper.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit c170d1364be56d91fd16f255ffdc406b8e822732 Author: Mike Kaganski AuthorDate: Fri Feb 9 07:30:02 2024 +0100 Commit: Mike Kaganski CommitDate: Fri Feb 9 08:35:57 2024 +0100 Fix no-PCH build ... after commit f840a0d54d873d3003f8b624a50557f8c9872477 (lok: calc: fix for rendering issues on in place editing, 2024-02-08) Change-Id: I3c5d2bf72d2f5cfc750cfa6f4d7fc2dae7fb9642 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163147 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 4a59ffbd3322..530490686c11 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include
core.git: sfx2/source
sfx2/source/control/dispatch.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 59a86aff49ebc838c91355e98df66769b8054adc Author: Caolán McNamara AuthorDate: Fri Dec 8 14:10:11 2023 + Commit: Caolán McNamara CommitDate: Thu Feb 8 17:36:13 2024 +0100 kit mode is similar to !HAVE_FEATURE_DESKTOP mode wrt menubar in that it is not used. SfxDispatcher: :SetMenu_Impl is 3.1% of long-profiling use Change-Id: I07bf0f130791795a49835e91ac8b8c5bec749f33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163102 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 3b52f7ae322e..2fa4e52c3e27 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1009,6 +1009,9 @@ void SfxDispatcher::SetMenu_Impl() if ( !xImp->pFrame ) return; +if (comphelper::LibreOfficeKit::isActive()) +return; + SfxViewFrame* pTop = xImp->pFrame->GetTopViewFrame(); if ( !pTop || pTop->GetBindings().GetDispatcher() != this ) return;
core.git: sfx2/source
sfx2/source/doc/objstor.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 6bddbe51cee5c4aea023cc68771800f46a4aad2f Author: Mike Kaganski AuthorDate: Thu Feb 1 13:35:43 2024 +0600 Commit: Mike Kaganski CommitDate: Thu Feb 1 12:19:20 2024 +0100 tdf#159496: clear mxObjectContainer in PrepareSecondTryLoad_Impl The problem here is that the object container has own reference to the storage object. In SfxBaseModel::load, when preparing for a second try, the storage gets disposed, and a cleanup is performed; but previously, the reference to the disposed storage was used in the object container, and thus generated a failure when it was used to import the OLE. Clearing it allows to re-create it properly, with the updated storage. Change-Id: I08b7503d79240ccc51b253fe1f4e99a0232995b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162866 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 1d9401714acf..5a300dd164ad 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -399,6 +399,7 @@ void SfxObjectShell::PrepareSecondTryLoad_Impl() { // only for internal use pImpl->m_xDocStorage.clear(); +pImpl->mxObjectContainer.reset(); pImpl->m_bIsInit = false; ResetError(); }
core.git: sfx2/source
sfx2/source/notebookbar/SfxNotebookBar.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 093ef8bf93adf93835ad2e2e43055d90d76a8376 Author: Andrea Gelmini AuthorDate: Tue Jan 30 16:46:44 2024 +0100 Commit: Julien Nabet CommitDate: Wed Jan 31 11:21:31 2024 +0100 Fix typo Change-Id: I7ab87d07d26dc6eb8c54f274955c4434e60c40c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162767 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index c6b1cddb34ad..41ae9c3c2666 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -61,7 +61,7 @@ struct NotebookBarViewData }; /** Notebookbar instance manager is a singleton that is used for track the - * per-view instances of view specifc data contained in NotebookBarViewData + * per-view instances of view specific data contained in NotebookBarViewData * class. **/ class NotebookBarViewManager final
core.git: sfx2/source svx/source
sfx2/source/view/viewsh.cxx |6 -- svx/source/svdraw/svdpage.cxx | 10 -- 2 files changed, 12 insertions(+), 4 deletions(-) New commits: commit 3a48ad467b7fbf9cbdfff1222e08c02b0ff5d544 Author: Caolán McNamara AuthorDate: Tue Jan 30 21:29:31 2024 + Commit: Caolán McNamara CommitDate: Wed Jan 31 10:33:06 2024 +0100 use ViewShell DOCCOLOR when available for fallback, continue to warn if the terminal fallback gets used, but fill stub it to return the application DOCCOLOR Change-Id: I2bf3a1c6c6adb58811fd36c70f93932de246f10a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162782 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 06dfc49798be..8c54bd049acb 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -3316,10 +3317,11 @@ vcl::Window* SfxViewShell::GetEditWindowForActiveOLEObj() const return pEditWin; } -::Color SfxViewShell::GetColorConfigColor(svtools::ColorConfigEntry) const +::Color SfxViewShell::GetColorConfigColor(svtools::ColorConfigEntry eEntry) const { SAL_WARN("sfx.view", "SfxViewShell::GetColorConfigColor not overridden!"); -return {}; +svtools::ColorConfig aColorConfig; +return aColorConfig.GetColorValue(eEntry).nColor; } void SfxViewShell::SetLOKLanguageTag(const OUString& rBcp47LanguageTag) diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 99137d28b4da..d154fd982901 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -1768,8 +1769,13 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView const * pView, bool bScreenDi if(bScreenDisplay && (!pView || pView->GetApplicationDocumentColor() == COL_AUTO)) { -svtools::ColorConfig aColorConfig; -aColor = aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor; +if (const SfxViewShell* pViewShell = SfxViewShell::Current()) +aColor = pViewShell->GetColorConfigColor(svtools::DOCCOLOR); +else +{ +svtools::ColorConfig aColorConfig; +aColor = aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor; +} } else {
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 43dcd82624a26d7c3a4185469bef60f531999190 Author: Caolán McNamara AuthorDate: Tue Jan 30 11:47:38 2024 + Commit: Caolán McNamara CommitDate: Tue Jan 30 15:20:17 2024 +0100 reuse xCurrentFrame instead of fetching it again and use the exception safe vcl::CommandInfoProvider::GetModuleIdentifier wrapper. might as well skip the TOTD for the database report as we as the form. Change-Id: If91f571d64878a7bab85b97800d3c60c1397dc2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162745 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ab6e2ebdda0d..e2dad9605d45 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1522,9 +1522,10 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) const auto xContext = comphelper::getProcessComponentContext(); const auto xModuleManager = css::frame::ModuleManager::create(xContext); switch (vcl::EnumContext::GetApplicationEnum( -xModuleManager->identify(xCurrentFrame))) + vcl::CommandInfoProvider::GetModuleIdentifier(xCurrentFrame))) { case vcl::EnumContext::Application::WriterForm: +case vcl::EnumContext::Application::WriterReport: bIsBaseFormOpen = true; break; default: @@ -1533,7 +1534,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) if (!bIsBaseFormOpen) { // tdf#127946 pass in argument for dialog parent -SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface()); +SfxUnoFrameItem aDocFrame(SID_FILLFRAME, xCurrentFrame); GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { }); }
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) New commits: commit a2c09afebef70d2419823445ff92379fe3df9485 Author: Matt K AuthorDate: Fri Jan 19 17:05:35 2024 -0600 Commit: Caolán McNamara CommitDate: Tue Jan 30 12:49:42 2024 +0100 tdf#151352 Don't display tip-of-the-day in base form editor The problem is that there is some crash with tip-of-the-day on Linux with GTK3 when opening a base form for editing. The fix is to avoid showing the tip-of-the-day for base form editor, as suggested in the bug comments. Change-Id: Ic155e137c4314b7e014f09d83589519197bd0039 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162326 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 16b41843ba31..ab6e2ebdda0d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -78,6 +78,7 @@ #include #include #include +#include #include #include @@ -1515,9 +1516,27 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // open where SdModule::ExecuteNewDocument will launch it instead when that dialog is dismissed if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest && !IsInModalMode()) { -// tdf#127946 pass in argument for dialog parent -SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface()); -GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { }); +bool bIsBaseFormOpen = false; + +const auto xCurrentFrame = GetFrame().GetFrameInterface(); +const auto xContext = comphelper::getProcessComponentContext(); +const auto xModuleManager = css::frame::ModuleManager::create(xContext); +switch (vcl::EnumContext::GetApplicationEnum( +xModuleManager->identify(xCurrentFrame))) +{ +case vcl::EnumContext::Application::WriterForm: +bIsBaseFormOpen = true; +break; +default: +break; +} +if (!bIsBaseFormOpen) +{ +// tdf#127946 pass in argument for dialog parent +SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface()); +GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, + { }); +} } // inform about the community involvement
core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f1729753193f4f2c69f45b4377a557cceeb72070 Author: Caolán McNamara AuthorDate: Mon Jan 29 13:08:02 2024 + Commit: Caolán McNamara CommitDate: Tue Jan 30 09:43:15 2024 +0100 just get SfxViewShell::Current once Change-Id: Ie4d86076af63b68c7ae61570ce8e2b9ce8509e50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162690 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index ad31130e514d..c25d31deb110 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3264,8 +3264,8 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDocFailed : SfxEventHintId::SaveAsDocFailed, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOCFAILED : GlobalEventId::SAVEASDOCFAILED), m_pData->m_pObjectShell.get() ) ); -if ( comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() ) -SfxViewShell::Current()->libreOfficeKitViewCallback( LOK_CALLBACK_EXPORT_FILE, "ERROR"_ostr ); +if (SfxViewShell* pNotifyView = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr) +pNotifyView->libreOfficeKitViewCallback(LOK_CALLBACK_EXPORT_FILE, "ERROR"_ostr); std::stringstream aErrCode; aErrCode << nErrCode;
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 4eb62f0e9ca42d8e6302c04e74ee6f1e08c1419c Author: Szymon Kłos AuthorDate: Fri Jan 26 16:54:14 2024 +0100 Commit: Szymon Kłos CommitDate: Mon Jan 29 09:51:50 2024 +0100 lok: always toggle sidebar deck This fixes regression from: commit 53fc5fa0fed077b7d11e39b710280f0a84b631ff tdf#142978 Show a11y sidebar when finding issues on PDF export LOK was unable to close sidebar Change-Id: Icd96394523020c30e63858bc372ba136c2be8158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162608 (cherry picked from commit 031f11bd9096fb192ced1328f9bbcd1b1903e3e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162621 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f50252984794..16b41843ba31 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3406,8 +3406,11 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest ) if (pDeckIdItem) { const OUString aDeckId(pDeckIdItem->GetValue()); +// Compatibility with old LOK "toggle always" +// TODO: check LOK with tdf#142978 Show a11y sidebar when finding issues on PDF export, hash: 53fc5fa +const bool isLOK = comphelper::LibreOfficeKit::isActive(); const SfxBoolItem* pToggleItem = rReq.GetArg(SID_SIDEBAR_DECK_TOGGLE); -bool bToggle = pToggleItem && pToggleItem->GetValue(); +bool bToggle = isLOK || (pToggleItem && pToggleItem->GetValue()); ::sfx2::sidebar::Sidebar::ShowDeck(aDeckId, this, bToggle); } rReq.Done();
core.git: sfx2/source
sfx2/source/doc/guisaveas.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ae591835dc6b2c18169c2685fbc7e9fb958bf369 Author: Xisco Fauli AuthorDate: Wed Jan 24 10:03:53 2024 +0100 Commit: Xisco Fauli CommitDate: Wed Jan 24 13:30:50 2024 +0100 sfx2: check SfxViewShell::Current() Seen in https://crashreport.libreoffice.org/stats/crash_details/52df6de5-7ea8-48e4-8c45-f18b02d9a767 Change-Id: I56c17234a0f82797d37e26b0c39eeba7f78fcee5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162492 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 7b286321c217..5773fc732ea9 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1521,7 +1521,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo } } -if (!comphelper::LibreOfficeKit::isActive() && !( m_nStoreMode & EXPORT_REQUESTED ) ) +if (!comphelper::LibreOfficeKit::isActive() && !( m_nStoreMode & EXPORT_REQUESTED ) && SfxViewShell::Current() ) { SfxObjectShell* pDocShell = SfxViewShell::Current()->GetObjectShell();
core.git: sfx2/source xmlsecurity/qa
sfx2/source/doc/objstor.cxx |3 - xmlsecurity/qa/unit/signing/signing2.cxx | 58 --- 2 files changed, 31 insertions(+), 30 deletions(-) New commits: commit d0dcd87788910e3c9f67a2b68534019c05b77bad Author: Thorsten Behrens AuthorDate: Mon Jan 15 00:26:02 2024 +0100 Commit: Thorsten Behrens CommitDate: Tue Jan 23 21:41:03 2024 +0100 Make wholesome ODF package encryption the default Change-Id: I825ae7a5e4b80d390804a7bb2cfdfc3b1843bd07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162066 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 854389ae31be..27fb68c83f87 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -170,8 +170,7 @@ bool SfxObjectShell::QuerySlotExecutable( sal_uInt16 /*nSlotId*/ ) static bool UseODFWholesomeEncryption(SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion) { -return nODFVersion == SvtSaveOptions::ODFSVER_LATEST_EXTENDED -&& officecfg::Office::Common::Misc::ExperimentalMode::get(); +return nODFVersion == SvtSaveOptions::ODFSVER_LATEST_EXTENDED; } bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) diff --git a/xmlsecurity/qa/unit/signing/signing2.cxx b/xmlsecurity/qa/unit/signing/signing2.cxx index 71e887df236a..dd6f9e09a83d 100644 --- a/xmlsecurity/qa/unit/signing/signing2.cxx +++ b/xmlsecurity/qa/unit/signing/signing2.cxx @@ -128,9 +128,21 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState()); } -saveAndReload("writer8", "password"); { -// test standard ODF 1.2/1.3/1.4 encryption +// test the old, standard ODF 1.2/1.3/1.4 encryption +Resetter resetter([]() { +std::shared_ptr pBatch( +comphelper::ConfigurationChanges::create()); +officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); +return pBatch->commit(); +}); +std::shared_ptr pBatch( +comphelper::ConfigurationChanges::create()); +officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); +pBatch->commit(); + +saveAndReload("writer8", "password"); + xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml"); assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3"); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr, @@ -174,18 +186,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) } { -Resetter resetter([]() { -std::shared_ptr pBatch( -comphelper::ConfigurationChanges::create()); -officecfg::Office::Common::Misc::ExperimentalMode::set(false, pBatch); -return pBatch->commit(); -}); -std::shared_ptr pBatch( -comphelper::ConfigurationChanges::create()); -officecfg::Office::Common::Misc::ExperimentalMode::set(true, pBatch); -pBatch->commit(); - -// store it experimental - reload +// store it with new wholesome ODF extended encryption - reload saveAndReload("writer8", "password"); // test wholesome ODF extended encryption @@ -253,18 +254,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom } { -Resetter resetter([]() { -std::shared_ptr pBatch( -comphelper::ConfigurationChanges::create()); -officecfg::Office::Common::Misc::ExperimentalMode::set(false, pBatch); -return pBatch->commit(); -}); -std::shared_ptr pBatch( -comphelper::ConfigurationChanges::create()); -officecfg::Office::Common::Misc::ExperimentalMode::set(true, pBatch); -pBatch->commit(); - -// store it experimental - reload +// store it with new wholesome ODF extended encryption - reload saveAndReload("writer8", "password"); // test wholesome ODF extended encryption @@ -321,9 +311,21 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState()); } -saveAndReload("writer8", "password"); { -// test standard ODF 1.2/1.3/1.4 encryption +// test the old, standard ODF 1.2/1.3/1.4 encryption +Resetter resetter([]() { +std::shared_ptr pBatch( +comphelper::ConfigurationChanges::create()); +officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); +return pBatch->commit(); +}); +std::shared_ptr pBatch( +
core.git: sfx2/source
sfx2/source/appl/sfxhelp.cxx |4 1 file changed, 4 insertions(+) New commits: commit 5dbb4d28b3310109ba47d02ea486299ba56e3c9f Author: Andras Timar AuthorDate: Fri Jan 19 15:49:49 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Jan 20 22:18:47 2024 +0100 LOK: disable popup bubble for hyperlinks Change-Id: I0ca21a90561affa453bd249c86e58793618f809e (cherry picked from commit 88fea772610a4feef018ba03fd19749841772225) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162335 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index c67f1485497f..b297c27578dd 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -666,6 +666,10 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p OUString SfxHelp::GetURLHelpText(std::u16string_view aURL) { +// hyperlinks are handled differently in Online +if (comphelper::LibreOfficeKit::isActive()) +return OUString(); + bool bCtrlClickHlink = SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::CtrlClickHyperlink); // "ctrl-click to follow link:" for not MacOS
core.git: sfx2/source
sfx2/source/doc/objstor.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 48bbdf24ebe3cf78199bf213ab5585a293dc40ae Author: Andreas Heinisch AuthorDate: Mon Jan 15 22:50:45 2024 +0100 Commit: Andreas Heinisch CommitDate: Tue Jan 16 10:57:33 2024 +0100 tdf#53614 - Don't try to lock file after cancelling the import process After cancelling the import process don't try to lock the file. Otherwise, the document in use dialog will be shown which has literally no effect. Change-Id: I0a9c786899a7fc648678c785e316d28fc43c7fe7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162150 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index a7253f7a0b83..854389ae31be 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -654,7 +654,9 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) EnableSetModified( false ); -pMedium->LockOrigFileOnDemand( true, false ); +// tdf#53614 - don't try to lock file after cancelling the import process +if (GetErrorIgnoreWarning() != ERRCODE_ABORT) +pMedium->LockOrigFileOnDemand( true, false ); if ( GetErrorIgnoreWarning() == ERRCODE_NONE && bOwnStorageFormat && ( !pFilter || !( pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) ) ) { uno::Reference< embed::XStorage > xStorage;
core.git: sfx2/source
sfx2/source/view/lokhelper.cxx | 59 +++-- 1 file changed, 28 insertions(+), 31 deletions(-) New commits: commit 1bc6a730ecb7db289e7f72db3c9bce4812e775ed Author: Aron Budea AuthorDate: Tue Jan 9 12:39:56 2024 +1030 Commit: Aron Budea CommitDate: Sun Jan 14 16:37:41 2024 +0100 lok: Replace loop with std::find_if(...) Change-Id: Icfe912f7b79454b9d208c39382ba187d0a0c16c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161810 Tested-by: Jenkins CollaboraOffice Reviewed-by: Attila Szűcs Reviewed-by: Aron Budea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162045 Tested-by: Jenkins diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 02cc7fe25230..2106168f459e 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -184,44 +184,41 @@ void SfxLokHelper::setView(int nId) const ViewShellId nViewShellId(nId); std::vector& rViewArr = pApp->GetViewShells_Impl(); -for (const SfxViewShell* pViewShell : rViewArr) -{ -if (pViewShell->GetViewShellId() == nViewShellId) -{ -DisableCallbacks dc; +const auto itViewShell = std::find_if(rViewArr.begin(), rViewArr.end(), [nViewShellId](SfxViewShell* pViewShell){ return pViewShell->GetViewShellId() == nViewShellId; }); +if (itViewShell == rViewArr.end()) +return; -bool bIsCurrShell = (pViewShell == SfxViewShell::Current()); -if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) -return; +const SfxViewShell* pViewShell = *itViewShell; +DisableCallbacks dc; -if (bIsCurrShell) -{ -// If we wanted to set the SfxViewShell that is actually set, we could skip it. -// But it looks like that the language can go wrong, so we have to fix that. -// This can happen, when someone sets the language or SfxViewShell::Current() separately. -SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" -<< comphelper::LibreOfficeKit::getLanguageTag().getBcp47() -<< " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); -} +bool bIsCurrShell = (pViewShell == SfxViewShell::Current()); +if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) +return; -// update the current LOK language and locale for the dialog tunneling - comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); -comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); +if (bIsCurrShell) +{ +// If we wanted to set the SfxViewShell that is actually set, we could skip it. +// But it looks like that the language can go wrong, so we have to fix that. +// This can happen, when someone sets the language or SfxViewShell::Current() separately. +SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" +<< comphelper::LibreOfficeKit::getLanguageTag().getBcp47() +<< " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); +} -if (bIsCurrShell) -return; +// update the current LOK language and locale for the dialog tunneling + comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); +comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); -SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); -rViewFrame.MakeActive_Impl(false); +if (bIsCurrShell) +return; -// Make comphelper::dispatchCommand() find the correct frame. -uno::Reference xFrame = rViewFrame.GetFrame().GetFrameInterface(); -uno::Reference xDesktop = frame::Desktop::create(comphelper::getProcessComponentContext()); -xDesktop->setActiveFrame(xFrame); -return; -} -} +SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); +rViewFrame.MakeActive_Impl(false); +// Make comphelper::dispatchCommand() find the correct frame. +uno::Reference xFrame = rViewFrame.GetFrame().GetFrameInterface(); +uno::Reference xDesktop = frame::Desktop::create(comphelper::getProcessComponentContext()); +xDesktop->setActiveFrame(xFrame); } SfxViewShell* SfxLokHelper::getViewOfId(int nId)
core.git: sfx2/source
sfx2/source/view/lokhelper.cxx | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) New commits: commit f97dc9d815ad8fdd75cbcd9c18b2e585ecf39ca5 Author: Attila Szűcs AuthorDate: Tue Jan 9 20:23:44 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Jan 11 20:47:30 2024 +0100 LOK: fix language warning in setView Made the warning before the new language set. This way we log the old (wrong) and new (good) language. Elseway we could save the old languages to a temporal variable, set the language, and do the warning with the saved variable, but i think the extra variables would be a waste of memory. Change-Id: I0b69f49d07e9130bf1538c2c8e1d0b09cf82091f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161841 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit e09b3f5f4cd662a596b5d8d6ad4d5e2778e315f4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161916 Tested-by: Jenkins diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 711e12209e8a..02cc7fe25230 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -194,10 +194,6 @@ void SfxLokHelper::setView(int nId) if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) return; -// update the current LOK language and locale for the dialog tunneling - comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); -comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); - if (bIsCurrShell) { // If we wanted to set the SfxViewShell that is actually set, we could skip it. @@ -206,9 +202,15 @@ void SfxLokHelper::setView(int nId) SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" << comphelper::LibreOfficeKit::getLanguageTag().getBcp47() << " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); -return; } +// update the current LOK language and locale for the dialog tunneling + comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); +comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); + +if (bIsCurrShell) +return; + SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); rViewFrame.MakeActive_Impl(false);
core.git: sfx2/source
sfx2/source/view/lokhelper.cxx | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) New commits: commit e78bce3c1dbef3bbc0a18d9c17e458a69c2a8e46 Author: Attila Szűcs AuthorDate: Fri Dec 1 15:20:58 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Jan 11 14:54:51 2024 +0100 LOK: fix setView language problem Fix some mis-localization problem by checking for wrong language at setView(...). setView does not change current localization, if the view we want to set is the current view. But in some cases the language - view is not in a consistent state. Maybe the language changed but the view did not, or the current view changed without language change (I found examples for both). Changed setView(...) so that it checks, if the current language matches to the current view, and if it does not, then we set the view, even if we want to set to the current view. This won't fix everything, but hopefully it helps a lot. I think we should make sure that current view - current Language are always changed at the same time (or at least we make sure they always match). Change-Id: Ie177b9b55f7befcbcf7cd1f62e402700f0e1aa60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160219 Reviewed-by: Andras Timar Tested-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161915 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index f21457e1b16d..711e12209e8a 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -190,13 +190,25 @@ void SfxLokHelper::setView(int nId) { DisableCallbacks dc; -if (pViewShell == SfxViewShell::Current()) +bool bIsCurrShell = (pViewShell == SfxViewShell::Current()); +if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) return; // update the current LOK language and locale for the dialog tunneling comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); +if (bIsCurrShell) +{ +// If we wanted to set the SfxViewShell that is actually set, we could skip it. +// But it looks like that the language can go wrong, so we have to fix that. +// This can happen, when someone sets the language or SfxViewShell::Current() separately. +SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" +<< comphelper::LibreOfficeKit::getLanguageTag().getBcp47() +<< " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); +return; +} + SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); rViewFrame.MakeActive_Impl(false);
core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e004c9dd2cc0da7f27503d14bfc13975889eea77 Author: Matt K AuthorDate: Tue Jan 9 17:23:34 2024 -0600 Commit: Mike Kaganski CommitDate: Thu Jan 11 05:19:28 2024 +0100 tdf#158937 Allow cancel of password dialog during recovery The problem is that when a user cancels the password dialog during recovery, the code tries to do something with the doc, but there is no doc yet because the file is password protected and not opened, so it crashes. The fix is just to check for the absence of errors before using the doc (canceling the password dialog is considered an abort/ general IO error). Change-Id: Ia76d8e4ff8212427d6b7b0a67ce1971b9ea8a48d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161844 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a996259f3598..3da83626a5ea 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2026,7 +2026,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA if( m_pData->m_pObjectShell->IsAbortingImport() ) nError = ERRCODE_ABORT; -if( bSalvage ) +if (bSalvage && nError == ERRCODE_NONE) { // file recovery: restore original filter const SfxStringItem* pFilterItem = pMedium->GetItemSet().GetItem(SID_FILTER_NAME, false);
core.git: sfx2/source
sfx2/source/dialog/StyleList.cxx | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) New commits: commit 6c0081f3cd37541f8c0fe0fba69cc38c9b0a229b Author: Jim Raykowski AuthorDate: Tue Jan 9 17:44:31 2024 -0900 Commit: Jim Raykowski CommitDate: Wed Jan 10 16:57:24 2024 +0100 tdf#158992 Only show style spotlight for styles that are used in order to reduce visual clutter Change-Id: I23ab3119fcb1dde0079db4cebb9fc4460ccb76bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161847 Tested-by: Jenkins Reviewed-by: Jim Raykowski diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index e7bdd9e3b4a3..888d03c4ee30 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -735,19 +735,27 @@ static void lcl_Insert(weld::TreeView& rTreeView, const OUString& rName, SfxStyl static void FillBox_Impl(weld::TreeView& rBox, StyleTree_Impl* pEntry, const std::vector& rEntries, SfxStyleFamily eStyleFamily, - const weld::TreeIter* pParent, bool blcl_insert, SfxViewShell* pViewShell) + const weld::TreeIter* pParent, bool blcl_insert, SfxViewShell* pViewShell, + SfxStyleSheetBasePool* pStyleSheetPool) { std::unique_ptr xResult = rBox.make_iterator(); const OUString& rName = pEntry->getName(); - if (blcl_insert) -lcl_Insert(rBox, rName, eStyleFamily, pParent, xResult.get(), pViewShell); +{ +const SfxStyleSheetBase* pStyle = nullptr; +if (pStyleSheetPool) +pStyle = pStyleSheetPool->Find(rName, eStyleFamily); +if (pStyle && pStyle->IsUsed()) +lcl_Insert(rBox, rName, eStyleFamily, pParent, xResult.get(), pViewShell); +else +rBox.insert(pParent, -1, , , nullptr, nullptr, false, xResult.get()); +} else rBox.insert(pParent, -1, , , nullptr, nullptr, false, xResult.get()); for (size_t i = 0; i < pEntry->getChildren().size(); ++i) FillBox_Impl(rBox, pEntry->getChildren()[i].get(), rEntries, eStyleFamily, xResult.get(), - blcl_insert, pViewShell); + blcl_insert, pViewShell, pStyleSheetPool); } namespace SfxTemplate @@ -1046,7 +1054,8 @@ void StyleList::FillTreeBox(SfxStyleFamily eFam) for (sal_uInt16 i = 0; i < nCount; ++i) { -FillBox_Impl(*m_xTreeBox, aArr[i].get(), aEntries, eFam, nullptr, blcl_insert, pViewShell); +FillBox_Impl(*m_xTreeBox, aArr[i].get(), aEntries, eFam, nullptr, blcl_insert, pViewShell, + m_pStyleSheetPool); aArr[i].reset(); } @@ -1241,7 +1250,13 @@ void StyleList::UpdateStyles(StyleFlags nFlags) || (eFam == SfxStyleFamily::Char && m_bHighlightCharStyles))) { for (nPos = 0; nPos < nCount; ++nPos) -lcl_Insert(*m_xFmtLb, aStrings[nPos], eFam, nullptr, nullptr, pViewShell); +{ +pStyle = m_pStyleSheetPool->Find(aStrings[nPos], eFam); +if (pStyle && pStyle->IsUsed()) +lcl_Insert(*m_xFmtLb, aStrings[nPos], eFam, nullptr, nullptr, pViewShell); +else +m_xFmtLb->append(aStrings[nPos], aStrings[nPos]); +} } else {
core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx | 16 1 file changed, 8 insertions(+), 8 deletions(-) New commits: commit 79e8f18f635dfd094485ed18166fd8b04c37862c Author: Michael Stahl AuthorDate: Tue Jan 9 16:44:50 2024 +0100 Commit: Michael Stahl CommitDate: Tue Jan 9 17:43:18 2024 +0100 sfx2: reorder the checks in SfxBaseModel::postEvent_Impl() It doesn't make sense to copy m_pData after impl_isDisposed() checks if it's null (not sure if this makes a difference in practice). Change-Id: I5c6db0bd3e09f92acef346115a4fee44ae4c0a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161835 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 985af531358d..a996259f3598 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3303,18 +3303,19 @@ public: void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame::XController2 >& xController, const Any& supplement ) { -// object already disposed? -if ( impl_isDisposed() ) +if (aName.isEmpty()) +{ +SAL_WARN("sfx.doc", "postEvent_Impl: Empty event name!"); return; - -// keep m_pData alive, if notified target would dispose the document -std::shared_ptr xKeepAlive(m_pData); +} // also make sure this object doesn't self-destruct while notifying rtl::Reference xHoldAlive(this); +// keep m_pData alive, if notified target would dispose the document +std::shared_ptr xKeepAlive(m_pData); -DBG_ASSERT( !aName.isEmpty(), "Empty event name!" ); -if (aName.isEmpty()) +// object already disposed? +if ( impl_isDisposed() ) return; if ( xKeepAlive->m_aDocumentEventListeners2.getLength() ) @@ -3340,7 +3341,6 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame ::XEventListener::notifyEvent, aEvent ) ); } - } Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData()
core.git: sfx2/source
sfx2/source/control/bindings.cxx | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) New commits: commit fb7b0b944741e4efae8d92a6e305036aff906c7a Author: Miklos Vajna AuthorDate: Mon Jan 8 16:25:44 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Jan 9 07:08:55 2024 +0100 cool#7492 sfx2 lok: just set language/locale on async binding update Trying to run online.git tests against commit 51d8a2ef54751403fa707816e27ddb4e7faa8231 (cool#7492 sfx2 lok: fix bad view id / statusbar string on async binding update, 2024-01-08), unit-tiletest failed. Manually trying to replace what the testSimultaneousTilesRenderedJustOnce test in that suite tries to do, it turned out that it can happen that the bindings are updated when a Writer view gets its focus, which is a problem, because the above commit started to switch views on binding updates, leading to a loop (bindings are updated about every second). Fix the problem by doing less work in SfxBindings::NextJob(): it's enough if the timer just switches languages and not views. That still keeps the Calc statusbar problem fixed from the above commit, but avoids the problematic view switching that broke unit-tiletest. Change-Id: I22cd9b3276c3f9987a2d90ad93f6026fdf6b8448 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161792 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 95823f8bde4d..8eb8f2f78689 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1215,26 +1215,28 @@ void SfxBindings::UpdateControllers_Impl IMPL_LINK( SfxBindings, NextJob, Timer *, pTimer, void ) { bool bSetView = false; -int nOldId = -1; +SfxViewShell* pOldShell = nullptr; if (comphelper::LibreOfficeKit::isActive() && pDispatcher) { SfxViewFrame* pFrame = pDispatcher->GetFrame(); -SfxViewShell* pShell = pFrame ? pFrame->GetViewShell() : nullptr; -int nNewId = SfxLokHelper::getView(pShell); -nOldId = SfxLokHelper::getView(); -if (nNewId != -1 && nNewId != nOldId) +SfxViewShell* pNewShell = pFrame ? pFrame->GetViewShell() : nullptr; +pOldShell = SfxViewShell::Current(); +if (pNewShell && pNewShell != pOldShell) { -// The current view ID is not the one that belongs to this frame, switch to it. -SfxLokHelper::setView(nNewId); +// The current view ID is not the one that belongs to this frame, update +// language/locale. + comphelper::LibreOfficeKit::setLanguageTag(pNewShell->GetLOKLanguageTag()); +comphelper::LibreOfficeKit::setLocale(pNewShell->GetLOKLocale()); bSetView = true; } } NextJob_Impl(pTimer); -if (bSetView) +if (bSetView && pOldShell) { -SfxLokHelper::setView(nOldId); + comphelper::LibreOfficeKit::setLanguageTag(pOldShell->GetLOKLanguageTag()); +comphelper::LibreOfficeKit::setLocale(pOldShell->GetLOKLocale()); } }
core.git: sfx2/source
sfx2/source/appl/sfxpicklist.cxx |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 1f6d845e10737d6ad1fec1c0ff660baae0ce3f3c Author: Justin Luth AuthorDate: Fri Dec 10 19:01:04 2021 +0200 Commit: Michael Stahl CommitDate: Fri Jan 5 11:13:58 2024 +0100 tdf#139636 thumbnail: don't regenerate on file close Back in 2001, this might have been the primary time when the thumbnail was generated. Now it is also generated on file open and file-save. This bug report is at least one example why regenerating on exit is not desireable. But are there examples of why a thumbnail IS needed on file exit? One way the thumbnail can change is viewing track changes, since toggling track changes doesn't "modify" the document. What other things can affect the document layout without be considered a modification? Change-Id: Ic08fefadb7a2ff594dc2788dfc9cf9e0cc528a71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126649 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Michael Stahl diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index cb3b0d5872be..64ebcc1a342c 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -52,14 +52,14 @@ class SfxPickListImpl : public SfxListener certain requirements, e.g. being writable. Check implementation for requirement details. */ -static void AddDocumentToPickList( const SfxObjectShell* pDocShell ); +static void AddDocumentToPickList(const SfxObjectShell* pDocShell, bool bNoThumbnail = false); public: SfxPickListImpl(SfxApplication& rApp); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; }; -void SfxPickListImpl::AddDocumentToPickList( const SfxObjectShell* pDocSh ) +void SfxPickListImpl::AddDocumentToPickList(const SfxObjectShell* pDocSh, bool bNoThumbnail) { if (pDocSh->IsAvoidRecentDocs() || comphelper::LibreOfficeKit::isActive()) return; @@ -96,7 +96,7 @@ void SfxPickListImpl::AddDocumentToPickList( const SfxObjectShell* pDocSh ) // generate the thumbnail //fdo#74834: only generate thumbnail for history if the corresponding option is not disabled in the configuration -if (!pDocSh->IsModified() && !Application::IsHeadlessModeEnabled() && +if (!bNoThumbnail && !pDocSh->IsModified() && !Application::IsHeadlessModeEnabled() && officecfg::Office::Common::History::RecentDocsThumbnail::get()) { // not modified => the document matches what is in the shell @@ -198,7 +198,8 @@ void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) case SfxEventHintId::SaveToDocDone: case SfxEventHintId::CloseDoc: { -AddDocumentToPickList(pDocSh); +const bool bNoThumbnail = rEventHint.GetEventId() == SfxEventHintId::CloseDoc; +AddDocumentToPickList(pDocSh, bNoThumbnail); } break;
core.git: sfx2/source
sfx2/source/appl/app.cxx |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) New commits: commit c6a1b04932fe1a9867fcef695510d45f4992f1af Author: Caolán McNamara AuthorDate: Wed Jan 3 12:26:06 2024 + Commit: Caolán McNamara CommitDate: Thu Jan 4 11:36:39 2024 +0100 can reduce fuzzing code spam now Change-Id: Ia684e3c4f8e3f637f738143e8f45cb5152a2c9ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161597 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index f35698cced96..b37da185d3f2 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -114,11 +113,11 @@ SfxApplication* SfxApplication::GetOrCreate() #if HAVE_FEATURE_XMLHELP || defined(EMSCRIPTEN) bool bHelpTip = officecfg::Office::Common::Help::Tip::get(); bool bExtendedHelpTip = officecfg::Office::Common::Help::ExtendedTip::get(); -if (!comphelper::IsFuzzing() && bHelpTip) +if (bHelpTip) Help::EnableQuickHelp(); else Help::DisableQuickHelp(); -if (!comphelper::IsFuzzing() && bHelpTip && bExtendedHelpTip) +if (bHelpTip && bExtendedHelpTip) Help::EnableBalloonHelp(); else Help::DisableBalloonHelp();
core.git: sfx2/source
sfx2/source/dialog/backingwindow.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit fc03109024041ea00bb62e90975e9a20a3668101 Author: Heiko Tietze AuthorDate: Wed Jan 3 15:48:13 2024 +0100 Commit: Heiko Tietze CommitDate: Thu Jan 4 11:22:50 2024 +0100 Resolves tdf#158810 - Hide recent actions while in template mode Change-Id: I7291cc7a634a0507bb240bf417d346e7a50f3c6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161587 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 846fa2ffb70e..9e30572d12d3 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -593,7 +593,7 @@ IMPL_LINK( BackingWindow, ToggleHdl, weld::Toggleable&, rButton, void ) mxAllRecentThumbnails->GrabFocus(); mxRecentButton->set_active(true); mxTemplateButton->set_active(false); -mxActions->set_sensitive(true); +mxActions->show(); } else { @@ -604,7 +604,7 @@ IMPL_LINK( BackingWindow, ToggleHdl, weld::Toggleable&, rButton, void ) mxLocalView->GrabFocus(); mxRecentButton->set_active(false); mxTemplateButton->set_active(true); -mxActions->set_sensitive(false); +mxActions->hide(); } applyFilter(); }
core.git: sfx2/source
sfx2/source/doc/docfile.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0d5bd921a5a08607ec0b240463eff143f0b52fd0 Author: Julien Nabet AuthorDate: Sun Dec 31 12:16:03 2023 +0100 Commit: Julien Nabet CommitDate: Sun Dec 31 18:52:18 2023 +0100 Replace "size() == 0 with empty()" (sfx2) Change-Id: I6bdb18319e45fbe8641a2ded31e60c2628bb1b67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161468 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index b94d72307176..ff0fa9bf30c3 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -4928,7 +4928,7 @@ void CheckReadOnlyTask::doWork() g_existingReadOnlyDocs[pMed] = roEntry; it = g_newReadOnlyDocs.erase(it); } -if (g_existingReadOnlyDocs.size() == 0) +if (g_existingReadOnlyDocs.empty()) { g_bChkReadOnlyTaskRunning = false; return;
core.git: sfx2/source
sfx2/source/appl/app.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d4cbae02ecdd50ea31556bda967a1a0869530275 Author: Julien Nabet AuthorDate: Sun Dec 31 12:25:43 2023 +0100 Commit: Julien Nabet CommitDate: Sun Dec 31 16:37:02 2023 +0100 Replace "size() != 0 with !empty()" (sfx2) Change-Id: Ic841e85634d292758d2815aab1b3f7546ed2a6f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161486 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 488e622aa01e..f35698cced96 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -163,7 +163,7 @@ SfxApplication::SfxApplication() SfxApplication::~SfxApplication() { -SAL_WARN_IF(GetObjectShells_Impl().size() != 0, "sfx.appl", "Memory leak: some object shells were not removed!"); +SAL_WARN_IF(!GetObjectShells_Impl().empty(), "sfx.appl", "Memory leak: some object shells were not removed!"); Broadcast( SfxHint(SfxHintId::Dying) );
core.git: sfx2/source sfx2/uiconfig
sfx2/source/appl/sfxhelp.cxx | 71 +-- sfx2/source/inc/helpids.h |2 + sfx2/uiconfig/ui/helpmanual.ui | 82 + 3 files changed, 119 insertions(+), 36 deletions(-) New commits: commit c48952eb6b6f65affcda75ee74c292008be9c455 Author: Rafael Lima AuthorDate: Fri Aug 4 04:35:42 2023 +0200 Commit: Rafael Lima CommitDate: Fri Dec 15 18:17:32 2023 +0100 tdf#142926 Add button to Download page in Help dialog box Change-Id: Ie22dda17949d583a388d45e5aad3728b91637bff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155298 Reviewed-by: Heiko Tietze Tested-by: Jenkins Reviewed-by: Rafael Lima diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index b596a4e33efa..c67f1485497f 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -1011,22 +1012,33 @@ namespace { class HelpManualMessage : public weld::MessageDialogController { private: +std::unique_ptr m_xDownloadInfo; std::unique_ptr m_xHideOfflineHelpCB; +DECL_LINK(DownloadClickHdl, weld::LinkButton&, bool); public: HelpManualMessage(weld::Widget* pParent) -: MessageDialogController(pParent, "sfx/ui/helpmanual.ui", "onlinehelpmanual", "hidedialog") +: MessageDialogController(pParent, "sfx/ui/helpmanual.ui", "onlinehelpmanual", "box") +, m_xDownloadInfo(m_xBuilder->weld_link_button("downloadinfo")) , m_xHideOfflineHelpCB(m_xBuilder->weld_check_button("hidedialog")) { LanguageType aLangType = Application::GetSettings().GetUILanguageTag().getLanguageType(); OUString sLocaleString = SvtLanguageTable::GetLanguageString(aLangType); OUString sPrimText = get_primary_text(); set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString)); + +m_xDownloadInfo->connect_activate_link(LINK(this, HelpManualMessage, DownloadClickHdl)); } bool GetOfflineHelpPopUp() const { return !m_xHideOfflineHelpCB->get_active(); } }; +IMPL_LINK(HelpManualMessage, DownloadClickHdl, weld::LinkButton&, /* rButton */, bool) +{ +m_xDialog->response(RET_YES); +return true; +} + } bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) @@ -1138,6 +1150,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) if ( !impl_hasHelpInstalled() ) { bool bShowOfflineHelpPopUp = officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get(); +short retOnlineHelpBox = RET_CLOSE; TopLevelWindowLocker aBusy; @@ -1145,18 +1158,31 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) { aBusy.incBusy(pWeldWindow); HelpManualMessage aQueryBox(pWeldWindow); -short OnlineHelpBox = aQueryBox.run(); -bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK; +retOnlineHelpBox = aQueryBox.run(); auto xChanges = comphelper::ConfigurationChanges::create(); officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(aQueryBox.GetOfflineHelpPopUp(), xChanges); xChanges->commit(); aBusy.decBusy(); } -if(!bShowOfflineHelpPopUp) + +// Checks whether the user clicked "Read Help Online" (RET_OK) or "Information on downloading offline help" (RET_YES) +if(retOnlineHelpBox == RET_OK || retOnlineHelpBox == RET_YES) { -if ( impl_showOnlineHelp(aHelpURL, pWeldWindow) ) -return true; +bool bTopicExists; + +if (retOnlineHelpBox == RET_OK) +{ +bTopicExists = impl_showOnlineHelp(aHelpURL, pWeldWindow); +} else +{ +// Opens the help page that explains how to install offline help +OUString aOfflineHelpURL(CreateHelpURL_Impl(HID_HELPMANUAL_OFFLINE, "shared")); +impl_showOnlineHelp(aOfflineHelpURL, pWeldWindow); +bTopicExists = true; +} + +if (!bTopicExists) { aBusy.incBusy(pWeldWindow); NoHelpErrorBox aErrBox(pWeldWindow); @@ -1164,6 +1190,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) aBusy.decBusy(); return false; } +else +{ +return true; +} } else { @@ -1307,6 +1337,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt if (
core.git: sfx2/source
sfx2/source/doc/docfile.cxx | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) New commits: commit 1d2218690382374f3962de014b151dbac84a1446 Author: Michael Stahl AuthorDate: Thu Dec 14 12:30:30 2023 +0100 Commit: Michael Stahl CommitDate: Thu Dec 14 18:31:44 2023 +0100 tdf#105844 sfx2: add another consistency check SfxMedium::TryEncryptedInnerPackage() checks same mimetype of inner and outer package for ODF wholesome encryption. Change-Id: I8a5ef463c5f604a59573fb0f9e15453f22d867d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160767 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index adc22797f6c3..0cdbd884663b 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1722,7 +1723,8 @@ SfxMedium::TryEncryptedInnerPackage(uno::Reference const xStora xDecryptedInnerPackage = xStorage->openStreamElement( "encrypted-package", embed::ElementModes::READ | embed::ElementModes::NOCREATE); -assert(xDecryptedInnerPackage.is()); // just for testing? not if wrong pwd +// either this throws due to wrong password or IO error, or returns stream +assert(xDecryptedInnerPackage.is()); // need a seekable stream => copy Reference const xContext(::comphelper::getProcessComponentContext()); uno::Reference const xDecryptedInnerPackageStream( @@ -1740,11 +1742,22 @@ SfxMedium::TryEncryptedInnerPackage(uno::Reference const xStora SAL_DE BUG("AAA tempfile " << xTempFile->getResourceName()); uno::Reference(xDecryptedInnerPackageStream, uno::UNO_QUERY_THROW)->seek(0); #endif -// create storage, if this succeeds assume password is correct +// create inner storage; opening the stream should have already verified +// the password so any failure here is probably due to a bug xRet = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( PACKAGE_STORAGE_FORMAT_STRING, xDecryptedInnerPackageStream, embed::ElementModes::READWRITE, xContext, false); assert(xRet.is()); +// consistency check: outer and inner package must have same mimetype +OUString const outerMediaType(uno::Reference(pImpl->xStorage, + uno::UNO_QUERY_THROW)->getPropertyValue("MediaType").get()); +OUString const innerMediaType(uno::Reference(xRet, + uno::UNO_QUERY_THROW)->getPropertyValue("MediaType").get()); +if (outerMediaType.isEmpty() || outerMediaType != innerMediaType) +{ +throw io::WrongFormatException("MediaType inconsistent in encrypted ODF package"); +} +// success: pImpl->m_bODFWholesomeEncryption = true; pImpl->m_xODFDecryptedInnerPackageStream = xDecryptedInnerPackageStream; pImpl->m_xODFEncryptedOuterStorage = xStorage;
core.git: sfx2/source
sfx2/source/doc/docfile.cxx |3 --- 1 file changed, 3 deletions(-) New commits: commit df23f570536c939ab4b44125ac8f62a8500e6f7c Author: Michael Stahl AuthorDate: Wed Dec 13 19:49:23 2023 +0100 Commit: Michael Stahl CommitDate: Wed Dec 13 22:02:20 2023 +0100 sfx2: remove wrong asserts Mike Kaganski points out that "soffice -n anything.docx" triggers the one in GetOutStream(), called from SfxMedium::CreateTempFile() !bTransferSuccess path, so the assumption of which parts of SfxMedium can be in use concurrently was wrong. Change-Id: I40f321d71297cadcdf4bf9ba6f07c4db3d2ac523 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160712 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 319615bacd20..adc22797f6c3 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -678,7 +678,6 @@ bool SfxMedium::IsSkipImages() const SvStream* SfxMedium::GetInStream() { -//assert(!pImpl->xStorage); // either SvStream or Storage if ( pImpl->m_pInStream ) return pImpl->m_pInStream.get(); @@ -749,7 +748,6 @@ void SfxMedium::CloseInStream_Impl(bool bInDestruction) SvStream* SfxMedium::GetOutStream() { -assert(!pImpl->xStorage); // either SvStream or Storage if ( !pImpl->m_pOutStream ) { // Create a temp. file if there is none because we always @@ -1760,7 +1758,6 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempFile ) if ( pImpl->xStorage.is() || pImpl->m_bTriedStorage ) return pImpl->xStorage; -assert(!pImpl->m_pOutStream /*&& !pImpl->m_pInStream*/); // either SvStream or Storage uno::Sequence< uno::Any > aArgs( 2 ); auto pArgs = aArgs.getArray();
core.git: sfx2/source
sfx2/source/control/recentdocsviewitem.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 152e10996fe9c788daec940bab6fe897097ba992 Author: Michael Stahl AuthorDate: Wed Dec 13 12:55:48 2023 +0100 Commit: Michael Stahl CommitDate: Wed Dec 13 17:49:24 2023 +0100 sfx2: reduce warning spam from IsDocEncrypted() Change-Id: I76b9d550c297db7c6f8d1d9a2739fbe050727faf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160680 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index 369e219e98c5..c114be951cfc 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -65,7 +65,7 @@ bool IsDocEncrypted(const OUString& rURL) } catch (const uno::Exception&) { -TOOLS_WARN_EXCEPTION("sfx", "caught exception trying to find out if doc <" +TOOLS_INFO_EXCEPTION("sfx", "caught exception trying to find out if doc <" << rURL << "> is encrypted:"); }
core.git: sfx2/source tools/source
sfx2/source/doc/docfile.cxx|3 ++- sfx2/source/doc/objmisc.cxx|2 +- tools/source/stream/stream.cxx |2 +- 3 files changed, 4 insertions(+), 3 deletions(-) New commits: commit b4fda935deaec67ccadf937d6a9604e60e0f51ea Author: Mike Kaganski AuthorDate: Sun Dec 10 11:57:35 2023 +0300 Commit: Mike Kaganski CommitDate: Sun Dec 10 12:38:17 2023 +0100 Keep original error Fix several SetError implementations, to make sure that original errors are not rewritten, but OTOH warnings could be replaced by errors. Change-Id: Ic5e71b791ff3426ff1144778a610ab77fcbf24d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160530 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 411c980b6e09..319615bacd20 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -508,7 +508,8 @@ ErrCodeMsg const & SfxMedium::GetLastStorageCreationState() const void SfxMedium::SetError(ErrCodeMsg nError) { -pImpl->m_eError = nError; +if (pImpl->m_eError == ERRCODE_NONE || (pImpl->m_eError.IsWarning() && nError.IsError())) +pImpl->m_eError = nError; } void SfxMedium::SetWarningError(const ErrCodeMsg& nWarningError) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 5b7aa98df38e..08a8ec0797b8 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -215,7 +215,7 @@ std::vector& SfxObjectShell::getPendingInfobars() void SfxObjectShell::SetError(const ErrCodeMsg& lErr) { -if (pImpl->lErr==ERRCODE_NONE) +if (pImpl->lErr == ERRCODE_NONE || (pImpl->lErr.IsWarning() && lErr.IsError())) { pImpl->lErr=lErr; } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 6318348de5ec..f5ddabac548d 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -355,7 +355,7 @@ void SvStream::ClearError() void SvStream::SetError( ErrCode nErrorCode ) { -if (m_nError == ERRCODE_NONE) +if (m_nError == ERRCODE_NONE || (m_nError.IsWarning() && nErrorCode.IsError())) m_nError = nErrorCode; }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/view/viewsh.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 97d3389f32a24f06113aad37058d24f2cbbc3026 Author: Caolán McNamara AuthorDate: Fri Dec 1 11:52:27 2023 + Commit: Caolán McNamara CommitDate: Fri Dec 1 18:07:00 2023 +0100 cid#1557920 COPY_INSTEAD_OF_MOVE a sample commit to test this Change-Id: Ibc1a1f75b908e245395a05e81c26158c67e36257 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160214 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index ce3b6c5dd694..fd7a21931c4f 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1243,8 +1243,7 @@ LOKDocumentFocusListener::getSelectedObject(const accessibility::AccessibleEvent uno::Reference< accessibility::XAccessible > xSelectedObject; if (isText(m_nDocumentType)) { -uno::Reference< accessibility::XAccessible > xSource(aEvent.Source, uno::UNO_QUERY); -xSelectedObject = xSource; +xSelectedObject = uno::Reference(aEvent.Source, uno::UNO_QUERY); } else {
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docfile.cxx | 36 1 file changed, 16 insertions(+), 20 deletions(-) New commits: commit ef79b9c55828d39de3d86cedd125f2f32e6b259a Author: Mike Kaganski AuthorDate: Sun Nov 26 00:23:39 2023 +0300 Commit: Mike Kaganski CommitDate: Sun Nov 26 18:17:07 2023 +0100 *DocumentLockFile ctor may throw ... e.g., when passed URL is invalid, as seen after opening https://bugs.documentfoundation.org/attachment.cgi?id=121217 using "Office Open XML Text" filter, which sets "RepairPackage" in the media descriptor, which makes the opened file unnamed. Since the code is called from SfxMedium dtor, this crashed on closing this file. Change-Id: I95f6b16f1421abd55e6739ed431878bb72cf3a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159964 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 3b975bb1add9..42fe7d72b8c5 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3227,23 +3227,21 @@ void SfxMedium::UnlockFile( bool bReleaseLockStream ) if ( !pImpl->m_bLocked ) return; -::svt::DocumentLockFile aLockFile( pImpl->m_aLogicName ); - try { -pImpl->m_bLocked = false; -// TODO/LATER: A warning could be shown in case the file is not the own one -aLockFile.RemoveFile(); -} -catch( const io::WrongFormatException& ) -{ +::svt::DocumentLockFile aLockFile(pImpl->m_aLogicName); + try +{ +pImpl->m_bLocked = false; +// TODO/LATER: A warning could be shown in case the file is not the own one +aLockFile.RemoveFile(); +} +catch (const io::WrongFormatException&) { // erase the empty or corrupt file aLockFile.RemoveFileDirectly(); } -catch( const uno::Exception& ) -{} } catch( const uno::Exception& ) {} @@ -3251,23 +3249,21 @@ void SfxMedium::UnlockFile( bool bReleaseLockStream ) if(!pImpl->m_bMSOLockFileCreated) return; -::svt::MSODocumentLockFile aMSOLockFile( pImpl->m_aLogicName ); - try { -pImpl->m_bLocked = false; -// TODO/LATER: A warning could be shown in case the file is not the own one -aMSOLockFile.RemoveFile(); -} -catch( const io::WrongFormatException& ) -{ +::svt::MSODocumentLockFile aMSOLockFile(pImpl->m_aLogicName); + try +{ +pImpl->m_bLocked = false; +// TODO/LATER: A warning could be shown in case the file is not the own one +aMSOLockFile.RemoveFile(); +} +catch (const io::WrongFormatException&) { // erase the empty or corrupt file aMSOLockFile.RemoveFileDirectly(); } -catch( const uno::Exception& ) -{} } catch( const uno::Exception& ) {}
[Libreoffice-commits] core.git: sfx2/source sw/source
sfx2/source/appl/appserv.cxx |9 + sw/source/uibase/wrtsh/wrtsh2.cxx |5 + 2 files changed, 10 insertions(+), 4 deletions(-) New commits: commit d7b33b1be8fee684e906f170f4001735c095056e Author: Caolán McNamara AuthorDate: Thu Nov 23 08:53:30 2023 + Commit: Caolán McNamara CommitDate: Thu Nov 23 11:48:55 2023 +0100 use SID_DOCFRAME for dialog parents if there is no SID_FILLFRAME if there is no other hint which avoids: sfx2/source/appl/appserv.cxx:314: no parent for dialogs without the need to add extra SID_FILLFRAME just to smuggle a default parent in. Change-Id: I99980c951a0046afa3cc22e02b4f79850e3b2736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159850 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index d58b62a9bf3b..9c1b3c9d2a57 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -256,6 +256,13 @@ namespace return xFrame; } +Reference GetDocFrame(const SfxRequest& rReq) +{ +const SfxFrameItem* pFrameItem = rReq.GetArg(SID_DOCFRAME); +SfxFrame* pFrame = pFrameItem ? pFrameItem->GetFrame() : nullptr; +return pFrame ? pFrame->GetFrameInterface() : nullptr; +} + class LicenseDialog : public weld::GenericDialogController { public: @@ -309,6 +316,8 @@ weld::Window* SfxRequest::GetFrameWeld() const } Reference xFrame(GetRequestFrame(*this)); +if (!xFrame) +xFrame = GetDocFrame(*this); if (!xFrame) { SAL_WARN("sfx.appl", "no parent for dialogs"); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 029b728bb30a..3a9e51136fd0 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -597,8 +597,6 @@ static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, if ((nFilter & LoadUrlFlags::NewView) && !comphelper::LibreOfficeKit::isActive()) aTargetFrameName.SetValue( "_blank" ); -SfxUnoFrameItem aDocFrame(SID_FILLFRAME, rViewFrame.GetFrame().GetFrameInterface()); - rViewFrame.GetDispatcher()->ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON|SfxCallMode::RECORD, { @@ -607,8 +605,7 @@ static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, , , , -}, -{ } ); +}); } void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objstor.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 630ea24fa493be653686689b63692c104f2b0ae5 Author: Caolán McNamara AuthorDate: Fri Nov 10 19:14:18 2023 + Commit: Caolán McNamara CommitDate: Fri Nov 10 21:35:48 2023 +0100 ofz#64065 Abrt on config Change-Id: Idb76d58ab6036c9f38b0b76a3a240dcfb07d52a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159310 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 920e4476ab62..b39b5d14ee38 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3770,7 +3770,7 @@ void SfxObjectShell::SetMacroCallsSeenWhileLoading() bool SfxObjectShell::GetMacroCallsSeenWhileLoading() const { -if (officecfg::Office::Common::Security::Scripting::CheckDocumentEvents::get()) +if (utl::ConfigManager::IsFuzzing() || officecfg::Office::Common::Security::Scripting::CheckDocumentEvents::get()) return pImpl->m_bMacroCallsSeenWhileLoading; return false; }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) New commits: commit 7a73eedf00541b5ba56b81e7d78faef4247f046f Author: Mike Kaganski AuthorDate: Thu Nov 9 16:12:45 2023 +0300 Commit: Mike Kaganski CommitDate: Thu Nov 9 18:37:26 2023 +0100 Fix USE_CONFIG_APPROVE_CONFIRMATION and USE_CONFIG_REJECT_CONFIRMATION They still showed UI in case of signed macros. Two decisions were made, to improve security of USE_CONFIG_APPROVE_CONFIRMATION: 1. In case of High macro security mode, valid but untrusted certificate will be automatically rejected (because it is not safe to automatically add trusted certificates) - so in this mode, USE_CONFIG_APPROVE_CONFIRMATION is the same as USE_CONFIG_REJECT_CONFIRMATION; 2. In case of Medium macro security mode, valid but untrusted certificate will not automatically allow macros execution, but will proceed to the following checks - which on Windows will try to check the source's Security Zone, and may disallow macros based on that. Only after Security Zone check the macros will be automatically allowed. Change-Id: I1a9c92c6b940b689599c5d106798ecfc691dad46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159214 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index d64b0b60697f..4e9311593aed 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -213,9 +213,12 @@ namespace sfx2 // should not ask any confirmations. FROM_LIST_AND_SIGNED_WARN should only allow // trusted signed macros at this point; so it may only ask for confirmation to add // certificates to trusted, and shouldn't show UI when trusted list is read-only. -const bool bAllowUI = nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN - && (nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE - || !SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::MacroTrustedAuthors)); +const bool bAllowUI += nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN + && eAutoConfirm == eNoAutoConfirm + && (nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE + || !SvtSecurityOptions::IsReadOnly( + SvtSecurityOptions::EOption::MacroTrustedAuthors)); const bool bHasTrustedMacroSignature = m_xData->m_rDocumentAccess.hasTrustedScriptingSignature(bAllowUI ? rxInteraction : nullptr); if (bHasTrustedMacroSignature) @@ -227,9 +230,20 @@ namespace sfx2 || nSignatureState == SignatureState::NOTVALIDATED ) { // there is valid signature, but it is not from the trusted author -// this case includes explicit reject from user in the UI in cases of -// FROM_LIST_AND_SIGNED_WARN and ALWAYS_EXECUTE -return disallowMacroExecution(); +if (eAutoConfirm == eAutoConfirmApprove +&& nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE) +{ +// For ALWAYS_EXECUTE + eAutoConfirmApprove (USE_CONFIG_APPROVE_CONFIRMATION +// in Medium security mode), do not approve it right here; let Security Zone +// check below do its job first. +} +else +{ +// All other cases of valid but untrusted signatures should result in denied +// macros here. This includes explicit reject from user in the UI in cases +// of FROM_LIST_AND_SIGNED_WARN and ALWAYS_EXECUTE +return disallowMacroExecution(); +} } // Other values of nSignatureState would result in either rejected macros // (FROM_LIST_AND_SIGNED_*), or a confirmation.
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/appl/linksrc.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit ef5828fb45e2b46a36b73260232dede3d98e22a4 Author: Szymon Kłos AuthorDate: Mon Nov 6 18:35:20 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Nov 9 09:40:40 2023 +0100 lok: fix crash on DDE Link modify 1. Open document with editable DDE Link section in 2 views 2. View A selects content containing section and copies that 3. View A is closed 4. View B tries to modify section Result: crash Avoid destroying SwTransferDdeLink in SwTransferable::~SwTransferable() what happens while calling RemoveDDELinkFormat in SwTransferDdeLink::DataChanged by keeping reference to it while iterating in SvLinkSource::NotifyDataChanged() Change-Id: Iba53a4c139f9d508d2f64bcc94b479761b84bf2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159040 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index 131992c51040..3a1af228f6a4 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -287,7 +287,8 @@ void SvLinkSource::NotifyDataChanged() if( ( p->nAdviseModes & ADVISEMODE_NODATA ) || GetData( aVal, p->aDataMimeType, true ) ) { -p->xSink->DataChanged( p->aDataMimeType, aVal ); +tools::SvRef xLink(p->xSink); +xLink->DataChanged( p->aDataMimeType, aVal ); if ( !aIter.IsValidCurrValue( p ) ) continue;
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/control/dispatch.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit a6f26b87a0c6b0bb7a92ed0878e7aaa57ec64260 Author: Szymon Kłos AuthorDate: Tue Nov 7 11:18:04 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 9 08:41:34 2023 +0100 lok: notebookbar: fix unit-copy-paste in online we can't remove hack in SfxDispatcher::Update_Impl yet because this made unit-copy-paste test in online broken reverts part of: commit 1a6d16cb14342f9a66f99960e96027af6e5369ef lok: notebookbar: query SID_NOTEBOOKBAR only when requested to switch UI Signed-off-by: Szymon Kłos Change-Id: I8cd801bbc912f2ab3f710f5c7133445f07c4e5de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159039 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 9134f8da574d..6a492bffda7e 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1120,8 +1120,7 @@ void SfxDispatcher::Update_Impl( bool bForce ) if ( xLayoutManager.is() ) xLayoutManager->unlock(); -if ( !comphelper::LibreOfficeKit::isActive() && -SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() ) +if ( SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() ) { const SfxPoolItem *pItem; SfxViewShell::Current()->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, pItem);
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) New commits: commit bfba46d90fc4146ab2a48d155d90dafc8c0a067e Author: Mike Kaganski AuthorDate: Wed Nov 8 10:17:42 2023 +0300 Commit: Mike Kaganski CommitDate: Wed Nov 8 16:23:12 2023 +0100 Simplify a bit Change-Id: I05ef5346f5aab25b208aa058658353cf71e68e87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159103 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index ec23ebe62578..377c14517586 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -227,23 +227,17 @@ namespace sfx2 return disallowMacroExecution(); } } - -// at this point it is clear that the document is neither in secure location nor signed with trusted certificate -if ( ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN ) -|| ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN ) -) -{ -return disallowMacroExecution(); -} } catch ( const Exception& ) { -if ( ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN ) -|| ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN ) -) -{ -return disallowMacroExecution(); -} +DBG_UNHANDLED_EXCEPTION("sfx.doc"); +} + +// at this point it is clear that the document is neither in secure location nor signed with trusted certificate +if ((nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN) +|| (nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN)) +{ +return disallowMacroExecution(); } #if defined(_WIN32)
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit f0df7c7c7fd4109937f21c2278f9a57e59c73761 Author: Mike Kaganski AuthorDate: Wed Nov 8 10:14:13 2023 +0300 Commit: Mike Kaganski CommitDate: Wed Nov 8 16:22:57 2023 +0100 FROM_LIST_NO_WARN was handled above Change-Id: I88da25f5f2819edd78fb95573c619cd8e3187469 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159102 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index e2c1150c33ef..ec23ebe62578 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -238,8 +238,7 @@ namespace sfx2 } catch ( const Exception& ) { -if ( ( nMacroExecutionMode == MacroExecMode::FROM_LIST_NO_WARN ) -|| ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN ) +if ( ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN ) || ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN ) ) {
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 85a8c29e26f0bf48906312103e57246685d32c7e Author: Mike Kaganski AuthorDate: Wed Nov 8 09:35:46 2023 +0300 Commit: Mike Kaganski CommitDate: Wed Nov 8 16:22:00 2023 +0100 tdf#158090: Limit signed document requirement to High security level Commit 1dc71daf7fa7204a98c75dac680af664ab9c8edb (Improve macro checks, 2021-01-28) introduced a new requirement, that trusted macro signature must be accompanied by valid document signature when the document has events calling macros, otherwise macros are not allowed. But this breaks multiple workflows, where security level is set to limit users' ability to run unsigned macros, where documents aren't signed. As the first step, limit the security hardening introduced in the said commit to High security level; in Medium security level, restore the previous behavior. The plan is to fix more inconsistencies later, and then introduce a new separate configuration to require document signature to allow trusted macros (enabled by default), so that the combination of its default value and the High default security level keep the hardened default security implemented currently, while allowing users to opt to the previous documented behavior. Change-Id: I71ff0e531f3a42fbee7828982e4fd39f0e9d6ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159101 Tested-by: Mike Kaganski Reviewed-by: Thorsten Behrens diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index ef9546365451..e2c1150c33ef 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -207,9 +207,9 @@ namespace sfx2 { return disallowMacroExecution(); } -else if ( m_xData->m_rDocumentAccess.macroCallsSeenWhileLoading() && - bHasTrustedMacroSignature && - !bHasValidContentSignature) +else if (nMacroExecutionMode != MacroExecMode::ALWAYS_EXECUTE + && m_xData->m_rDocumentAccess.macroCallsSeenWhileLoading() + && bHasTrustedMacroSignature && !bHasValidContentSignature) { // When macros are signed, and the document has events which call macros, the document content needs to be signed too. m_xData->m_bHasUnsignedContentError = true;
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit cc948bae82e63928a70451c6e71beb67e07f06e4 Author: Mike Kaganski AuthorDate: Wed Nov 8 09:32:58 2023 +0300 Commit: Mike Kaganski CommitDate: Wed Nov 8 11:39:34 2023 +0100 Add comments for the magic constants Change-Id: Ic35758357c18c9d172532819a3e8968fd66b26ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159100 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index e3fe09c35feb..ef9546365451 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -141,16 +141,16 @@ namespace sfx2 switch ( SvtSecurityOptions::GetMacroSecurityLevel() ) { -case 3: +case 3: // "Very high" nMacroExecutionMode = MacroExecMode::FROM_LIST_NO_WARN; break; -case 2: +case 2: // "High" nMacroExecutionMode = MacroExecMode::FROM_LIST_AND_SIGNED_WARN; break; -case 1: +case 1: // "Medium" nMacroExecutionMode = MacroExecMode::ALWAYS_EXECUTE; break; -case 0: +case 0: // "Low" nMacroExecutionMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN; break; default:
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 505f97b5b23954d689d55640977da6ec1af523b9 Author: Mike Kaganski AuthorDate: Tue Nov 7 13:38:33 2023 +0300 Commit: Mike Kaganski CommitDate: Tue Nov 7 17:38:33 2023 +0100 Add a description comment Basically describing commit 71c6f438cecc3ce5e8060efe1df840652885701c (tdf#129311 don't allow temporary trusted certs, 2019-12-17). Change-Id: I4d947014b09412638560e9249f242cf6ff222cc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159069 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index ec56e3f529e7..637f137866ba 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -189,6 +189,13 @@ namespace sfx2 // check whether the document is signed with trusted certificate if ( nMacroExecutionMode != MacroExecMode::FROM_LIST ) { +// At this point, the possible values of nMacroExecutionMode are: ALWAYS_EXECUTE, +// FROM_LIST_AND_SIGNED_WARN (the default), FROM_LIST_AND_SIGNED_NO_WARN. +// ALWAYS_EXECUTE corresponds to the Medium security level; it should ask for +// confirmation when macros are unsigned or untrusted. FROM_LIST_AND_SIGNED_NO_WARN +// should not ask any confirmations. FROM_LIST_AND_SIGNED_WARN should only allow +// trusted signed macros at this point; so it may only ask for confirmation to add +// certificates to trusted, and shouldn't show UI when trusted list is read-only. // the trusted macro check will also retrieve the signature state ( small optimization ) const bool bAllowUI = nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN && (nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/appl/openuriexternally.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 518df6a3bd6aa251dc4ad30ab3d04545513ae5c6 Author: Caolán McNamara AuthorDate: Tue Nov 7 12:35:47 2023 + Commit: Caolán McNamara CommitDate: Tue Nov 7 14:53:08 2023 +0100 make this a more straight forward yes/no question instead of an ok/cancel, and default to no Change-Id: If86ca1b29d0dd91018fdc8edd6482a6d9ef5c0e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159068 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index 680c2796bafa..bdf8d72766cc 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -94,10 +94,11 @@ IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void) SolarMutexGuard g; std::unique_ptr eb( Application::CreateMessageDialog( -mpDialogParent, VclMessageType::Warning, VclButtonsType::OkCancel, +mpDialogParent, VclMessageType::Warning, VclButtonsType::YesNo, SfxResId(STR_DANGEROUS_TO_OPEN))); eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", INetURLObject::decode(msURI, INetURLObject::DecodeMechanism::Unambiguous))); -if (eb->run() == RET_OK) { +eb->set_default_response(RET_NO); +if (eb->run() == RET_YES) { flags = 0; continue; }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 6313e83a6f03540c1256e1e433cdf81b0913ff82 Author: Mike Kaganski AuthorDate: Tue Nov 7 10:55:48 2023 +0300 Commit: Mike Kaganski CommitDate: Tue Nov 7 13:26:09 2023 +0100 Rename variable: The UI is not only to "add" author (i.e., modify config) It is mainly to allow macro execution for this unknown certificate once. The UI will even disable the option to add, when the config is read-only. Change-Id: Iebc526c23572dc7c0e94fac79fafc8b402d451c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159051 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index 77c3e4ca22f9..ec56e3f529e7 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -190,10 +190,10 @@ namespace sfx2 if ( nMacroExecutionMode != MacroExecMode::FROM_LIST ) { // the trusted macro check will also retrieve the signature state ( small optimization ) -const bool bAllowUIToAddAuthor = nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN +const bool bAllowUI = nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN && (nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE || !SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::MacroTrustedAuthors)); -const bool bHasTrustedMacroSignature = m_xData->m_rDocumentAccess.hasTrustedScriptingSignature(bAllowUIToAddAuthor); +const bool bHasTrustedMacroSignature = m_xData->m_rDocumentAccess.hasTrustedScriptingSignature(bAllowUI); SignatureState nSignatureState = m_xData->m_rDocumentAccess.getScriptingSignatureState(); if ( nSignatureState == SignatureState::BROKEN )
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit deeb9a9ea982501761e4d1b9118eea76f386f86e Author: Mike Kaganski AuthorDate: Tue Nov 7 10:09:23 2023 +0300 Commit: Mike Kaganski CommitDate: Tue Nov 7 13:25:26 2023 +0100 getCurrentMacroExecMode returns sal_Int16 And that conforms the IDL definition of css::document::MacroExecMode Change-Id: I78ebfa94eb50552e7f4ecf3d64a0ac0556c56867 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159029 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index e25e97505181..77c3e4ca22f9 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -111,7 +111,7 @@ namespace sfx2 bool DocumentMacroMode::adjustMacroMode( const Reference< XInteractionHandler >& rxInteraction, bool bHasValidContentSignature ) { -sal_uInt16 nMacroExecutionMode = m_xData->m_rDocumentAccess.getCurrentMacroExecMode(); +sal_Int16 nMacroExecutionMode = m_xData->m_rDocumentAccess.getCurrentMacroExecMode(); if ( SvtSecurityOptions::IsMacroDisabled() ) {
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docmacromode.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit 7842c935e056c243e87856b93714b0f38eddab2c Author: Mike Kaganski AuthorDate: Mon Nov 6 21:32:01 2023 +0300 Commit: Mike Kaganski CommitDate: Tue Nov 7 05:22:05 2023 +0100 Simplify a bit XDocumentDigitalSignatures::isLocationTrusted would remove segments itself, as needed; this change not only simplifies this code, but also potentially allows to define not only trusted directories, but also individuals trusted files (if the UI would be adjusted). Change-Id: I0b0d60946d84a52479fcce5ce49d368cf53283fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159009 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index 283b7cd49bd2..e25e97505181 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -173,9 +173,7 @@ namespace sfx2 Reference< XDocumentDigitalSignatures > xSignatures(DocumentDigitalSignatures::createDefault(::comphelper::getProcessComponentContext())); INetURLObject aURLReferer(sURL); -OUString aLocation; -if ( aURLReferer.removeSegment() ) -aLocation = aURLReferer.GetMainURL( INetURLObject::DecodeMechanism::NONE ); +OUString aLocation = aURLReferer.GetMainURL( INetURLObject::DecodeMechanism::NONE ); if ( !aLocation.isEmpty() && xSignatures->isLocationTrusted( aLocation ) ) {
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/appl/workwin.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 019917b1451bc3f39ea9259df48e68cb098a0402 Author: Szymon Kłos AuthorDate: Sat Nov 4 19:20:46 2023 +0100 Commit: Szymon Kłos CommitDate: Mon Nov 6 10:05:00 2023 +0100 lok: notebookbar: reduce calls to SfxNotebookBar::IsActive - in LOK case toolbars in core doesn't make any difference - SfxNotebookBar::IsActive which reads config makes doc_setView slower, avoid it in LOK case then - it was used for hiding contextual toolbars - introduced in commit 9bc1ffa2153d2474b023e0860d3c9c68ee18727b tdf#125040 Make single mode toolbar context aware Signed-off-by: Szymon Kłos Change-Id: I63de48faf2f7e7f30f8b509455061ac20a788f8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158939 Tested-by: Jenkins diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 6ff260f2f88e..88b7cc016e3e 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1199,7 +1199,8 @@ void SfxWorkWindow::UpdateObjectBars_Impl2() // Iterate over all Toolboxes xLayoutManager->lock(); -const bool isNotebookBarActive = sfx2::SfxNotebookBar::IsActive(true); +const bool bForceDestroyToolbars = +comphelper::LibreOfficeKit::isActive() ? false : sfx2::SfxNotebookBar::IsActive(true); for ( auto const & n: aObjBarList ) { ToolbarId eId = n.eId; @@ -1213,7 +1214,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2() // Is a ToolBox required in this context ? bool bModesMatching = (nUpdateMode != SfxVisibilityFlags::Invisible) && ((nTbxMode & nUpdateMode) == nUpdateMode); -if ( bDestroy || isNotebookBarActive) +if ( bDestroy || bForceDestroyToolbars) { OUString aTbxId = g_aTbxTypeName + GetResourceURLFromToolbarId(eId); xLayoutManager->destroyElement( aTbxId );
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/notebookbar/SfxNotebookBar.cxx |9 - 1 file changed, 4 insertions(+), 5 deletions(-) New commits: commit 3d15de525534197960e9a9c64eba3ad2153aa113 Author: Szymon Kłos AuthorDate: Fri Nov 3 08:52:32 2023 +0100 Commit: Szymon Kłos CommitDate: Fri Nov 3 12:54:48 2023 +0100 lok: notebookbar: don't recreate toolbars too often commit 004512d87ab70587d95a708116a5c2f4b870565c notebookbar: allow to create multiple instances for online Changed SfxNotebookBar::StateMethod so in LOK case it always enter to the code block which is meant to be used for creating or reloading notebookbar. Change that so we check if notebookbar was initialized for given view already. Change-Id: Icfa1e572769043509479b7b98d055120ac3d1f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158872 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Szymon Kłos diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 0a21ffa98c8a..e9e85de271bd 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -377,11 +377,12 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, bool bChangedFile = sNewFile != sCurrentFile; +const SfxViewShell* pViewShell = SfxViewShell::Current(); +bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) != m_pNotebookBarWeldedWrapper.end(); + if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || !pNotebookBar->IsVisible() -|| bReloadNotebookbar || comphelper::LibreOfficeKit::isActive()) +|| bReloadNotebookbar || (comphelper::LibreOfficeKit::isActive() && !hasWeldedWrapper)) { -const SfxViewShell* pViewShell = SfxViewShell::Current(); - // Notebookbar was loaded too early what caused: // * in LOK: Paste Special feature was incorrectly initialized // Skip first request so Notebookbar will be initialized after document was loaded @@ -418,8 +419,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, pNotebookBar = pSysWindow->GetNotebookBar(); pNotebookBar->Show(); - -bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) != m_pNotebookBarWeldedWrapper.end(); if ((!hasWeldedWrapper || bReloadNotebookbar) && pNotebookBar->IsWelded()) { sal_uInt64 nWindowId = reinterpret_cast(pViewShell);
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) New commits: commit dd278812a456148e6d4326f6013b738b48140bb0 Author: Mike Kaganski AuthorDate: Sat Oct 28 18:04:42 2023 +0300 Commit: Mike Kaganski CommitDate: Sat Oct 28 18:09:43 2023 +0200 Simplify a bit Change-Id: I50b7ec4a38a9489f2712bbe99fd3377c78f579b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158590 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 03a511fc2fe4..52436ef8d4d6 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3060,9 +3060,11 @@ void SfxBaseModel::impl_store( const OUString& sURL if( sURL.isEmpty() ) throw frame::IllegalArgumentIOException(); -bool bSaved = false; +if (!m_pData->m_pObjectShell) +return; + ::comphelper::SequenceAsHashMap aArgHash(seqArguments); -if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty() +if ( !bSaveTo && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { @@ -3095,7 +3097,7 @@ void SfxBaseModel::impl_store( const OUString& sURL try { storeSelf( aArgHash.getAsConstPropertyValueList() ); -bSaved = true; +return; } catch( const lang::IllegalArgumentException& ) { @@ -3131,9 +3133,6 @@ void SfxBaseModel::impl_store( const OUString& sURL } } -if ( bSaved || !m_pData->m_pObjectShell.is() ) -return; - SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) );
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx | 106 --- 1 file changed, 56 insertions(+), 50 deletions(-) New commits: commit d2fccf0117a37f8aab8bb50ece419987f06af6b9 Author: Noel Grandin AuthorDate: Thu Oct 26 13:36:46 2023 +0200 Commit: Noel Grandin CommitDate: Thu Oct 26 19:02:53 2023 +0200 cool#6893 improve listeners in SfxBaseModel reduces CPU spent in UNO query'ing, and adds type-safety, which exposed a bug in SfxBaseModel::disposing Change-Id: I4b973f7dc38f491ce7a6281ad378e439b5450add Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158500 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index b085342b1912..03a511fc2fe4 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -202,7 +203,13 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument OUString m_sURL ; OUString m_sRuntimeUID ; OUString m_aPreusedFilterName ; -comphelper::OMultiTypeInterfaceContainerHelper2 m_aInterfaceContainer; +comphelper::OInterfaceContainerHelper3 m_aPrintJobListeners; +comphelper::OInterfaceContainerHelper3 m_aEventListeners; +comphelper::OInterfaceContainerHelper3 m_aModifyListeners; +comphelper::OInterfaceContainerHelper3 m_aDocumentEventListeners1; +comphelper::OInterfaceContainerHelper3 m_aDocumentEventListeners2; +comphelper::OInterfaceContainerHelper3 m_aStorageChangeListeners; +comphelper::OInterfaceContainerHelper3 m_aCloseListeners; std::unordered_map, std::vector>> maShapeListeners; Reference< XInterface >m_xParent ; @@ -234,8 +241,14 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument IMPL_SfxBaseModel_DataContainer( ::osl::Mutex& rMutex, SfxObjectShell* pObjectShell ) : m_pObjectShell ( pObjectShell ) -, m_aInterfaceContainer ( rMutex) -, m_nControllerLockCount ( 0 ) +, m_aPrintJobListeners( rMutex) +, m_aEventListeners ( rMutex) +, m_aModifyListeners ( rMutex) +, m_aDocumentEventListeners1( rMutex ) +, m_aDocumentEventListeners2( rMutex ) +, m_aStorageChangeListeners ( rMutex ) +, m_aCloseListeners ( rMutex) +, m_nControllerLockCount ( 0 ) , m_bClosed ( false ) , m_bClosing ( false ) , m_bSaving ( false ) @@ -354,12 +367,9 @@ void SAL_CALL SfxPrintHelperListener_Impl::disposing( const lang::EventObject& ) void SAL_CALL SfxPrintHelperListener_Impl::printJobEvent( const view::PrintJobEvent& rEvent ) { -::comphelper::OInterfaceContainerHelper2* pContainer = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType::get()); -if ( pContainer!=nullptr ) +if ( m_pData->m_aPrintJobListeners.getLength() ) { -::comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); -while (pIterator.hasMoreElements()) - static_cast(pIterator.next())->printJobEvent( rEvent ); + m_pData->m_aPrintJobListeners.notifyEach(::XPrintJobListener::printJobEvent, rEvent); } } @@ -763,7 +773,13 @@ void SAL_CALL SfxBaseModel::dispose() } lang::EventObject aEvent( static_cast(this) ); -m_pData->m_aInterfaceContainer.disposeAndClear( aEvent ); +m_pData->m_aPrintJobListeners.disposeAndClear( aEvent ); +m_pData->m_aEventListeners.disposeAndClear( aEvent ); +m_pData->m_aModifyListeners.disposeAndClear( aEvent ); +m_pData->m_aDocumentEventListeners1.disposeAndClear( aEvent ); +m_pData->m_aDocumentEventListeners2.disposeAndClear( aEvent ); +m_pData->m_aStorageChangeListeners.disposeAndClear( aEvent ); +m_pData->m_aCloseListeners.disposeAndClear( aEvent ); m_pData->m_xDocumentProperties.clear(); @@ -790,7 +806,7 @@ void SAL_CALL SfxBaseModel::dispose() void SAL_CALL SfxBaseModel::addEventListener( const Reference< lang::XEventListener >& aListener ) { SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); -m_pData->m_aInterfaceContainer.addInterface( cppu::UnoType::get(), aListener ); +m_pData->m_aEventListeners.addInterface( aListener ); } @@ -800,7 +816,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const Reference< lang::XEventListe void SAL_CALL SfxBaseModel::removeEventListener(
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/control/thumbnailviewacc.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit cee0425bf7377520845d7a32e8ccb4bc92f5d43d Author: Noel Grandin AuthorDate: Tue Oct 24 14:53:40 2023 +0200 Commit: Noel Grandin CommitDate: Tue Oct 24 18:22:41 2023 +0200 suppress more IndexHint accessibility warning Change-Id: I45bc0bf74f4ebeeb4155006e67309cd476ebc3c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158388 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index ac1e320be25b..0a0f843a52d2 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -520,6 +520,7 @@ void ThumbnailViewAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOld aEvtObject.Source = getXWeak(); aEvtObject.NewValue = rNewValue; aEvtObject.OldValue = rOldValue; +aEvtObject.IndexHint = -1; for (auto const& tmpListener : aTmpListeners) {
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objserv.cxx |6 +++--- sfx2/source/doc/sfxbasemodel.cxx |5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) New commits: commit 2c213582376216eacb613e576314e0b9cba0aa04 Author: Mike Kaganski AuthorDate: Fri Oct 13 12:41:25 2023 +0300 Commit: Mike Kaganski CommitDate: Sat Oct 14 17:36:30 2023 +0200 Keep some information when switching between exceptions and ErrCodeMsg This simplifies debugging. Change-Id: I21ba175a039bed9a1f13d510b2c80eb6356417ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157908 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 7dddb84e5fac..fb62f3768163 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1109,11 +1109,11 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) catch( const task::ErrorCodeIOException& aErrorEx ) { TOOLS_WARN_EXCEPTION_IF(ErrCode(aErrorEx.ErrCode) != ERRCODE_IO_ABORT, "sfx.doc", "Fatal IO error during save"); -nErrorCode = ErrCode(aErrorEx.ErrCode); +nErrorCode = { ErrCode(aErrorEx.ErrCode), aErrorEx.Message }; } -catch( Exception& ) +catch( Exception& e ) { -nErrorCode = ERRCODE_IO_GENERAL; +nErrorCode = { ERRCODE_IO_GENERAL, e.Message }; } // by default versions should be preserved always except in case of an explicit diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index f4b1f8305588..99901fdac73f 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1697,8 +1697,7 @@ void SAL_CALL SfxBaseModel::storeSelf( constSequence< beans::PropertyValue > pParams.reset(); -ErrCodeMsg nErrCode = m_pData->m_pObjectShell->GetErrorIgnoreWarning() ? m_pData->m_pObjectShell->GetErrorIgnoreWarning() - : ERRCODE_IO_CANTWRITE; +ErrCodeMsg nErrCode = m_pData->m_pObjectShell->GetErrorIgnoreWarning(); m_pData->m_pObjectShell->ResetError(); if ( bRet ) @@ -1709,6 +1708,8 @@ void SAL_CALL SfxBaseModel::storeSelf( constSequence< beans::PropertyValue > } else { +if (!nErrCode) +nErrCode = ERRCODE_IO_CANTWRITE; // write the contents of the logger to the file SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDocFailed, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell.get() ) );
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objmisc.cxx | 49 1 file changed, 49 insertions(+) New commits: commit 0855520cced8662ba0a8cfdaccbe55a812b13c60 Author: Henry Castro AuthorDate: Wed Sep 6 10:30:27 2023 -0400 Commit: Henry Castro CommitDate: Mon Oct 9 19:52:30 2023 +0200 sfx2: invoke handler "LoadReadOnlyRequest" It will ask the user if open the Excel documents "read only" Signed-off-by: Henry Castro Change-Id: I909fb39709198e02496f8c522f477c077fb875e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156624 Reviewed-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157730 Tested-by: Jenkins diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 69d0ac4b3bea..123d234734f7 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -77,6 +77,7 @@ #include #include #include +#include #include #include @@ -1098,6 +1099,54 @@ void SfxObjectShell::FinishedLoading( SfxLoadedFlags nFlags ) bHasName = true; // the document is loaded, so the name should already available GetTitle( SFX_TITLE_DETECT ); InitOwnModel_Impl(); + +if (IsLoadReadonly()) +{ +OUString aFilterName; +if (const SfxStringItem* pFilterNameItem = +pMedium->GetItemSet().GetItem(SID_FILTER_NAME, false)) +aFilterName = pFilterNameItem->GetValue(); + +OUString aFileName; +if (const SfxStringItem* pFileNameItem = +pMedium->GetItemSet().GetItem(SID_FILE_NAME, false)) +{ +const INetURLObject aURL(pFileNameItem->GetValue()); +aFileName = aURL.getBase(INetURLObject::LAST_SEGMENT, true, + INetURLObject::DecodeMechanism::WithCharset); +} + +bool bSilent = false; +if (const SfxBoolItem* pSilentNameItem = +pMedium->GetItemSet().GetItem(SID_SILENT, false)) +bSilent = pSilentNameItem->GetValue(); + +if (!bSilent && aFilterName.indexOf("Excel") != -1) +{ +Reference xHandler(pMedium->GetInteractionHandler()); +if (xHandler.is()) +{ +beans::NamedValue aLoadReadOnlyRequest; +aLoadReadOnlyRequest.Name = "LoadReadOnlyRequest"; +aLoadReadOnlyRequest.Value <<= aFileName; + +Any aRequest(aLoadReadOnlyRequest); +rtl::Reference xRequest += new ucbhelper::SimpleInteractionRequest(aRequest, + ContinuationFlags::Approve | + ContinuationFlags::Disapprove); + +xHandler->handle(xRequest); + +if (xRequest->getResponse() == ContinuationFlags::Disapprove) +{ +SetSecurityOptOpenReadOnly(false); + pMedium->GetItemSet().Put(SfxBoolItem(SID_DOC_READONLY, false)); +} +} +} +} + pImpl->nFlagsInProgress &= ~SfxLoadedFlags::MAINDOCUMENT; }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/commandpopup/CommandPopup.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 72d6287c586a2481c62bf21d88bb363ce584b8dd Author: Ilmari Lauhakangas AuthorDate: Sun Oct 8 22:34:15 2023 +0300 Commit: Ilmari Lauhakangas CommitDate: Mon Oct 9 17:47:34 2023 +0200 tdf#142524 Search Commands: use ▸ to indicate sequence Change-Id: I2a3a7c4db03dbfe53f2b71de7ee9b3df42a22866 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157689 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/sfx2/source/commandpopup/CommandPopup.cxx b/sfx2/source/commandpopup/CommandPopup.cxx index 8d68bd62bd76..0d948a4e84e6 100644 --- a/sfx2/source/commandpopup/CommandPopup.cxx +++ b/sfx2/source/commandpopup/CommandPopup.cxx @@ -51,6 +51,7 @@ MenuContentHandler::MenuContentHandler(uno::Reference const& xFra void MenuContentHandler::gatherMenuContent( uno::Reference const& xIndexAccess, MenuContent& rMenuContent) { +std::u16string_view aMenuLabelSeparator = AllSettings::GetLayoutRTL() ? u" ◂ " : u" ▸ "; for (sal_Int32 n = 0; n < xIndexAccess->getCount(); n++) { MenuContent aNewContent; @@ -85,7 +86,8 @@ void MenuContentHandler::gatherMenuContent( aNewContent.m_aMenuLabel = aLabel; if (!rMenuContent.m_aFullLabelWithPath.isEmpty()) -aNewContent.m_aFullLabelWithPath = rMenuContent.m_aFullLabelWithPath + " / "; +aNewContent.m_aFullLabelWithPath += rMenuContent.m_aFullLabelWithPath + aMenuLabelSeparator; aNewContent.m_aFullLabelWithPath += aNewContent.m_aMenuLabel; aNewContent.m_aSearchableMenuLabel = toLower(aNewContent.m_aFullLabelWithPath);
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/sidebar/SidebarController.cxx |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) New commits: commit 6e6db2a3360d7ee89cae14cbcfe386e7425daf98 Author: Mihai Vasiliu AuthorDate: Thu Oct 5 16:28:02 2023 +0300 Commit: Caolán McNamara CommitDate: Fri Oct 6 10:43:03 2023 +0200 tdf#150639 Fix sidebar width too narrow The mnWidthOnSplitterButtonDown is initialized to 0 at program start. This makes every call to take the else case until the user manually changes the width, but some decks such as Master Slides have the mnMinimalWidth too low which makes them too narrow for the content they should display to the user. Change-Id: I8fc4924f70dedbdc8d162ceceb620ff80e59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157596 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 4798e1a33435..c6137d94d0e8 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -658,7 +658,12 @@ void SidebarController::OpenThenToggleDeck ( if(mnWidthOnSplitterButtonDown > 0 && mnWidthOnSplitterButtonDown > nRequestedWidth){ SetChildWindowWidth(mnWidthOnSplitterButtonDown); }else{ -SetChildWindowWidth(nRequestedWidth); +// tdf#150639 The mnWidthOnSplitterButtonDown is initialized to 0 at program start. +// This makes every call to take the else case until the user manually changes the +// width, but some decks such as Master Slides have the mnMinimalWidth too low which +// makes them too narrow for the content they should display to the user. +SetChildWindowWidth(nRequestedWidth > mnSavedSidebarWidth ? nRequestedWidth + : mnSavedSidebarWidth); } } }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/appl/workwin.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 2ecd4c009293f127ac09e5f4184330c4337cee49 Author: Miklos Vajna AuthorDate: Tue Oct 3 13:21:36 2023 +0200 Commit: Miklos Vajna CommitDate: Tue Oct 3 15:07:40 2023 +0200 sfx2: fix gcc dbgutil -Werror=unused-variable /home/vmiklos/git/libreoffice/master/sfx2/source/appl/workwin.cxx: In member function ‘void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16, bool)’: /home/vmiklos/git/libreoffice/master/sfx2/source/appl/workwin.cxx:1861:27: error: unused variable ‘pCW’ [-Werror=unused-variable] 1861 | if (SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId)) | ^~~ /home/vmiklos/git/libreoffice/master/sfx2/source/appl/workwin.cxx: In member function ‘void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16, bool, bool)’: /home/vmiklos/git/libreoffice/master/sfx2/source/appl/workwin.cxx:1990:27: error: unused variable ‘pCW’ [-Werror=unused-variable] 1990 | if (SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId)) | ^~~ Change-Id: Iecc60032459ca8a6543f3836f17b76b25939cda9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157516 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 9a4de102bb88..aadc401a8ee1 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1858,7 +1858,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus) } #ifdef DBG_UTIL -if (SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId)) +if (Get_BySaveId(aChildWins, nId)) { OSL_FAIL("The ChildWindow is not in context!"); } @@ -1987,7 +1987,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe } #ifdef DBG_UTIL -if (SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId)) +if (Get_BySaveId(aChildWins, nId)) { OSL_FAIL("The ChildWindow is not in context!"); }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/appl/workwin.cxx | 135 --- 1 file changed, 28 insertions(+), 107 deletions(-) New commits: commit c5574385303a86b6f65002d6bc4ff074f9e84d49 Author: Mike Kaganski AuthorDate: Mon Oct 2 19:36:41 2023 +0300 Commit: Mike Kaganski CommitDate: Mon Oct 2 22:06:12 2023 +0200 Deduplicate and simplify some SfxWorkWindow methods Change-Id: Ibd7153454f1efd1d311ac99b9c2529958f4ca3e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157500 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 60d900ccb026..9a4de102bb88 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1748,24 +1748,26 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, } } +namespace +{ +template +SfxChildWin_Impl* Get_Impl(const std::vector>& rChildWins, + sal_uInt16 nId) +{ +for (auto& pChildWin : rChildWins) +if (pChildWin.get()->*Member == nId) +return pChildWin.get(); +return nullptr; +} +auto Get_ById = Get_Impl<_Impl::nId>; +auto Get_BySaveId = Get_Impl<_Impl::nSaveId>; +} void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, bool bEnabled, SfxVisibilityFlags nMode ) { sal_uInt16 nId = static_cast( lId & 0x ); -SfxChildWin_Impl *pCW=nullptr; - -if ( !pCW ) -{ -// If no Parent or the Parent us still unknown, then search here -sal_uInt16 nCount = aChildWins.size(); -for (sal_uInt16 n=0; nnSaveId == nId) -{ -pCW = aChildWins[n].get(); -break; -} -} +SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId); if ( !pCW ) { @@ -1787,16 +1789,9 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, bool bEnabled, S void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus) { -sal_uInt16 nCount = aChildWins.size(); -sal_uInt16 n; -for (n=0; nnId == nId) -break; - -if ( npWin; bool bCreationAllowed( true ); @@ -1863,12 +1858,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus) } #ifdef DBG_UTIL -nCount = aChildWins.size(); -for (n=0; nnSaveId == nId) -break; - -if ( n < nCount ) +if (SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId)) { OSL_FAIL("The ChildWindow is not in context!"); } @@ -1882,37 +1872,15 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus) bool SfxWorkWindow::HasChildWindow_Impl(sal_uInt16 nId) { -sal_uInt16 nCount = aChildWins.size(); -sal_uInt16 n; -for (n=0; nnSaveId == nId) -break; - -if (npWin; -return ( pChild && pCW->bCreate ); -} +if (const SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId)) +return ( pCW->pWin && pCW->bCreate ); return false; } bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) { -SfxChildWin_Impl *pCW=nullptr; - -if ( !pCW ) -{ -// If no Parent or the Parent us still unknown, then search here -sal_uInt16 nCount = aChildWins.size(); -for (sal_uInt16 n=0; nnSaveId == nId) -{ -pCW = aChildWins[n].get(); -break; -} -} +SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId); if ( !pCW ) { @@ -1936,17 +1904,7 @@ bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) bool SfxWorkWindow::KnowsChildWindow_Impl(sal_uInt16 nId) { -SfxChildWin_Impl *pCW=nullptr; -sal_uInt16 nCount = aChildWins.size(); -sal_uInt16 n; -for (n=0; nnSaveId == nId) - break; -} - -if (naInfo.nFlags & SfxChildWindowFlags::ALWAYSAVAILABLE) && !IsVisible_Impl( pCW->nVisibility ) ) return false; @@ -1959,21 +1917,7 @@ bool SfxWorkWindow::KnowsChildWindow_Impl(sal_uInt16 nId) void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, bool bOn, bool bSetFocus) { -SfxChildWin_Impl *pCW=nullptr; -SfxWorkWindow *pWork = nullptr; - -if ( !pCW ) -{ -// If no Parent or the Parent us still unknown, then search here -sal_uInt16 nCount = aChildWins.size(); -for (sal_uInt16 n=0; nnSaveId == nId) -{ -pCW = aChildWins[n].get(); -pWork = this; -break; -} -} +SfxChildWin_Impl* pCW = Get_BySaveId(aChildWins, nId); if ( !pCW ) { @@ -1981,29 +1925,17 @@ void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, bool bOn, bool bSetFocus // the Parent pCW = new SfxChildWin_Impl( nId ); InitializeChild_Impl( pCW ); -if ( !pWork || pCW->aInfo.nFlags & SfxChildWindowFlags::TASK ) -pWork = this; -pWork->aChildWins.push_back( std::unique_ptr(pCW) ); +aChildWins.push_back(
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objserv.cxx | 11 +++ 1 file changed, 11 insertions(+) New commits: commit 4c76b9568a3d008219a3dc0818f2f6db2939e354 Author: Szymon Kłos AuthorDate: Mon Sep 11 12:54:34 2023 +0200 Commit: Szymon Kłos CommitDate: Mon Sep 18 16:28:18 2023 +0200 lok: don't convert save request to save as Don't force save as in LOK but report that file cannot be written. Without that we go through save as process which is used for export functionality and client's browser downloads the file in the end instead of uploading to the storage. Signed-off-by: Szymon Kłos Change-Id: I2784bfc25055934363c304b5f5a87ae4da620a4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156819 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157021 Tested-by: Jenkins diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index a9c39b006564..6308de92e3c6 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1039,6 +1039,17 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) aDispatchArgs ); bool bForceSaveAs = nId == SID_SAVEDOC && IsReadOnlyMedium(); + +if (comphelper::LibreOfficeKit::isActive() && bForceSaveAs) +{ +// Don't force save as in LOK but report that file cannot be written +// to avoid confusion with exporting for file download purpose + +throw task::ErrorCodeIOException( +"SfxObjectShell::ExecFile_Impl: ERRCODE_IO_CANTWRITE", +uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_CANTWRITE)); +} + const SfxSlot* pSlot = GetModule()->GetSlotPool()->GetSlot( bForceSaveAs ? SID_SAVEASDOC : nId ); if ( !pSlot ) throw uno::Exception("no slot", nullptr);