[Libreoffice-commits] core.git: Branch 'aoo/trunk' - comphelper/inc comphelper/source sfx2/source svtools/source
Armin Le Grand
alg at apache.org
Thu Aug 7 03:07:44 PDT 2014
comphelper/inc/comphelper/embeddedobjectcontainer.hxx | 3 +
comphelper/source/container/embeddedobjectcontainer.cxx | 36 ++++++++++++----
sfx2/source/appl/linkmgr2.cxx | 10 ++++
svtools/source/misc/embedhlp.cxx | 29 ++++++++----
4 files changed, 61 insertions(+), 17 deletions(-)
New commits:
commit 5e3cbe056c19bea5018dbf1fd4b2bc8f8b030ff3
Author: Armin Le Grand <alg at apache.org>
Date: Thu Aug 7 09:59:26 2014 +0000
i125386 secured user request and changed some bools to bitfield
diff --git a/comphelper/inc/comphelper/embeddedobjectcontainer.hxx b/comphelper/inc/comphelper/embeddedobjectcontainer.hxx
index 060fd73..f2682af 100644
--- a/comphelper/inc/comphelper/embeddedobjectcontainer.hxx
+++ b/comphelper/inc/comphelper/embeddedobjectcontainer.hxx
@@ -178,6 +178,9 @@ sal_Bool RemoveEmbeddedObject( const ::com::sun::star::uno::Reference
* \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/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 91a9a86..41d93ec 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -92,7 +92,10 @@ struct EmbedImpl
uno::WeakReference < uno::XInterface > m_xModel;
//EmbeddedObjectContainerNameMap maTempObjectContainer;
//uno::Reference < embed::XStorage > mxTempStorage;
- sal_Bool bOwnsStorage;
+
+ /// bitfield
+ bool mbOwnsStorage : 1;
+ bool mbUserAllowsLinkUpdate : 1;
const uno::Reference < embed::XStorage >& GetReplacements();
};
@@ -123,7 +126,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer()
{
pImpl = new EmbedImpl;
pImpl->mxStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
- pImpl->bOwnsStorage = sal_True;
+ pImpl->mbOwnsStorage = true;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
}
@@ -131,7 +135,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer( const uno::Reference < embed::
{
pImpl = new EmbedImpl;
pImpl->mxStorage = rStor;
- pImpl->bOwnsStorage = sal_False;
+ pImpl->mbOwnsStorage = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
}
@@ -139,7 +144,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer( const uno::Reference < embed::
{
pImpl = new EmbedImpl;
pImpl->mxStorage = rStor;
- pImpl->bOwnsStorage = sal_False;
+ pImpl->mbOwnsStorage = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
pImpl->m_xModel = xModel;
}
@@ -148,11 +154,11 @@ void EmbeddedObjectContainer::SwitchPersistence( const uno::Reference < embed::X
{
ReleaseImageSubStorage();
- if ( pImpl->bOwnsStorage )
+ if ( pImpl->mbOwnsStorage )
pImpl->mxStorage->dispose();
pImpl->mxStorage = rStor;
- pImpl->bOwnsStorage = sal_False;
+ pImpl->mbOwnsStorage = false;
}
sal_Bool EmbeddedObjectContainer::CommitImageSubStorage()
@@ -208,7 +214,7 @@ EmbeddedObjectContainer::~EmbeddedObjectContainer()
{
ReleaseImageSubStorage();
- if ( pImpl->bOwnsStorage )
+ if ( pImpl->mbOwnsStorage )
pImpl->mxStorage->dispose();
delete pImpl->mpTempObjectContainer;
@@ -1401,7 +1407,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
@@ -1685,4 +1691,18 @@ 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;
+ }
+}
+
}
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 1ae6ff2..afde1d4 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -318,7 +318,17 @@ void LinkManager::UpdateAllLinks(
{
int nRet = QueryBox( pParentWin, WB_YES_NO | WB_DEF_YES, SfxResId( STR_QUERY_UPDATE_LINKS ) ).Execute();
if( RET_YES != nRet )
+ {
+ SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
+
+ if(pShell)
+ {
+ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer();
+ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
+ }
+
return ; // es soll nichts geupdatet werden
+ }
bAskUpdate = sal_False; // einmal reicht
}
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index e7d9200..8cfb455 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -709,19 +709,30 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( sal_Bool bUpdate ) const
if ( !xStream.is() )
{
RTL_LOGFILE_CONTEXT_TRACE( aLog, "getting stream from object" );
- // update wanted or no stream in container storage available
- xStream = GetGraphicReplacementStream( mpImp->nViewAspect, mxObj, &mpImp->aMediaType );
+ bool bUserAllowsLinkUpdate(true);
+ const comphelper::EmbeddedObjectContainer* pContainer = GetContainer();
- if ( xStream.is() )
+ if(pContainer)
{
- if ( mpImp->pContainer )
- mpImp->pContainer->InsertGraphicStream( xStream, mpImp->aPersistName, mpImp->aMediaType );
+ bUserAllowsLinkUpdate = pContainer->getUserAllowsLinkUpdate();
+ }
- SvStream* pResult = ::utl::UcbStreamHelper::CreateStream( xStream );
- if ( pResult && bUpdate )
- mpImp->bNeedUpdate = sal_False;
+ if(bUserAllowsLinkUpdate)
+ {
+ // update wanted or no stream in container storage available
+ xStream = GetGraphicReplacementStream(mpImp->nViewAspect,mxObj,&mpImp->aMediaType);
- return pResult;
+ if(xStream.is())
+ {
+ if(mpImp->pContainer)
+ mpImp->pContainer->InsertGraphicStream(xStream,mpImp->aPersistName,mpImp->aMediaType);
+
+ SvStream* pResult = ::utl::UcbStreamHelper::CreateStream( xStream );
+ if ( pResult && bUpdate )
+ mpImp->bNeedUpdate = sal_False;
+
+ return pResult;
+ }
}
}
More information about the Libreoffice-commits
mailing list