summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-10-21 09:09:01 +0200
committerJan Holesovsky <kendy@collabora.com>2015-10-21 09:41:36 +0200
commit5a10f87708363217feabaebc88b993edce06940b (patch)
treeea79c5eca395e9d7bce275e022353c9cba456747 /sfx2
parentfaec766d902f612ba0e580eb86a3d64147eb0e4b (diff)
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
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx8
-rw-r--r--sfx2/source/doc/objxtor.cxx65
-rw-r--r--sfx2/source/view/frmload.cxx3
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx7
4 files changed, 32 insertions, 51 deletions
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index 0f3196df45cc..b2eaa3232487 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 526f66e5f64a..d2be8b312ae4 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 2cc886a823c5..720714ecd33c 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 2bcac22259bb..fcf57d245398 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() )