include/sfx2/objsh.hxx | 7 +++ sfx2/source/appl/sfxpicklist.cxx | 16 +++----- sfx2/source/doc/objxtor.cxx | 65 ++++++++++----------------------- sfx2/source/view/frmload.cxx | 3 + sfx2/source/view/sfxbasecontroller.cxx | 7 +++ 5 files changed, 43 insertions(+), 55 deletions(-)
New commits: commit 928068cc9f6169f9a8fbe207f6e4d610ac9dbf46 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Oct 21 09:21:34 2015 +0200 lok: Avoid adding to recent documents completely. Change-Id: I292281e300e8976bf5ae286262a6a3e20de41858 diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index b2eaa32..32a7cd9 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -19,6 +19,7 @@ #include <config_features.h> +#include <comphelper/lok.hxx> #include <com/sun/star/document/XDocumentProperties.hpp> #include <unotools/historyoptions.hxx> #include <unotools/useroptions.hxx> @@ -161,7 +162,7 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) { - if (pDocSh->IsAvoidRecentDocs()) + if (pDocSh->IsAvoidRecentDocs() || comphelper::LibreOfficeKit::isActive()) return; SfxMedium *pMed = pDocSh->GetMedium(); @@ -196,10 +197,9 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) if ( pFilter ) aFilter = pFilter->GetFilterName(); - // generate a thumbnail boost::optional<OUString> aThumbnail; - // don't generate thumbnail when in headless mode, or on non-desktop (?) -#if HAVE_FEATURE_DESKTOP + + // generate the thumbnail if (!pDocSh->IsModified() && !Application::IsHeadlessModeEnabled()) { // not modified => the document matches what is in the shell @@ -227,7 +227,7 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) } } } -#endif + // add to svtool history options SvtHistoryOptions().AppendItem( ePICKLIST, aURL.GetURLNoPass( INetURLObject::NO_DECODE ), commit 5a10f87708363217feabaebc88b993edce06940b Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Oct 21 09:09:01 2015 +0200 tdf#95095: Implement "AvoidRecentDocs" property for loadComponentFromURL(). When "AvoidRecentDocs" is set to true, the loaded document is not added to the recent documents list, avoiding the (a bit expensive) thumbnail creation. Useful when loadComponentFromURL() is called from macros, or when LibreOffice is controlled via UNO. See the bug for an example. Conflicts: sfx2/source/doc/objxtor.cxx Change-Id: I99d516cae8b278199a01276686465f716b9b4cec diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index ce8ab30..437f150 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -211,6 +211,7 @@ private: bool bHasName :1; // sal_True := existing object, // sal_False := new object bool bIsInGenerateThumbnail; //optimize thumbnail generate and store procedure to improve odt saving performance, i120030 + bool mbAvoidRecentDocs; ///< Avoid adding to the recent documents list, if not necessary. bool CloseInternal(); private: @@ -458,6 +459,12 @@ public: bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030 + /// Don't add to the recent documents - it's an expensive operation, sometimes it is not wanted. + bool IsAvoidRecentDocs() const { return mbAvoidRecentDocs; } + + /// Don't add to the recent documents - it's an expensive operation, sometimes it is not wanted. + void AvoidRecentDocs(bool bAvoid = true) { mbAvoidRecentDocs = bAvoid; } + // Transfer IFace void AbortImport(); bool IsAbortingImport() const; diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 0f3196d..b2eaa32 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -161,6 +161,9 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) { + if (pDocSh->IsAvoidRecentDocs()) + return; + SfxMedium *pMed = pDocSh->GetMedium(); if( !pMed ) return; @@ -411,11 +414,6 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; case SFX_EVENT_OPENDOC: - { - AddDocumentToPickList(pDocSh); - } - break; - case SFX_EVENT_SAVEDOCDONE: case SFX_EVENT_SAVEASDOCDONE: case SFX_EVENT_SAVETODOCDONE: diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 526f66e..d2be8b3 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -281,12 +281,13 @@ SfxObjectShell_Impl::~SfxObjectShell_Impl() SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags ) - : pImp( new SfxObjectShell_Impl( *this ) ) - , pMedium(0) - , pStyleSheetPool(0) - , eCreateMode(SfxObjectCreateMode::STANDARD) - , bHasName( false ) - , bIsInGenerateThumbnail ( false ) + : pImp(new SfxObjectShell_Impl(*this)) + , pMedium(0) + , pStyleSheetPool(0) + , eCreateMode(SfxObjectCreateMode::STANDARD) + , bHasName(false) + , bIsInGenerateThumbnail (false) + , mbAvoidRecentDocs(false) { if (i_nCreationFlags & SfxModelFlags::EMBEDDED_OBJECT) eCreateMode = SfxObjectCreateMode::EMBEDDED; @@ -302,49 +303,25 @@ SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags ) pImp->m_bDocRecoverySupport = false; } +/** Constructor of the class SfxObjectShell. - -// initializes a document from a file-description - -SfxObjectShell::SfxObjectShell -( - SfxObjectCreateMode eMode /* Purpose, io which the SfxObjectShell - is created: - - SfxObjectCreateMode::EMBEDDED (default) - as SO-Server from within another - Document - - SfxObjectCreateMode::STANDARD, - as a normal Document open stand-alone - - SfxObjectCreateMode::PREVIEW - to enable a Preview, if possible are - only little information is needed - - SfxObjectCreateMode::ORGANIZER - to be displayed in the Organizer, here - notning of the contents is used */ -) - -/* [Description] - - Constructor of the class SfxObjectShell. + @param eMode Purpose, to which the SfxObjectShell is created: + SfxObjectCreateMode::EMBEDDED (default) as SO-Server from within another Document + SfxObjectCreateMode::STANDARD, as a normal Document open stand-alone + SfxObjectCreateMode::PREVIEW to enable a Preview, if possible are only little information is needed + SfxObjectCreateMode::ORGANIZER to be displayed in the Organizer, here nothing of the contents is used */ - -: pImp( new SfxObjectShell_Impl( *this ) ), - pMedium(0), - pStyleSheetPool(0), - eCreateMode(eMode), - bHasName( false ), - bIsInGenerateThumbnail ( false ) +SfxObjectShell::SfxObjectShell(SfxObjectCreateMode eMode) + : pImp(new SfxObjectShell_Impl(*this)) + , pMedium(0) + , pStyleSheetPool(0) + , eCreateMode(eMode) + , bHasName(false) + , bIsInGenerateThumbnail(false) + , mbAvoidRecentDocs(false) { } - - -// virtual destructor of typical base-class SfxObjectShell - SfxObjectShell::~SfxObjectShell() { diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 2cc886a..720714e 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -528,7 +528,8 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo ::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ) { const sal_Char* pKnownViewArgs[] = { - "JumpMark" + "JumpMark", + "AvoidRecentDocs" }; ::comphelper::NamedValueCollection aViewArgs; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 2bcac22..fcf57d2 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1336,8 +1336,13 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) if ( !rFrame.IsInPlace() ) pViewFrame->Resize( true ); + ::comphelper::NamedValueCollection aViewArgs(getCreationArguments()); + + // sometimes we want to avoid adding to the recent documents + bool bAvoidRecentDocs = aViewArgs.getOrDefault("AvoidRecentDocs", false); + m_pData->m_pViewShell->GetObjectShell()->AvoidRecentDocs(bAvoidRecentDocs); + // if there's a JumpMark given, then, well, jump to it - ::comphelper::NamedValueCollection aViewArgs( getCreationArguments() ); const OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", OUString() ); const bool bHasJumpMark = !sJumpMark.isEmpty(); OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits