[Libreoffice-commits] core.git: 2 commits - comphelper/source include/comphelper sfx2/source svtools/source sw/source

Steve Yin steve_y at apache.org
Sat Aug 9 06:13:40 PDT 2014


 comphelper/source/container/embeddedobjectcontainer.cxx |   36 ++++++++++++----
 include/comphelper/embeddedobjectcontainer.hxx          |    3 +
 sfx2/source/appl/linkmgr2.cxx                           |   12 ++++-
 svtools/source/misc/embedhlp.cxx                        |   29 ++++++++----
 sw/source/filter/ww8/ww8graf.cxx                        |   21 +++------
 5 files changed, 70 insertions(+), 31 deletions(-)

New commits:
commit 227f3aab1791ffde82fe930ea1c9f7ed4ed2d82d
Author: Steve Yin <steve_y at apache.org>
Date:   Fri Aug 8 03:10:58 2014 +0000

    Resolves: #i125391# textbox object's location changes...
    
    after importing the sample file
    
    Fixed by Oliver-Rainer Wittmann
    (cherry picked from commit 700479573567e82f9bd9ae065f18f9ec9d943300)
    
    Conflicts:
    	sw/source/filter/ww8/ww8graf.cxx
    
    Change-Id: I963689a80dfe4ac1439afb29132015e900886317

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 1445ce5..c145c22 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2138,20 +2138,15 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord,
 
     if (pFSPA)
     {
-        /*
-        #i15718# #i19008#
-        Strangely in this case the FSPA value seems to be considered before
-        the newer escher nXRelTo record.
-        */
-        // #i52565# - correct condition checking:
-        // first check, if <nXRelTo> and <nYRelTo> have default values.  This
-        // is a hint that these values aren't set by the escher import - see
-        // method <SwMSDffManager::ProcessObj(..)>. Then, check if for each
-        // values, if it differs from the one in the FSPA.
-
-        if ( *(pRecord->pXRelTo) == 2 && *(pRecord->pYRelTo) == 2 && !bCurSectionVertical)
+        // #i52565# - try to handle special case for objects in tables regarding its X Rel
+
+        // if X and Y Rel values are on default take it as a hint, that they have not been set
+        // by <SwMSDffManager::ProcessObj(..)>
+        const bool bXYRelHaveDefaultValues = *(pRecord->pXRelTo) == 2 && *(pRecord->pYRelTo) == 2;
+        if ( bXYRelHaveDefaultValues
+             && nInTable > 0
+             && !bCurSectionVertical )
         {
-            // if <nYRelTo> differs from <FSPA.nby> overwrite <nYRelTo>
             if ( pFSPA->nby != *(pRecord->pYRelTo) )
             {
                 *(pRecord->pYRelTo) = pFSPA->nby;
commit d005acae3aa315921f2c331612131626c470bd22
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Aug 7 09:59:26 2014 +0000

    Resolves: #i125386# secured user request and changed some bools to bitfield
    
    (cherry picked from commit 5e3cbe056c19bea5018dbf1fd4b2bc8f8b030ff3)
    
    Conflicts:
    	comphelper/inc/comphelper/embeddedobjectcontainer.hxx
    	comphelper/source/container/embeddedobjectcontainer.cxx
    	sfx2/source/appl/linkmgr2.cxx
    	svtools/source/misc/embedhlp.cxx
    
    Change-Id: I7e9b20a87ca6afe8cb91c577860a6c6b72368ee9

diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index d614c1a..e3696f1 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -62,7 +62,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();
 };
@@ -93,7 +96,8 @@ EmbeddedObjectContainer::EmbeddedObjectContainer()
 {
     pImpl = new EmbedImpl;
     pImpl->mxStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
-    pImpl->bOwnsStorage = true;
+    pImpl->mbOwnsStorage = true;
+    pImpl->mbUserAllowsLinkUpdate = true;
     pImpl->mpTempObjectContainer = 0;
 }
 
@@ -101,7 +105,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;
 }
 
@@ -109,7 +114,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;
 }
@@ -118,11 +124,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;
 }
 
 bool EmbeddedObjectContainer::CommitImageSubStorage()
@@ -178,7 +184,7 @@ EmbeddedObjectContainer::~EmbeddedObjectContainer()
 {
     ReleaseImageSubStorage();
 
-    if ( pImpl->bOwnsStorage )
+    if ( pImpl->mbOwnsStorage )
         pImpl->mxStorage->dispose();
 
     delete pImpl->mpTempObjectContainer;
@@ -1337,7 +1343,7 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm
                     xStream = GetGraphicStream( xObj, &aMediaType );
                 }
 
-                if ( !xStream.is() )
+                if ( !xStream.is() && getUserAllowsLinkUpdate() )
                 {
                     // the image must be regenerated
                     // TODO/LATER: another aspect could be used
@@ -1626,6 +1632,20 @@ bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< embed::
     }
     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 8895a8d..2c8e25f 100644
--- a/include/comphelper/embeddedobjectcontainer.hxx
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -181,6 +181,9 @@ public:
     * \return <FALSE/> if no error occurred, otherwise <TRUE/>.
     */
     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 501ec54..c5e3888 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -329,7 +329,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 c1c3462..238ea03 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -604,19 +604,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;
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list