[Libreoffice-commits] core.git: 2 commits - include/xmloff svx/source sw/inc sw/source xmloff/source

Zolnai Tamás tamas.zolnai at collabora.com
Sun Nov 16 11:49:10 PST 2014


 include/xmloff/txtparae.hxx       |    4 --
 svx/source/svdraw/svdograf.cxx    |   20 +------------
 sw/inc/ndgrf.hxx                  |    6 ----
 sw/source/core/graphic/ndgrf.cxx  |   57 +-------------------------------------
 sw/source/filter/xml/xmltexte.cxx |   22 --------------
 sw/source/filter/xml/xmltexte.hxx |    5 ---
 xmloff/source/text/txtparae.cxx   |    7 ----
 7 files changed, 5 insertions(+), 116 deletions(-)

New commits:
commit aea2dbc319e1e1069d3af4bbc828eb0001cd6ece
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Nov 16 20:48:19 2014 +0100

    Remove now useless setTextEmbeddedGraphicURL()
    
    Since this commit:
    286e2f5c6ec829bc0987b1be7016699f7ef03e5e
    it's not necessary to update the package URL.
    
    Change-Id: I25c829e9bc0c666838baf19cd60f19938ebb430c

diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index 37ec27b..a7369ea 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -380,10 +380,6 @@ protected:
         bool bAutoStyles,
         const ::com::sun::star::uno::Reference <
             ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0  );
-    virtual void setTextEmbeddedGraphicURL(
-        const ::com::sun::star::uno::Reference <
-                ::com::sun::star::beans::XPropertySet >& rPropSet,
-        OUString& rStreamName ) const;
 
     /// export a footnote and styles
     void exportTextFootnote(
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 3eaa75a..b40da0c 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -177,11 +177,7 @@ private:
 
 public:
     bool HasEmbeddedStreamName() const { return maGrfObj.HasUserData(); }
-    /// applying new stream name for embedded graphic - needed as saving the document might change this stream name
-    void ApplyNewEmbeddedStreamName(const OUString& r)
-    {
-        maGrfObj.SetUserData(r);
-    }
+
     /// Is this node selected by any shell?
     bool IsSelected() const;
 
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index c830e1d..79ea895 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -188,28 +188,6 @@ SwXMLTextParagraphExport::~SwXMLTextParagraphExport()
 {
 }
 
-void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
-    const Reference < XPropertySet >& rPropSet,
-    OUString& rURL) const
-{
-    if( rURL.isEmpty() )
-        return;
-
-    SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode();
-    if (pGrfNd && !pGrfNd->IsGrfLink())
-    {
-        // Apply new embedded stream name, only if graphic node already has one.
-        // - The saving of recovery information triggers this method, but for a newly created
-        //   document the new embedded stream name shall not be applied.
-        // - The saving of a newly created document to own format (ODF) triggers this method,
-        //   but the embedded stream name is not needed as its original inserted data is still in use.
-        if (pGrfNd->HasEmbeddedStreamName())
-        {
-            pGrfNd->ApplyNewEmbeddedStreamName("vnd.sun.star.Package:" + rURL);
-        }
-    }
-}
-
 static void lcl_addURL ( SvXMLExport &rExport, const OUString &rURL,
                          bool bToRel = true )
 {
diff --git a/sw/source/filter/xml/xmltexte.hxx b/sw/source/filter/xml/xmltexte.hxx
index cb00746..17f45d9 100644
--- a/sw/source/filter/xml/xmltexte.hxx
+++ b/sw/source/filter/xml/xmltexte.hxx
@@ -69,11 +69,6 @@ public:
         SwXMLExport& rExp,
          SvXMLAutoStylePoolP& rAutoStylePool );
     virtual ~SwXMLTextParagraphExport();
-
-    virtual void setTextEmbeddedGraphicURL(
-        const ::com::sun::star::uno::Reference <
-                ::com::sun::star::beans::XPropertySet >& rPropSet,
-        OUString& rStreamName ) const SAL_OVERRIDE;
 };
 
 #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLTEXTE_HXX
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 07b2ab4..4d43b3c 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3084,7 +3084,6 @@ void XMLTextParagraphExport::_exportTextGraphic(
     OUString sOrigURL;
     rPropSet->getPropertyValue( sGraphicURL ) >>= sOrigURL;
     OUString sURL(GetExport().AddEmbeddedGraphicObject( sOrigURL ));
-    setTextEmbeddedGraphicURL( rPropSet, sURL );
 
     // If there still is no url, then then graphic is empty
     if( !sURL.isEmpty() )
@@ -3205,12 +3204,6 @@ void XMLTextParagraphExport::exportTitleAndDescription(
     }
 }
 
-void XMLTextParagraphExport::setTextEmbeddedGraphicURL(
-    const Reference < XPropertySet >&,
-    OUString& /*rStreamName*/ ) const
-{
-}
-
 bool XMLTextParagraphExport::addHyperlinkAttributes(
     const Reference< XPropertySet > & rPropSet,
     const Reference< XPropertyState > & rPropState,
commit db686e8ae12e4c554e24d0c262915fb1bf45525b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Nov 16 20:35:30 2014 +0100

    Logically dead code related to embedded stream name in SwGrfNode\SdrGrafObj
    
    See also:
    286e2f5c6ec829bc0987b1be7016699f7ef03e5e
    
    Since embedded URL exists until the first swap in these lines
    are not needed anymore.
    
    Change-Id: Ie6bf8efe7808cf42f20f7b4b3f8cb927555c0ea8

diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 40d652b..42c33ce 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -991,7 +991,6 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel )
         if( pGraphic->HasUserData() )
         {
             ForceSwapIn();
-            pGraphic->SetUserData();
         }
 
         if( pGraphicLink != NULL )
@@ -1282,7 +1281,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
             {
                 const sal_uIntPtr   nSwapMode = pModel->GetSwapGraphicsMode();
 
-                if( ( pGraphic->HasUserData() || pGraphicLink ) &&
+                if( ( pGraphicLink ) &&
                     ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) )
                 {
                     pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
@@ -1392,22 +1391,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
 
     if( pModel )
     {
-        // can be loaded from the original document stream later
-        if( pGraphic && pGraphic->HasUserData() )
-        {
-            ::comphelper::LifecycleProxy proxy;
-            xStream.set(
-                pModel->GetDocumentStream(pGraphic->GetUserData(), proxy));
-            // fdo#46340: this may look completely insane, and it is,
-            // but it also prevents a crash: the LifecycleProxy will go out
-            // of scope, but the xStream must be returned; the UcbStreamHelper
-            // will actually copy the xStream to a temp file (because it is
-            // not seekable), which makes it not crash...
-            SvStream *const pStream =
-                utl::UcbStreamHelper::CreateStream(xStream);
-            xStream.set(new utl::OInputStreamWrapper(pStream, true));
-        }
-        else if( pGraphic && GetGraphic().IsLink() )
+        if( pGraphic && GetGraphic().IsLink() )
         {
             Graphic aGraphic( GetGraphic() );
             GfxLink aLink( aGraphic.GetLink() );
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index ff601f5..911ba85 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -608,7 +608,7 @@ bool SwGrfNode::SwapOut()
         maGrfObj.GetType() != GRAPHIC_NONE &&
         !maGrfObj.IsSwappedOut() && !bInSwapIn )
     {
-        if( refLink.Is() || HasEmbeddedStreamName() )
+        if( refLink.Is() )
         {
             // written graphics and links are removed here
             return maGrfObj.SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK );
@@ -931,32 +931,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
     // copy formats into the other document
     SwGrfFmtColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() );
 
-    Graphic aTmpGrf;
-    SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
-    if( !pLink && HasEmbeddedStreamName() )
-    {
-        try
-        {
-            const StreamAndStorageNames aNames = lcl_GetStreamStorageNames( maGrfObj.GetUserData() );
-            uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aNames.sStorage );
-            SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aNames.sStream );
-            if ( pStrm )
-            {
-                const OUString aURL(maGrfObj.GetUserData());
-                GraphicFilter::GetGraphicFilter().ImportGraphic(aTmpGrf, aURL, *pStrm);
-                delete pStrm;
-            }
-        }
-        catch (const uno::Exception& e)
-        {
-            // #i48434#
-            SAL_WARN("sw.core", "<SwGrfNode::MakeCopy(..)> - unhandled exception!" << e.Message);
-        }
-    }
-    else
-    {
-        aTmpGrf = GetGrf();
-    }
+    Graphic aTmpGrf = GetGrf();
 
     const sfx2::LinkManager& rMgr = getIDocumentLinksAdministration()->GetLinkManager();
     OUString sFile, sFilter;
@@ -1009,34 +984,6 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
     else
     {
         pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
-
-        if( HasEmbeddedStreamName() )
-        {
-            try
-            {
-                const StreamAndStorageNames aNames = lcl_GetStreamStorageNames( maGrfObj.GetUserData() );
-                uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aNames.sStorage );
-                SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aNames.sStream );
-                if ( pStrm )
-                {
-                    if( pGrfObj->IsInSwapOut() )
-                    {
-                        pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
-                    }
-                    else
-                    {
-                        ImportGraphic( *pStrm );
-                        pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
-                    }
-                    delete pStrm;
-                }
-            }
-            catch (const uno::Exception&)
-            {
-                // #i48434#
-                OSL_FAIL( "<SwapGraphic> - unhandled exception!" );
-            }
-        }
     }
 
     return (sal_IntPtr)pRet;


More information about the Libreoffice-commits mailing list