Kaydet (Commit) 9387cca9 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

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.

Change-Id: I99d516cae8b278199a01276686465f716b9b4cec
üst b34f0327
...@@ -216,6 +216,7 @@ private: ...@@ -216,6 +216,7 @@ private:
bool bHasName :1; // sal_True := existing object, bool bHasName :1; // sal_True := existing object,
// sal_False := new object // sal_False := new object
bool bIsInGenerateThumbnail; //optimize thumbnail generate and store procedure to improve odt saving performance, i120030 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(); bool CloseInternal();
private: private:
...@@ -463,6 +464,12 @@ public: ...@@ -463,6 +464,12 @@ public:
bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030 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 // Transfer IFace
void AbortImport(); void AbortImport();
bool IsAbortingImport() const; bool IsAbortingImport() const;
......
...@@ -161,6 +161,9 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) ...@@ -161,6 +161,9 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex )
void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh ) void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh )
{ {
if (pDocSh->IsAvoidRecentDocs())
return;
SfxMedium *pMed = pDocSh->GetMedium(); SfxMedium *pMed = pDocSh->GetMedium();
if( !pMed ) if( !pMed )
return; return;
...@@ -411,11 +414,6 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -411,11 +414,6 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
break; break;
case SFX_EVENT_OPENDOC: case SFX_EVENT_OPENDOC:
{
AddDocumentToPickList(pDocSh);
}
break;
case SFX_EVENT_SAVEDOCDONE: case SFX_EVENT_SAVEDOCDONE:
case SFX_EVENT_SAVEASDOCDONE: case SFX_EVENT_SAVEASDOCDONE:
case SFX_EVENT_SAVETODOCDONE: case SFX_EVENT_SAVETODOCDONE:
......
...@@ -282,12 +282,13 @@ SfxObjectShell_Impl::~SfxObjectShell_Impl() ...@@ -282,12 +282,13 @@ SfxObjectShell_Impl::~SfxObjectShell_Impl()
SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags ) SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags )
: pImp( new SfxObjectShell_Impl( *this ) ) : pImp(new SfxObjectShell_Impl(*this))
, pMedium(0) , pMedium(0)
, pStyleSheetPool(0) , pStyleSheetPool(0)
, eCreateMode(SfxObjectCreateMode::STANDARD) , eCreateMode(SfxObjectCreateMode::STANDARD)
, bHasName( false ) , bHasName(false)
, bIsInGenerateThumbnail ( false ) , bIsInGenerateThumbnail (false)
, mbAvoidRecentDocs(false)
{ {
if (i_nCreationFlags & SfxModelFlags::EMBEDDED_OBJECT) if (i_nCreationFlags & SfxModelFlags::EMBEDDED_OBJECT)
eCreateMode = SfxObjectCreateMode::EMBEDDED; eCreateMode = SfxObjectCreateMode::EMBEDDED;
...@@ -303,49 +304,25 @@ SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags ) ...@@ -303,49 +304,25 @@ SfxObjectShell::SfxObjectShell( const SfxModelFlags i_nCreationFlags )
pImp->m_bDocRecoverySupport = false; pImp->m_bDocRecoverySupport = false;
} }
/** Constructor of the class SfxObjectShell.
@param eMode Purpose, to which the SfxObjectShell is created:
// initializes a document from a file-description SfxObjectCreateMode::EMBEDDED (default) as SO-Server from within another Document
SfxObjectCreateMode::STANDARD, as a normal Document open stand-alone
SfxObjectShell::SfxObjectShell 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
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
nothing of the contents is used */
)
/* [Description]
Constructor of the class SfxObjectShell.
*/ */
SfxObjectShell::SfxObjectShell(SfxObjectCreateMode eMode)
: pImp( new SfxObjectShell_Impl( *this ) ), : pImp(new SfxObjectShell_Impl(*this))
pMedium(0), , pMedium(0)
pStyleSheetPool(0), , pStyleSheetPool(0)
eCreateMode(eMode), , eCreateMode(eMode)
bHasName( false ), , bHasName(false)
bIsInGenerateThumbnail ( false ) , bIsInGenerateThumbnail(false)
, mbAvoidRecentDocs(false)
{ {
} }
// virtual destructor of typical base-class SfxObjectShell
SfxObjectShell::~SfxObjectShell() SfxObjectShell::~SfxObjectShell()
{ {
......
...@@ -529,7 +529,8 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo ...@@ -529,7 +529,8 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ) ::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor )
{ {
const sal_Char* pKnownViewArgs[] = { const sal_Char* pKnownViewArgs[] = {
"JumpMark" "JumpMark",
"AvoidRecentDocs"
}; };
::comphelper::NamedValueCollection aViewArgs; ::comphelper::NamedValueCollection aViewArgs;
......
...@@ -1350,8 +1350,13 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) ...@@ -1350,8 +1350,13 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect )
if ( !rFrame.IsInPlace() ) if ( !rFrame.IsInPlace() )
pViewFrame->Resize( true ); 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 // if there's a JumpMark given, then, well, jump to it
::comphelper::NamedValueCollection aViewArgs( getCreationArguments() );
const OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", OUString() ); const OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", OUString() );
const bool bHasJumpMark = !sJumpMark.isEmpty(); const bool bHasJumpMark = !sJumpMark.isEmpty();
OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() ) OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment