summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx36
-rw-r--r--include/comphelper/embeddedobjectcontainer.hxx3
-rw-r--r--sfx2/source/appl/linkmgr2.cxx12
-rw-r--r--svtools/source/misc/embedhlp.cxx29
4 files changed, 62 insertions, 18 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index c3b4338e2561..4fef6c0638c2 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -85,7 +85,10 @@ struct EmbedImpl
uno::WeakReference < uno::XInterface > m_xModel;
//EmbeddedObjectContainerNameMap maTempObjectContainer;
//uno::Reference < embed::XStorage > mxTempStorage;
- bool bOwnsStorage;
+
+ /// bitfield
+ bool mbOwnsStorage : 1;
+ bool mbUserAllowsLinkUpdate : 1;
const uno::Reference < embed::XStorage >& GetReplacements();
};
@@ -116,7 +119,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer()
{
pImpl = new EmbedImpl;
pImpl->mxStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
- pImpl->bOwnsStorage = true;
+ pImpl->mbOwnsStorage = true;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
}
@@ -124,7 +128,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer( const uno::Reference < embed::
{
pImpl = new EmbedImpl;
pImpl->mxStorage = rStor;
- pImpl->bOwnsStorage = false;
+ pImpl->mbOwnsStorage = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
}
@@ -132,7 +137,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer( const uno::Reference < embed::
{
pImpl = new EmbedImpl;
pImpl->mxStorage = rStor;
- pImpl->bOwnsStorage = false;
+ pImpl->mbOwnsStorage = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
pImpl->m_xModel = xModel;
}
@@ -141,11 +147,11 @@ void EmbeddedObjectContainer::SwitchPersistence( const uno::Reference < embed::X
{
ReleaseImageSubStorage();
- if ( pImpl->bOwnsStorage )
+ if ( pImpl->mbOwnsStorage )
pImpl->mxStorage->dispose();
pImpl->mxStorage = rStor;
- pImpl->bOwnsStorage = false;
+ pImpl->mbOwnsStorage = false;
}
sal_Bool EmbeddedObjectContainer::CommitImageSubStorage()
@@ -201,7 +207,7 @@ EmbeddedObjectContainer::~EmbeddedObjectContainer()
{
ReleaseImageSubStorage();
- if ( pImpl->bOwnsStorage )
+ if ( pImpl->mbOwnsStorage )
pImpl->mxStorage->dispose();
delete pImpl->mpTempObjectContainer;
@@ -1378,7 +1384,7 @@ sal_Bool EmbeddedObjectContainer::StoreAsChildren(sal_Bool _bOasisFormat,sal_Boo
xStream = GetGraphicStream( xObj, &aMediaType );
}
- if ( !xStream.is() )
+ if ( !xStream.is() && getUserAllowsLinkUpdate() )
{
// the image must be regenerated
// TODO/LATER: another aspect could be used
@@ -1667,6 +1673,20 @@ sal_Bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< emb
}
return bError;
}
+
+bool EmbeddedObjectContainer::getUserAllowsLinkUpdate() const
+{
+ return pImpl->mbUserAllowsLinkUpdate;
+}
+
+void EmbeddedObjectContainer::setUserAllowsLinkUpdate(bool bNew)
+{
+ if(pImpl->mbUserAllowsLinkUpdate != bNew)
+ {
+ pImpl->mbUserAllowsLinkUpdate = bNew;
+ }
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
index 616ca0f908dc..270ef1b2037f 100644
--- a/include/comphelper/embeddedobjectcontainer.hxx
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -177,6 +177,9 @@ public:
* \return <FALSE/> if no error occurred, otherwise <TRUE/>.
*/
sal_Bool SetPersistentEntries(const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& _xStorage,bool _bClearModifedFlag = true);
+
+ bool getUserAllowsLinkUpdate() const;
+ void setUserAllowsLinkUpdate(bool bNew);
};
}
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index e1e460616a57..878479f1ee63 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -328,7 +328,17 @@ void LinkManager::UpdateAllLinks(
{
int nRet = QueryBox( pParentWin, WB_YES_NO | WB_DEF_YES, SfxResId( STR_QUERY_UPDATE_LINKS ).toString() ).Execute();
if( RET_YES != nRet )
- return ; // nothing should be updated
+ {
+ SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
+
+ if(pShell)
+ {
+ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer();
+ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
+ }
+
+ return ; // nothing should be updated
+ }
bAskUpdate = false; // once is enough
}
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index fb5f3f2e1ccc..3aa1f12db86a 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -601,19 +601,30 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( bool bUpdate ) const
if ( !xStream.is() )
{
SAL_INFO( "svtools.misc", "getting stream from object" );
- // update wanted or no stream in container storage available
- xStream = GetGraphicReplacementStream(mpImpl->nViewAspect, mpImpl->mxObj, &mpImpl->aMediaType);
+ bool bUserAllowsLinkUpdate(true);
+ const comphelper::EmbeddedObjectContainer* pContainer = GetContainer();
- if ( xStream.is() )
+ if(pContainer)
{
- if ( mpImpl->pContainer )
- mpImpl->pContainer->InsertGraphicStream( xStream, mpImpl->aPersistName, mpImpl->aMediaType );
+ bUserAllowsLinkUpdate = pContainer->getUserAllowsLinkUpdate();
+ }
- SvStream* pResult = ::utl::UcbStreamHelper::CreateStream( xStream );
- if ( pResult && bUpdate )
- mpImpl->bNeedUpdate = false;
+ if(bUserAllowsLinkUpdate)
+ {
+ // update wanted or no stream in container storage available
+ xStream = GetGraphicReplacementStream(mpImpl->nViewAspect, mpImpl->mxObj, &mpImpl->aMediaType);
- return pResult;
+ if(xStream.is())
+ {
+ if (mpImpl->pContainer)
+ mpImpl->pContainer->InsertGraphicStream(xStream,mpImpl->aPersistName,mpImpl->aMediaType);
+
+ SvStream* pResult = ::utl::UcbStreamHelper::CreateStream( xStream );
+ if (pResult && bUpdate)
+ mpImpl->bNeedUpdate = false;
+
+ return pResult;
+ }
}
}