[Libreoffice-commits] core.git: 35 commits - filter/source include/svtools include/svx include/vcl oox/source sc/CppunitTest_sc_subsequent_export_test.mk sc/qa sd/CppunitTest_sd_export_tests.mk sd/qa svtools/README svtools/source svx/source sw/CppunitTest_sw_globalfilter.mk sw/inc sw/Module_sw.mk sw/qa sw/source vcl/inc vcl/source

Zolnai Tamás tamas.zolnai at collabora.com
Fri Nov 7 01:48:27 PST 2014


 filter/source/msfilter/msdffimp.cxx                         |    2 
 include/svtools/grfmgr.hxx                                  |   16 -
 include/svx/svdograf.hxx                                    |    3 
 include/svx/svdpage.hxx                                     |   17 -
 include/svx/svdundo.hxx                                     |    3 
 include/vcl/graph.hxx                                       |    4 
 oox/source/export/drawingml.cxx                             |   16 -
 sc/CppunitTest_sc_subsequent_export_test.mk                 |    4 
 sc/qa/unit/data/ods/document_with_two_images.ods            |binary
 sc/qa/unit/subsequent_export-test.cxx                       |   86 +++++++
 sd/CppunitTest_sd_export_tests.mk                           |    4 
 sd/qa/unit/data/odp/document_with_two_images.odp            |binary
 sd/qa/unit/data/xml/fdo64586_0.xml                          |    4 
 sd/qa/unit/data/xml/n758621_0.xml                           |    4 
 sd/qa/unit/data/xml/n758621_1.xml                           |    4 
 sd/qa/unit/data/xml/n819614_0.xml                           |    2 
 sd/qa/unit/export-tests.cxx                                 |   90 +++++++
 svtools/README                                              |   15 -
 svtools/source/graphic/grfmgr.cxx                           |  141 ++----------
 svtools/source/graphic/grfmgr2.cxx                          |   51 +---
 svx/source/sdr/contact/viewobjectcontactofgraphic.cxx       |   13 -
 svx/source/svdraw/svdograf.cxx                              |    8 
 svx/source/svdraw/svdpage.cxx                               |   34 --
 svx/source/svdraw/svdundo.cxx                               |   28 --
 svx/source/unodraw/unoshap2.cxx                             |   10 
 sw/CppunitTest_sw_globalfilter.mk                           |   94 ++++++++
 sw/Module_sw.mk                                             |    1 
 sw/inc/ndgrf.hxx                                            |    7 
 sw/inc/ndole.hxx                                            |    1 
 sw/qa/extras/globalfilter/data/document_with_two_images.odt |binary
 sw/qa/extras/globalfilter/globalfilter.cxx                  |  130 +++++++++++
 sw/source/core/doc/notxtfrm.cxx                             |   30 --
 sw/source/core/docnode/ndnotxt.cxx                          |    3 
 sw/source/core/edit/editsh.cxx                              |   33 --
 sw/source/core/frmedt/fefly1.cxx                            |    3 
 sw/source/core/graphic/ndgrf.cxx                            |   54 ++--
 sw/source/core/layout/paintfrm.cxx                          |   21 -
 sw/source/core/ole/ndole.cxx                                |    5 
 sw/source/core/undo/unins.cxx                               |    3 
 sw/source/core/unocore/unoframe.cxx                         |   19 -
 sw/source/filter/html/htmlgrin.cxx                          |   10 
 sw/source/filter/inc/msfilter.hxx                           |   21 -
 sw/source/filter/ww8/docxattributeoutput.cxx                |   15 -
 sw/source/filter/ww8/rtfattributeoutput.cxx                 |   14 -
 sw/source/filter/ww8/writerhelper.cxx                       |   25 --
 sw/source/filter/ww8/wrtw8esh.cxx                           |    2 
 sw/source/filter/ww8/wrtww8gr.cxx                           |    6 
 sw/source/filter/xml/xmltexte.cxx                           |    4 
 vcl/inc/impgraph.hxx                                        |    1 
 vcl/source/gdi/cvtgrf.cxx                                   |    2 
 vcl/source/gdi/graph.cxx                                    |    6 
 vcl/source/gdi/impgraph.cxx                                 |   13 -
 52 files changed, 552 insertions(+), 530 deletions(-)

New commits:
commit 250bd093509fb99afa59d8d4290b8a996a0962c6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:09:24 2014 +0100

    Update notes about swapping
    
    Change-Id: I6b9f5f9c4a0bc87376a469835a50dc2cf598479e

diff --git a/svtools/README b/svtools/README
index b4f399c..dbcc30b 100644
--- a/svtools/README
+++ b/svtools/README
@@ -3,13 +3,14 @@ Tools on top of VCL. Common dialogs, file and print dialogs, wizards, vcl filter
 
 == Image swapping ==
 
-LO has three kind of swapout mechanisms:
+LO has two kind of swapout mechanisms:
 
-1) Manual swap out calls: Maybe it comes from old days, when memory was more expensive to use so LO tried to store
-images in the memory only when it is really used and swap out them directly after use. These manual calls seems
-useless nowadays and even ineffective.
-
-2) Size based auto swapping: when the size of all graphic objects reaches a configurable limit (20 MB by default)
+1) Size based auto swapping: when the size of all graphic objects reaches a configurable limit (20 MB by default)
 then some of the graphics are saved to the local file system and freed in the memory.
+Configure: Tools -> Options -> Memory -> GraphicsCache -> Use for LibreOffice
+
+2) Time based auto swapping: after an image is swapped in / loaded a timer starts and when the timer (1 min by default)
+has a time out this image is swapped out ( sometimes this time out is ignored when the image is in use ).
+Configure: Tools -> Options -> Memory -> GraphicsCache -> Remove from memory after
 
-3) Time based auto swapping: more info needed.
+Both swapping are done by GraphicObject and GraphicManager.
commit 8710b09b0ee272b7600611127d76ed4699863075
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue Nov 4 08:34:41 2014 +0100

    Optimize ImplCheckSizeOfSwappedInGraphics() a bit
    
    Store used size as a member so we don't need to recalculate it
    all the time and no need to use a size map.
    
    Change-Id: I1f929c5d3a56f545cef123bda087ecaf8ca0be4a

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index d515773..2bdbc9a 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -520,6 +520,7 @@ class SVT_DLLPUBLIC GraphicManager
 private:
 
     GraphicObjectList_impl  maObjList;
+    sal_uLong               mnUsedSize; // currently used memory footprint of all swapped in graphics
     GraphicCache*           mpCache;
 
                         GraphicManager( const GraphicManager& ) {}
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index d054ab3..2ff6192 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -34,7 +34,6 @@
 #include "grfcache.hxx"
 #include <svtools/grfmgr.hxx>
 #include <boost/scoped_array.hpp>
-#include <boost/unordered_map.hpp>
 
 // - defines -
 
@@ -48,7 +47,8 @@
 
 
 GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize ) :
-        mpCache( new GraphicCache( nCacheSize, nMaxObjCacheSize ) )
+    mnUsedSize(0),
+    mpCache( new GraphicCache( nCacheSize, nMaxObjCacheSize ) )
 {
 }
 
@@ -156,6 +156,8 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst
 
     maObjList.push_back( (GraphicObject*)&rObj );
     mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj );
+    if( !rObj.IsSwappedOut() )
+        mnUsedSize += rObj.GetSizeBytes();
 }
 
 void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
@@ -169,11 +171,14 @@ void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
         }
     }
     assert(false); // surely it should have been registered?
+    if( !rObj.IsSwappedOut() )
+        mnUsedSize -= rObj.GetSizeBytes();
 }
 
 void GraphicManager::ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj )
 {
     mpCache->GraphicObjectWasSwappedOut( rObj );
+    mnUsedSize -= rObj.GetSizeBytes();
 }
 
 OString GraphicManager::ImplGetUniqueID( const GraphicObject& rObj ) const
@@ -194,29 +199,6 @@ namespace
 
 void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore)
 {
-    // get the currently used memory footprint of all swapped in bitmap graphics
-    // of this graphic manager. Remember candidates in a vector. The size in bytes is
-    // already available, thus this loop is not expensive to execute
-    sal_uLong nUsedSize(0);
-    GraphicObject* pObj = 0;
-    std::vector< GraphicObject* > aCandidates;
-    boost::unordered_map<GraphicObject *, size_t> sizes;
-
-    for (size_t i = 0, n = maObjList.size(); i < n; ++i)
-    {
-        pObj = maObjList[i];
-        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes())
-        {
-            size_t const nSize = pObj->GetSizeBytes();
-            nUsedSize += nSize;
-            if( pObj != pGraphicToIgnore )
-            {
-                aCandidates.push_back(pObj);
-                sizes.insert(std::make_pair(pObj, nSize));
-            }
-        }
-    }
-
     // detect maximum allowed memory footprint. Use the user-settings of MaxCacheSize (defaulted
     // to 20MB) and add a decent multiplicator (experimented to find one). Limit to
     // a useful maximum for 32Bit address space
@@ -232,30 +214,33 @@ void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGrap
     // calc max allowed cache size
     const sal_uLong nMaxCacheSize(::std::min(GetMaxCacheSize() * aMultiplicator, aMaxSize32Bit));
 
-    if(nUsedSize >= nMaxCacheSize && !aCandidates.empty())
+    if(mnUsedSize >= nMaxCacheSize)
     {
+        // Copy the object list for now, because maObjList can change in the meantime unexpectedly.
+        std::vector< GraphicObject* > aCandidates(maObjList.begin(), maObjList.end());
         // if we use more currently, sort by last DataChangeTimeStamp
         // sort by DataChangeTimeStamp so that the oldest get removed first
         ::std::sort(aCandidates.begin(), aCandidates.end(), simpleSortByDataChangeTimeStamp());
 
-        for(sal_uInt32 a(0); nUsedSize >= nMaxCacheSize && a < aCandidates.size(); a++)
+        for(sal_uInt32 a(0); mnUsedSize >= nMaxCacheSize && a < aCandidates.size(); a++)
         {
             // swap out until we have no more or the goal to use less than nMaxCacheSize
             // is reached
-            pObj = aCandidates[a];
+            GraphicObject* pObj = aCandidates[a];
+            if( pObj == pGraphicToIgnore )
+            {
+                continue;
+            }
             if (std::find(maObjList.begin(), maObjList.end(), pObj) == maObjList.end())
             {
                 // object has been deleted when swapping out another one
-                nUsedSize = (sizes[pObj] < nUsedSize) ? nUsedSize - sizes[pObj] : 0;
                 continue;
             }
-            const sal_uLong nSizeBytes(pObj->GetSizeBytes());
 
             // do not swap out when we have less than 16KB data objects
-            if(nSizeBytes >= (16 * 1024))
+            if(pObj->GetSizeBytes() >= (16 * 1024))
             {
                 pObj->FireSwapOutRequest();
-                nUsedSize = (nSizeBytes < nUsedSize) ? nUsedSize - nSizeBytes : 0;
             }
         }
     }
@@ -269,6 +254,7 @@ bool GraphicManager::ImplFillSwappedGraphicObject( const GraphicObject& rObj, Gr
 void GraphicManager::ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj )
 {
     mpCache->GraphicObjectWasSwappedIn( rObj );
+    mnUsedSize += rObj.GetSizeBytes();
 }
 
 bool GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt,
commit 554902eac3361c67c6d76e0d7a237d9a16062dfe
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:44:20 2014 +0100

    Make SdrGrafObj swapping methods private.
    
    Plus remove some useless call of them.
    
    Change the tests accordingly.
    
    Change-Id: I47a50b5734d799ac02ee7221c95f82415afb9497

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index a333223..7eecc3f 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3970,7 +3970,6 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
 
         if ( bLinkGrf && !bGrfRead )
         {
-            static_cast<SdrGrafObj*>(pRet)->ForceSwapIn();
             Graphic aGraf(static_cast<SdrGrafObj*>(pRet)->GetGraphic());
             lcl_ApplyCropping( *this, &rSet, aGraf );
         }
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index cd47a207..d6cb3d2 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -69,6 +69,7 @@ private:
 
     // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
     friend class sdr::contact::ViewObjectContactOfGraphic;
+    friend class SdrExchangeView; // Only for a ForceSwapIn() call.
     friend class SdrGraphicLink;
 
 private:
@@ -135,9 +136,11 @@ public:
     void                    SetGrafStreamURL( const OUString& rGraphicStreamURL );
     OUString                GetGrafStreamURL() const;
 
+private:
     void                    ForceSwapIn() const;
     void                    ForceSwapOut() const;
 
+public:
     void                    SetGraphicLink(const OUString& rFileName, const OUString& rReferer, const OUString& rFilterName);
     void                    ReleaseGraphicLink();
     bool IsLinkedGraphic() const;
diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk
index 3316beb..1cfaf69 100644
--- a/sc/CppunitTest_sc_subsequent_export_test.mk
+++ b/sc/CppunitTest_sc_subsequent_export_test.mk
@@ -117,6 +117,10 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\
 ))
 endif
 
+$(eval $(call gb_CppunitTest_use_custom_headers,sc_subsequent_export_test,\
+	officecfg/registry \
+))
+
 $(eval $(call gb_CppunitTest_use_configuration,sc_subsequent_export_test))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/qa/unit/data/ods/document_with_an_image.ods b/sc/qa/unit/data/ods/document_with_two_images.ods
similarity index 66%
rename from sc/qa/unit/data/ods/document_with_an_image.ods
rename to sc/qa/unit/data/ods/document_with_two_images.ods
index adfcd4c..6e1cc68 100644
Binary files a/sc/qa/unit/data/ods/document_with_an_image.ods and b/sc/qa/unit/data/ods/document_with_two_images.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 4474caf..cdc7532 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <officecfg/Office/Common.hxx>
 #include <sal/config.h>
 #include <rtl/strbuf.hxx>
 #include <osl/file.hxx>
@@ -59,7 +60,7 @@
 #include <tools/datetime.hxx>
 
 #include <test/xmltesttools.hxx>
-
+#include <comphelper/processfactory.hxx>
 #include <com/sun/star/table/BorderLineStyle.hpp>
 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
@@ -2271,26 +2272,19 @@ void ScExportTest::testSwappedOutImageExport()
         "generic_HTML",
     };
 
+    // Set cache size to a very small value to make sure one of the images is swapped out
+    boost::shared_ptr< comphelper::ConfigurationChanges > xBatch(comphelper::ConfigurationChanges::create());
+    officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), xBatch);
+    xBatch->commit();
+
     for( size_t nFilter = 0; nFilter < aFilterNames.size(); ++nFilter )
     {
         // Check whether the export code swaps in the image which was swapped out before.
-        ScDocShellRef xDocSh = loadDoc("document_with_an_image.", ODS);
+        ScDocShellRef xDocSh = loadDoc("document_with_two_images.", ODS);
 
         const OString sFailedMessage = OString("Failed on filter: ")
                                        + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US);
-
-        // Find and swap out the image
         CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.Is());
-        ScDocument* pDoc = &xDocSh->GetDocument();
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc);
-        ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDrawLayer);
-        const SdrPage* pPage = pDrawLayer->GetPage(0);
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pPage);
-        const SdrObject* pObj = pPage->GetObj(0);
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pObj->GetObjIdentifier() == OBJ_GRAF);
-        const SdrGrafObj& rGrafObj = static_cast<const SdrGrafObj&>(*pObj);
-        rGrafObj.ForceSwapOut();
 
         // Export the document and import again for a check
         ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter);
@@ -2302,7 +2296,7 @@ void ScExportTest::testSwappedOutImageExport()
         uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
         uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xIA->getByIndex(0), UNO_QUERY_THROW);
         uno::Reference< container::XIndexAccess > xDraws(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(1), xDraws->getCount());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(2), xDraws->getCount());
 
         uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
         uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
@@ -2322,6 +2316,24 @@ void ScExportTest::testSwappedOutImageExport()
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
         }
+        // Second Image
+        xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
+        XPropSet.set( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:1000000000000384000002580A24B597"), sURL);
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(600), xBitmap->getSize().Height );
+        }
         xDocSh2->DoClose();
     }
 }
diff --git a/sd/CppunitTest_sd_export_tests.mk b/sd/CppunitTest_sd_export_tests.mk
index 68bdb32..a8f3dbf 100644
--- a/sd/CppunitTest_sd_export_tests.mk
+++ b/sd/CppunitTest_sd_export_tests.mk
@@ -106,6 +106,10 @@ $(eval $(call gb_CppunitTest_use_components,sd_export_tests,\
     xmlsecurity/util/xmlsecurity \
 ))
 
+$(eval $(call gb_CppunitTest_use_custom_headers,sd_export_tests,\
+	officecfg/registry \
+))
+
 $(eval $(call gb_CppunitTest_use_configuration,sd_export_tests))
 
 $(eval $(call gb_CppunitTest_use_unittest_configuration,sd_export_tests))
diff --git a/sd/qa/unit/data/odp/document_with_an_image.odp b/sd/qa/unit/data/odp/document_with_an_image.odp
deleted file mode 100644
index 9e0bdce..0000000
Binary files a/sd/qa/unit/data/odp/document_with_an_image.odp and /dev/null differ
diff --git a/sd/qa/unit/data/odp/document_with_two_images.odp b/sd/qa/unit/data/odp/document_with_two_images.odp
new file mode 100644
index 0000000..33fb9bb
Binary files /dev/null and b/sd/qa/unit/data/odp/document_with_two_images.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 0dfc468..08f8547 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -6,10 +6,10 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
-
+#include <officecfg/Office/Common.hxx>
 #include "sdmodeltestbase.hxx"
 #include "Outliner.hxx"
-
+#include <comphelper/processfactory.hxx>
 #include <svl/stritem.hxx>
 #include <editeng/editobj.hxx>
 #include <editeng/outlobj.hxx>
@@ -504,21 +504,17 @@ void SdExportTest::testSwappedOutImageExport()
         PPTX,
     };
 
+    // Set cache size to a very small value to make sure one of the images is swapped out
+    boost::shared_ptr< comphelper::ConfigurationChanges > xBatch(comphelper::ConfigurationChanges::create());
+    officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), xBatch);
+    xBatch->commit();
+
     for( size_t nExportFormat = 0; nExportFormat < vFormats.size(); ++nExportFormat )
     {
         // Load the original file with one image
-        ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_an_image.odp"), ODP);
+        ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_two_images.odp"), ODP);
         const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[nExportFormat].pFilterName);
 
-        // Swap out the image
-        SdDrawDocument *pDoc = xDocShRef->GetDoc();
-        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != NULL );
-        const SdrPage* pPage = pDoc->GetPage(1);
-        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL );
-        SdrGrafObj* pGrafObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pGrafObject != NULL);
-        pGrafObject->ForceSwapOut();
-
         // Export the document and import again for a check
         uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
         uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
@@ -534,7 +530,7 @@ void SdExportTest::testSwappedOutImageExport()
 
         // Check whether graphic exported well after it was swapped out
         uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY);
-        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), xDrawPagesSupplier->getDrawPages()->getCount() == 1 );
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), xDrawPagesSupplier->getDrawPages()->getCount() == 2 );
         uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
 
         uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(2), uno::UNO_QUERY);
@@ -554,6 +550,26 @@ void SdExportTest::testSwappedOutImageExport()
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
         }
+
+        // Second Image
+        xDrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
+        xImage.set(xDrawPage->getByIndex(1), uno::UNO_QUERY);
+        XPropSet.set( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:1000000000000384000002580A24B597"), sURL);
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(600), xBitmap->getSize().Height );
+        }
         xDocShRef->DoClose();
     }
 }
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index a445b75..c95b42d 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -245,8 +245,6 @@ namespace sdr
             // prepare primitive generation with evtl. loading the graphic when it's swapped out
             SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
             bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
-            bool bSwapInDone(false);
-            bool bSwapInExclusive(false);
 
             if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() )
             {
@@ -262,16 +260,15 @@ namespace sdr
                     || GetObjectContact().isOutputToPDFFile() )
                 {
                     bDoAsynchronGraphicLoading = false;
-                    bSwapInExclusive = true;
                 }
             }
             if( bDoAsynchronGraphicLoading )
             {
-                bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
+                const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
             }
             else
             {
-                bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
+                const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
             }
 
             // get return value by calling parent
@@ -294,12 +291,6 @@ namespace sdr
                 }
             }
 
-            // if swap in was forced only for printing metafile and pdf, swap out again
-            if( bSwapInDone && bSwapInExclusive )
-            {
-                rGrafObj.ForceSwapOut();
-            }
-
             return xRetval;
         }
 
commit 9dc3b49c891fb9fe45c24de4b7e1e88fe400afe0
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Nov 2 11:47:04 2014 +0100

    Remove some useless swapping call inside SwGrfNode
    
    Change-Id: I4cd2677197c7a6cff71e2966c2b2dd2285032c07

diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 9973837..47c2740 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -341,7 +341,6 @@ void SwGrfNode::onGraphicChanged()
 
     if(pFlyFmt)
     {
-        const bool bWasSwappedOut = GetGrfObj().IsSwappedOut();
         OUString aName;
         OUString aTitle;
         OUString aDesc;
@@ -382,11 +381,6 @@ void SwGrfNode::onGraphicChanged()
         {
             SetDescription(aDesc);
         }
-
-        if (bWasSwappedOut)
-        {
-            SwapOut();
-        }
     }
 }
 
@@ -675,10 +669,6 @@ bool SwGrfNode::SavePersistentData()
         return true;
     }
 
-    // swap in first if already in storage
-    if( HasEmbeddedStreamName() && !SwapIn() )
-        return false;
-
     // #i44367#
     // Do not delete graphic file in storage, because the graphic file could
     // be referenced by other graphic nodes.
@@ -997,9 +987,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
     }
     else
     {
-        if( maGrfObj.IsSwappedOut() )
-            const_cast<SwGrfNode*>(this)->SwapIn();
-        aTmpGrf = maGrfObj.GetGraphic();
+        aTmpGrf = GetGrf();
     }
 
     const sfx2::LinkManager& rMgr = getIDocumentLinksAdministration()->GetLinkManager();
commit 61a5abd5fab308c9e6580e752fa846f5bf0d7e51
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:43:34 2014 +0100

    Make SwGrfNode swapping methods private
    
    Change the filter test accordingly.
    
    Change-Id: Ide3043f2f245c097a7b4c07ba2e0713510296b3e

diff --git a/sw/CppunitTest_sw_globalfilter.mk b/sw/CppunitTest_sw_globalfilter.mk
index 96787c0..b25bc89 100644
--- a/sw/CppunitTest_sw_globalfilter.mk
+++ b/sw/CppunitTest_sw_globalfilter.mk
@@ -83,6 +83,10 @@ $(eval $(call gb_CppunitTest_use_components,sw_globalfilter,\
 	xmloff/util/xo \
 ))
 
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_globalfilter,\
+	officecfg/registry \
+))
+
 $(eval $(call gb_CppunitTest_use_configuration,sw_globalfilter))
 
 $(eval $(call gb_CppunitTest_use_unittest_configuration,sw_globalfilter))
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 5a2dcbd..f8f9e46 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -169,10 +169,13 @@ public:
                  const Graphic* pGraphic = 0,
                  const GraphicObject* pGrfObj = 0,
                  bool bModify = true );
+private:
     /// Loading of graphic immediately before displaying.
     bool SwapIn( bool bWaitForData = false );
     /// Remove graphic in order to free memory.
     bool SwapOut();
+
+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)
diff --git a/sw/qa/extras/globalfilter/data/document_with_an_image.odt b/sw/qa/extras/globalfilter/data/document_with_an_image.odt
deleted file mode 100644
index ce7a29a..0000000
Binary files a/sw/qa/extras/globalfilter/data/document_with_an_image.odt and /dev/null differ
diff --git a/sw/qa/extras/globalfilter/data/document_with_two_images.odt b/sw/qa/extras/globalfilter/data/document_with_two_images.odt
new file mode 100644
index 0000000..54d3d66
Binary files /dev/null and b/sw/qa/extras/globalfilter/data/document_with_two_images.odt differ
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index b31afe3..1fd4331 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -11,11 +11,13 @@
 
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
-
+#include <officecfg/Office/Common.hxx>
+#include <comphelper/processfactory.hxx>
 #include <unotxdoc.hxx>
 #include <docsh.hxx>
 #include <doc.hxx>
 #include <ndgrf.hxx>
+#include <drawdoc.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -40,31 +42,19 @@ void Test::testSwappedOutImageExport()
 
     for( size_t nFilter = 0; nFilter < aFilterNames.size(); ++nFilter )
     {
-        // Check whether the export code swaps in the image which was swapped out before.
+        // Check whether the export code swaps in the image which was swapped out before by auto mechanism
+
+        // Set cache size to a very small value to make sure one of the images is swapped out
+        boost::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
+        officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch);
+        batch->commit();
+
         if (mxComponent.is())
             mxComponent->dispose();
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_an_image.odt"), "com.sun.star.text.TextDocument");
+        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument");
 
         const OString sFailedMessage = OString("Failed on filter: ")
                                        + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US);
-        SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTxtDoc);
-        SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc);
-        SwNodes& aNodes = pDoc->GetNodes();
-
-        // Find and swap out the image
-        bool bImageFound = false;
-        for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
-        {
-            if( aNodes[nIndex]->IsGrfNode() )
-            {
-                SwGrfNode* pGrfNode = aNodes[nIndex]->GetGrfNode();
-                pGrfNode->SwapOut();
-                bImageFound = true;
-            }
-        }
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), bImageFound);
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -82,8 +72,9 @@ void Test::testSwappedOutImageExport()
         // Check whether graphic exported well after it was swapped out
         uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
         uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(1), xDraws->getCount());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(2), xDraws->getCount());
 
+        // First image
         uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
         uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
         // Check URL
@@ -102,6 +93,35 @@ void Test::testSwappedOutImageExport()
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
         }
+
+        // Second Image
+        xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
+        XPropSet.set( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            // HTML filter changes the name, but the real indicater here is the "null" URL.
+            if( aFilterNames[nFilter] == "HTML (StarWriter)" )
+            {
+                CPPUNIT_ASSERT_MESSAGE(
+                    sFailedMessage.getStr(), sURL != OUString("vnd.sun.star.GraphicObject:00000000000000000000000000000000"));
+            }
+            else
+            {
+                CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:1000000000000384000002580A24B597"), sURL);
+            }
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(600), xBitmap->getSize().Height );
+        }
     }
 }
 
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 612b785..9f45a32 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -599,8 +599,6 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
                         }
                     } while( pVSh != (pSh = (SwViewShell*)pSh->GetNext() ));
                 }
-                else
-                    pNd->SwapIn();
             }
         }
         break;
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 83db824..5755bcd 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -563,7 +563,6 @@ IMAGE_SETEVENT:
     Size aGrfSz( 0, 0 );
     bool bSetTwipSize = true;       // Twip-Size am Node setzen?
     bool bChangeFrmSize = false;    // Frame-Format nachtraeglich anpassen?
-    bool bRequestGrfNow = false;
     bool bSetScaleImageMap = false;
     sal_uInt8 nPrcWidth = 0, nPrcHeight = 0;
 
@@ -575,7 +574,6 @@ IMAGE_SETEVENT:
         // Tabelle layoutet wird.
         if( pTable!=0 && !nWidth )
         {
-            bRequestGrfNow = true;
             IncGrfsThatResizeTable();
         }
 
@@ -799,14 +797,6 @@ IMAGE_SETEVENT:
     if( !aMacroItem.GetMacroTable().empty() )
         pFlyFmt->SetFmtAttr( aMacroItem );
 
-    // Wenn die Grafik gleich angeforder wird, muss dies geschehen,
-    // nachdem das Format vollstaendig aufgebaut ist, weil es evtl.
-    // gleich (synchron) angepasst wird (war bug #40983#)
-    if (bRequestGrfNow && pGrfNd)
-    {
-        pGrfNd->SwapIn();
-    }
-
     // Ggf. Frames anlegen und Auto-gebundenen Rahmen registrieren
     RegisterFlyFrm( pFlyFmt );
 
commit 398b3092d1545163e2013ed40d4d7fbe03f71907
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sat Nov 1 01:08:49 2014 +0100

    Why to have this compromise, do that what we say the users we do.
    
    Change-Id: Ia599644ff1f7591ac84bdca988883eaf5860297e

diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 63a3b9d..5abdd9e 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -441,25 +441,13 @@ void GraphicObject::SetSwapStreamHdl()
     }
 }
 
-// #i122985# it is not correct to set the swap-timeout to a hard-coded 5000ms
-// as it was before.  Added code and experimented what to do as a good
-// compromise, see description.
 static sal_uInt32 GetCacheTimeInMs()
 {
     const sal_uInt32 nSeconds =
         officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::get(
             comphelper::getProcessComponentContext());
 
-
-    // The default is 10 minutes. The minimum is one minute, thus 60
-    // seconds. When the minimum should match to the former hard-coded
-    // 5 seconds, we have a divisor of 12 to use. For the default of 10
-    // minutes this would mean 50 seconds. Compared to before this is
-    // ten times more (would allow better navigation by switching
-    // through pages) and is controllable by the user by setting the
-    // tools/options/memory/Remove_from_memory_after setting. Seems to
-    // be a good compromise to me.
-    return nSeconds * 1000 / 12;
+    return nSeconds * 1000;
 }
 
 void GraphicObject::SetSwapStreamHdl(const Link& rHdl)
commit 4c9aa743fc83b3f3c5b35eeff79c1ffdae90c1fa
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:42:55 2014 +0100

    Swapping Graphic is a privilage of GraphicObject.
    
    This means more things:
    * Graphic won't swap out itself, so those classes which uses
    Graphic without GraphicObject won't need to deal with swapping.
    * When a Graphic is queried from GraphicObject the caller won't
    need to deal with swapping, because GraphicObject swaps it in
    before return.
    * GraphicObject will swap in the Graphic always when a swapping
    dependent data is queried (e.g. whole graphic, transformed graphic
    or AnimationNotifyHdl)
    
    Change-Id: I2bf6e37291ec94146f10aac4a35084682437ed16

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index d9c1954..d515773 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -412,7 +412,7 @@ public:
     bool                    IsAnimated() const { return mbAnimated; }
     bool                    IsEPS() const { return mbEPS; }
 
-    Link                    GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
+    Link                    GetAnimationNotifyHdl() const { return GetGraphic().GetAnimationNotifyHdl(); }
 
     bool                    SwapOut();
     bool                    SwapOut( SvStream* pOStm );
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index b55e7901..8727b9c 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -176,6 +176,8 @@ public:
     const OUString&       GetDocFileName() const;
     sal_uLong               GetDocFilePos() const;
 
+private:
+    friend class GraphicObject;
     bool                SwapOut();
     void                SwapOutAsLink();
     bool                SwapOut( SvStream* pOStm );
@@ -183,6 +185,7 @@ public:
     bool                SwapIn( SvStream* pIStm );
     bool                IsSwapOut() const;
 
+public:
     void                SetLink( const GfxLink& );
     GfxLink             GetLink() const;
     bool                IsLink() const;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7a9689b..6b0e4dc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -866,19 +866,6 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
             GraphicType aType = rGraphic.GetType();
             if ( aType == GRAPHIC_BITMAP || aType == GRAPHIC_GDIMETAFILE)
             {
-                bool bSwapped = rGraphic.IsSwapOut();
-
-                //Warn rather than just happily swap in because of the comments
-                //in the sw export filters about needing to go through the
-                //hairy SwGrfNode::SwapIn which we would subvert by swapping in
-                //without it knowing about it, so while those ones are fixed we
-                //probably have to assume that we should ideally be presented
-                //here with already swapped in graphics.
-                SAL_WARN_IF(bSwapped, "oox", "attempted to output swapped out graphic");
-
-                if (bSwapped)
-                    const_cast<Graphic&>(rGraphic).SwapIn();
-
                 if ( aType == GRAPHIC_BITMAP )
                 {
                     GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index fa87a2e..63a3b9d 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -694,9 +694,7 @@ void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData )
 const Graphic& GraphicObject::GetGraphic() const
 {
     GraphicObject *pThis = const_cast<GraphicObject*>(this);
-
-    if (mbAutoSwapped)
-        pThis->ImplAutoSwapIn();
+    pThis->SwapIn();
 
     //fdo#50697 If we've been asked to provide the graphic, then reset
     //the cache timeout to start from now and not remain at the
@@ -736,7 +734,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const OUString& rLink )
 Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const
 {
     // #104550# Extracted from svx/source/svdraw/svdograf.cxx
-    Graphic             aTransGraphic( maGraphic );
+    Graphic             aTransGraphic( GetGraphic() );
     const GraphicType   eType = GetType();
     const Size          aSrcSize( aTransGraphic.GetPrefSize() );
 
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 7f93bf9..d054ab3 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -279,7 +279,7 @@ bool GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt,
     const Graphic&  rGraphic = rObj.GetGraphic();
     bool            bRet = false;
 
-    if( rGraphic.IsSupportedGraphic() && !rGraphic.IsSwapOut() )
+    if( rGraphic.IsSupportedGraphic() && !rObj.IsSwappedOut() )
     {
         if( GRAPHIC_BITMAP == rGraphic.GetType() )
         {
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c563f6a..e7305fd 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4089,11 +4089,6 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
             // Not in cache, then need to write it.
             m_rDrawingML.SetFS( m_pSerializer ); // to be sure that we write to the right stream
 
-            if (pGraphic->IsSwapOut() && !pGrfNode)
-            {
-                const_cast<Graphic*>(pGraphic)->SwapIn();
-            }
-
             OUString aImageId = m_rDrawingML.WriteImage( *pGraphic );
 
             aRelId = OUStringToOString( aImageId, RTL_TEXTENCODING_UTF8 );
diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx
index 68e4e07..65cc919 100644
--- a/vcl/source/gdi/cvtgrf.cxx
+++ b/vcl/source/gdi/cvtgrf.cxx
@@ -56,8 +56,6 @@ sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLon
 
 sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat )
 {
-    SAL_WARN_IF(rGraphic.IsSwapOut(), "vcl.filter", "exporting a swapped out graphic!");
-
     GraphicConverter*   pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
     sal_uLong               nRet = ERRCODE_IO_GENERAL;
 
commit 78657d31ca3118759b7e817d12886f3b713aea07
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Oct 31 18:27:30 2014 +0100

    Remove unused Graphic member of SwOLENode
    
    Change-Id: Iaff7e86a8e11e9befc6feacdafd3a78a1971bbcd

diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index a3622e1..65189ee 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -71,7 +71,6 @@ class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode
 {
     friend class SwNodes;
     mutable SwOLEObj aOLEObj;
-    Graphic*    pGraphic;
     OUString sChartTblName;     ///< with chart objects: name of referenced table.
     bool   bOLESizeInvalid; /**< Should be considered at SwDoc::PrtOLENotify
                                    (e.g. copied). Is not persistent. */
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 35df868..3963946 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -211,7 +211,6 @@ SwOLENode::SwOLENode( const SwNodeIndex &rWhere,
                     SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_OLENODE, pGrfColl, pAutoAttr ),
     aOLEObj( xObj ),
-    pGraphic(0),
     bOLESizeInvalid( false ),
     mpObjectLink( NULL )
 {
@@ -225,7 +224,6 @@ SwOLENode::SwOLENode( const SwNodeIndex &rWhere,
                     SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_OLENODE, pGrfColl, pAutoAttr ),
     aOLEObj( rString, nAspect ),
-    pGraphic(0),
     bOLESizeInvalid( false ),
     mpObjectLink( NULL )
 {
@@ -235,14 +233,13 @@ SwOLENode::SwOLENode( const SwNodeIndex &rWhere,
 SwOLENode::~SwOLENode()
 {
     DisconnectFileLink_Impl();
-    delete pGraphic;
 }
 
 const Graphic* SwOLENode::GetGraphic()
 {
     if ( aOLEObj.GetOleRef().is() )
         return aOLEObj.xOLERef.GetGraphic();
-    return pGraphic;
+    return 0;
 }
 
 SwCntntNode *SwOLENode::SplitCntntNode( const SwPosition & )
commit c163d06882b9ef39165bf277606fc70f7ed0435e
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Nov 3 16:44:42 2014 +0100

    Be explicit here when to swap out as a link
    
    Change-Id: I70dd00d5f82c5f4f622805e1d6ee1dfc30900b31

diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 3cd7ef9..9973837 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -620,17 +620,16 @@ bool SwGrfNode::SwapOut()
         maGrfObj.GetType() != GRAPHIC_NONE &&
         !maGrfObj.IsSwappedOut() && !bInSwapIn )
     {
-        if( !refLink.Is() )
+        if( refLink.Is() || HasEmbeddedStreamName() )
         {
-            // Swapping is only needed for embedded pictures.
-            // The graphic will be written into a temp file if it is new, i.e.
-            // if there is no stream name in the storage yet
-            if( !HasEmbeddedStreamName() )
-                if( !maGrfObj.SwapOut() )
-                    return false;
+            // written graphics and links are removed here
+            return maGrfObj.SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK );
         }
-        // written graphics and links are removed here
-        return maGrfObj.SwapOut( GRFMGR_AUTOSWAPSTREAM_LINK );
+        else
+        {
+            return maGrfObj.SwapOut();
+        }
+
     }
     return true;
 }
commit 9e68beb85da94386443f53ff9f8bd4685f2c50ea
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:41:51 2014 +0100

    More replacements of manual swapping with SwGrfNode::GetGrf()/GetGrfObj()
    
    Change-Id: Ie56584c03af8a6d3ea8f8d4294f5492a841933b7

diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 2b50fce..5a2dcbd 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -123,8 +123,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
 
 public:
     virtual ~SwGrfNode();
-    const Graphic&          GetGrf() const;
-    const GraphicObject&    GetGrfObj() const;
+    const Graphic&          GetGrf(bool bWait = false) const;
+    const GraphicObject&    GetGrfObj(bool bWait = false) const;
     const GraphicObject* GetReplacementGrfObj() const;
     virtual SwCntntNode *SplitCntntNode( const SwPosition & ) SAL_OVERRIDE;
 
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 563144a..612b785 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -879,7 +879,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
         }
 
         bool bContinue = true;
-        const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
+        const GraphicObject& rGrfObj = pGrfNd->GetGrfObj(bPrn);
 
         GraphicAttr aGrfAttr;
         pGrfNd->GetGraphicAttr( aGrfAttr, this );
@@ -917,8 +917,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
 
         if( bContinue )
         {
-            const bool bSwappedIn = pGrfNd->SwapIn( bPrn );
-            if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
+            if( rGrfObj.GetGraphic().IsSupportedGraphic())
             {
                 const bool bAnimate = rGrfObj.IsAnimated() &&
                                          !pShell->IsPreview() &&
@@ -955,13 +954,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
             else
             {
                 sal_uInt16 nResId = 0;
-                if( bSwappedIn )
-                {
-                    if( GRAPHIC_NONE == rGrfObj.GetType() )
-                        nResId = STR_COMCORE_READERROR;
-                    else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
-                        nResId = STR_COMCORE_CANT_SHOW;
-                }
+
+                if( GRAPHIC_NONE == rGrfObj.GetType() )
+                    nResId = STR_COMCORE_READERROR;
+                else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
+                    nResId = STR_COMCORE_CANT_SHOW;
+
                 ((SwNoTxtFrm*)this)->nWeight = -1;
                 OUString aText;
                 if ( !nResId &&
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index 7a325c9..dfb38b1 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -251,8 +251,7 @@ Graphic SwNoTxtNode::GetGraphic() const
     Graphic aRet;
     if ( GetGrfNode() )
     {
-        ((SwGrfNode*)this)->SwapIn( true );
-        aRet = ((SwGrfNode*)this)->GetGrf();
+        aRet = ((SwGrfNode*)this)->GetGrf(true);
     }
     else
     {
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index c59b59c..f9df512 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -238,28 +238,7 @@ const Graphic* SwEditShell::GetGraphic( bool bWait ) const
     const Graphic* pGrf( 0L );
     if ( pGrfNode )
     {
-        pGrf = &(pGrfNode->GetGrf());
-        // --> #i73788#
-        // no load of linked graphic, if its not needed now (bWait = sal_False).
-        if ( bWait )
-        {
-            if( pGrf->IsSwapOut() ||
-                ( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) )
-            {
-                bool const bResult = pGrfNode->SwapIn(bWait);
-                OSL_ENSURE(bResult || !bWait, "Graphic could not be loaded" );
-                (void) bResult; // unused in non-debug
-            }
-        }
-        else
-        {
-            if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() )
-            {
-                bool const bResult = pGrfNode->SwapIn(bWait);
-                OSL_ENSURE(bResult || !bWait, "Graphic could not be loaded" );
-                (void) bResult; // unused in non-debug
-            }
-        }
+        pGrf = &(pGrfNode->GetGrf(bWait && GRAPHIC_DEFAULT == pGrfNode->GetGrf().GetType()));
     }
     return pGrf;
 }
@@ -611,15 +590,7 @@ Graphic SwEditShell::GetIMapGraphic() const
         if( rNd.IsGrfNode() )
         {
             SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
-            const Graphic& rGrf = rGrfNode.GetGrf();
-            if( rGrf.IsSwapOut() || ( rGrfNode.IsLinkedFile() &&
-                                    GRAPHIC_DEFAULT == rGrf.GetType() ) )
-            {
-                bool const bResult = rGrfNode.SwapIn(true);
-                OSL_ENSURE(bResult, "Graphic could not be loaded" );
-                (void) bResult; // unused in non-debug
-            }
-            aRet = rGrf;
+            aRet = rGrfNode.GetGrf(GRAPHIC_DEFAULT == rGrfNode.GetGrf().GetType());
         }
         else if ( rNd.IsOLENode() )
         {
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 0f77236..8c104cb 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1557,8 +1557,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
                 pNd->GetFileFilterNms( &rName, 0 );
                 if ( rName.isEmpty() )
                     rName = pFly->GetFmt()->GetName();
-                pNd->SwapIn( true );
-                return &pNd->GetGrf();
+                return &pNd->GetGrf(true);
             }
         }
     }
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 6a3e587..3cd7ef9 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -396,15 +396,15 @@ void SwGrfNode::SetGraphic(const Graphic& rGraphic, const OUString& rLink)
     onGraphicChanged();
 }
 
-const Graphic& SwGrfNode::GetGrf() const
+const Graphic& SwGrfNode::GetGrf(bool bWait) const
 {
-    const_cast<SwGrfNode*>(this)->SwapIn();
+    const_cast<SwGrfNode*>(this)->SwapIn(bWait);
     return maGrfObj.GetGraphic();
 }
 
-const GraphicObject& SwGrfNode::GetGrfObj() const
+const GraphicObject& SwGrfNode::GetGrfObj(bool bWait) const
 {
-    const_cast<SwGrfNode*>(this)->SwapIn();
+    const_cast<SwGrfNode*>(this)->SwapIn(bWait);
     return maGrfObj;
 }
 
@@ -461,7 +461,7 @@ Size SwGrfNode::GetTwipSize() const
 {
     if( !nGrfSize.Width() && !nGrfSize.Height() )
     {
-        const_cast<SwGrfNode*>(this)->SwapIn(true);
+        const_cast<SwGrfNode*>(this)->SwapIn();
     }
     return nGrfSize;
 }
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 06694b3..cd9c856 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -851,8 +851,7 @@ void SwUndoReRead::SaveGraphicData( const SwGrfNode& rGrfNd )
     }
     else
     {
-        ((SwGrfNode&)rGrfNd).SwapIn( true );
-        pGrf = new Graphic( rGrfNd.GetGrf() );
+        pGrf = new Graphic( rGrfNd.GetGrf(true) );
         pNm = pFltr = 0;
     }
     nMirr = rGrfNd.GetSwAttrSet().GetMirrorGrf().GetValue();
commit 5e52aa124b444a34edbef823a91c63ccd58dc17c
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 15:52:31 2014 +0100

    Make GetTwipSize() call SwapIn() by itself in case of invalid size
    
    Change-Id: I5bc6cf097e61d65007dde531af4a213b19e8ca5b

diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index ecbc5a0..6a3e587 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -459,6 +459,10 @@ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
 
 Size SwGrfNode::GetTwipSize() const
 {
+    if( !nGrfSize.Width() && !nGrfSize.Height() )
+    {
+        const_cast<SwGrfNode*>(this)->SwapIn(true);
+    }
     return nGrfSize;
 }
 
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index c806790..db5cb5b 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2130,22 +2130,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
             if(pIdx)
             {
                 SwNodeIndex aIdx(*pIdx, 1);
-                // --> OD #i85105#
-                Size aActSize;
-                {
-                    SwGrfNode* pGrfNode = dynamic_cast<SwGrfNode*>(aIdx.GetNode().GetNoTxtNode());
-                    if ( pGrfNode )
-                    {
-                        aActSize = pGrfNode->GetTwipSize();
-                        if ( aActSize.Width() == 0 && aActSize.Height() == 0 &&
-                             pGrfNode->IsLinkedFile() )
-                        {
-                            pGrfNode->SwapIn( true );
-                            aActSize = pGrfNode->GetTwipSize();
-                        }
-                    }
-                }
-                // <--
+                Size aActSize = aIdx.GetNode().GetNoTxtNode()->GetTwipSize();
                 awt::Size aTmp;
                 aTmp.Width = convertTwipToMm100(aActSize.Width());
                 aTmp.Height = convertTwipToMm100(aActSize.Height());
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 8ff19a0..4b9e916 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -415,27 +415,6 @@ namespace sw
             virtual void Write(Writer &rWrt) = 0;
         };
 
-        /** Given a SwNoTxtNode (ole/graphic) get original size
-
-            Get the uncropped and unscaled size of the underlying graphic or
-            ole object associated with a given SwNoTxtNode.
-
-            This function will swap in the graphic if it is swapped out from
-            the graphic or object cache, but will swap it out if that was the
-            case, i.e.  rNd is logically unchanged before and after
-            GetSwappedInSize, though not physically const
-
-            @param rNd
-                the SwNoTxtNode whose objects original size we want
-
-            @return
-                the uncropped unscaled size of the SwNoTxtNode
-
-            @author
-                <a href="mailto:cmc at openoffice.org">Caolán McNamara</a>
-        */
-        Size GetSwappedInSize(const SwNoTxtNode& rNd);
-
         struct CharRunEntry
         {
             sal_Int32 mnEndPos;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index b989b25..cee683b 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3560,7 +3560,7 @@ static OString ExportPICT(const SwFlyFrmFmt* pFlyFrmFmt, const Size& rOrig, cons
 void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode& rOLENode, const Size& rSize)
 {
     m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
-    Size aSize(sw::util::GetSwappedInSize(rOLENode));
+    Size aSize(rOLENode.GetTwipSize());
     Size aRendered(aSize);
     aRendered.Width() = rSize.Width();
     aRendered.Height() = rSize.Height();
@@ -3697,7 +3697,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
     const SwCropGrf& rCr = (const SwCropGrf&)pGrfNode->GetAttr(RES_GRFATR_CROPGRF);
 
     //Get original size in twips
-    Size aSize(sw::util::GetSwappedInSize(*pGrfNode));
+    Size aSize(pGrfNode->GetTwipSize());
     Size aRendered(aSize);
 
     const SwFmtFrmSize& rS = pFlyFrmFmt->GetFrmSize();
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index ad68371..3d52fecd 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -205,7 +205,6 @@ namespace sw
                 {
                     SwNodeIndex aIdx(*pIdx, 1);
                     const SwNode &rNd = aIdx.GetNode();
-                    using sw::util::GetSwappedInSize;
                     // #i43447# - determine layout size
                     {
                         SwRect aLayRect( rFmt.FindLayoutRect() );
@@ -222,11 +221,11 @@ namespace sw
                     {
                         case ND_GRFNODE:
                             meWriterType = eGraphic;
-                            maSize = GetSwappedInSize(*rNd.GetNoTxtNode());
+                            maSize = rNd.GetNoTxtNode()->GetTwipSize();
                             break;
                         case ND_OLENODE:
                             meWriterType = eOle;
-                            maSize = GetSwappedInSize(*rNd.GetNoTxtNode());
+                            maSize = rNd.GetNoTxtNode()->GetTwipSize();
                             break;
                         default:
                             meWriterType = eTxtBox;
@@ -692,23 +691,6 @@ namespace sw
             return aPoly;
         }
 
-        Size GetSwappedInSize(const SwNoTxtNode& rNd)
-        {
-            Size aGrTwipSz(rNd.GetTwipSize());
-            if ((!aGrTwipSz.Width() || !aGrTwipSz.Height()))
-            {
-                SwGrfNode *pGrfNode = const_cast<SwGrfNode*>(rNd.GetGrfNode());
-                if (pGrfNode && (GRAPHIC_NONE != pGrfNode->GetGrf().GetType()))
-                {
-                    pGrfNode->SwapIn();
-                    aGrTwipSz = pGrfNode->GetTwipSize();
-                }
-            }
-
-            OSL_ENSURE(aGrTwipSz.Width() && aGrTwipSz.Height(), "0 x 0 graphic ?");
-            return aGrTwipSz;
-        }
-
         void RedlineStack::open(const SwPosition& rPos, const SfxPoolItem& rAttr)
         {
             OSL_ENSURE(rAttr.Which() == RES_FLTR_REDLINE, "not a redline");
commit ed69a99eff3723f63aaa5f701bb458609399d0bc
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:40:14 2014 +0100

    More unused swapping related methods / member of SdrPage
    
    Change-Id: I4a979dd09418df4526409d9026d6abb98c6bf954

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index dd85bd6..21fbc35 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -465,7 +465,6 @@ protected:
     bool                mbMaster : 1;               // flag if this is a MasterPage
     bool                mbInserted : 1;
     bool                mbObjectsNotPersistent : 1;
-    bool                mbSwappingLocked : 1;
 
     // #i93597#
     bool                mbPageBorderOnlyLeftRight : 1;
@@ -541,14 +540,6 @@ public:
     virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV, const Rectangle* pRect) const;
     bool IsObjectsNotPersistent() const          { return mbObjectsNotPersistent; }
     void SetObjectsNotPersistent(bool b)     { mbObjectsNotPersistent = b; }
-    // Durch Setzen dieses Flags, kann das Auslagern (Swappen) von
-    // Teilen der Page (z.B. Grafiken) unterbunden werden.
-    // Es werden hierdurch jedoch nicht automatisch alle ausgelagerten
-    // Teile nachgeladen, dies geschieht erst bei konkretem Bedarf oder
-    // durch Aufruf von SwapInAll().
-    // Fuer die MasterPage(s) der Page muss dies ggf. separat gemacht werden.
-    bool IsSwappingLocked() const { return mbSwappingLocked; }
-    void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; }
 
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage();
 
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 79cefe1..46ed346 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1217,7 +1217,6 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
     mbMaster(bMasterPage),
     mbInserted(false),
     mbObjectsNotPersistent(false),
-    mbSwappingLocked(false),
     mbPageBorderOnlyLeftRight(false)
 {
     aPrefVisiLayers.SetAll();
@@ -1243,7 +1242,6 @@ SdrPage::SdrPage(const SdrPage& rSrcPage)
     mbMaster(rSrcPage.mbMaster),
     mbInserted(false),
     mbObjectsNotPersistent(rSrcPage.mbObjectsNotPersistent),
-    mbSwappingLocked(rSrcPage.mbSwappingLocked),
     mbPageBorderOnlyLeftRight(rSrcPage.mbPageBorderOnlyLeftRight)
 {
     aPrefVisiLayers.SetAll();
@@ -1339,7 +1337,6 @@ SdrPage& SdrPage::operator=(const SdrPage& rSrcPage)
     // a valid copy of source page before copying and inserting
     // the contained objects
     mbMaster = rSrcPage.mbMaster;
-    mbSwappingLocked = rSrcPage.mbSwappingLocked;
     mbPageBorderOnlyLeftRight = rSrcPage.mbPageBorderOnlyLeftRight;
     aPrefVisiLayers = rSrcPage.aPrefVisiLayers;
     nWdt = rSrcPage.nWdt;
commit 154fcad53fa4f298d23f2036b53a301fb3a80190
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Nov 7 10:39:57 2014 +0100

    ForceSwap{In,Out}Objects methods are unused now
    
    They are called only by themselves recuirsively,
    but not from outside.
    
    Change-Id: I1cde392c95bbc60ac7937d0bf3cd4b0fd062568b

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index f8d4300..dd85bd6 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -169,11 +169,6 @@ public:
     // Zaehlt alle Objekte inkl. Objekte in Objektgruppen, ...
     size_t CountAllObjects() const;
 
-    // Alle aufgelagerten Teile (z.B. Grafiken) der Liste in den
-    // Speicher laden.
-    void    ForceSwapInObjects() const;
-    void    ForceSwapOutObjects() const;
-
     /** Makes the object list flat, i.e. the object list content are
         then tree leaves
 
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 1653fab..79cefe1 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -735,37 +735,6 @@ size_t SdrObjList::CountAllObjects() const
     return nCnt;
 }
 
-void SdrObjList::ForceSwapInObjects() const
-{
-    for (size_t nObjNum=GetObjCount(); nObjNum>0;) {
-        SdrObject* pObj=GetObj(--nObjNum);
-        SdrGrafObj* pGrafObj=PTR_CAST(SdrGrafObj,pObj);
-        if (pGrafObj!=NULL) {
-            pGrafObj->ForceSwapIn();
-        }
-        SdrObjList* pOL=pObj->GetSubList();
-        if (pOL!=NULL) {
-            pOL->ForceSwapInObjects();
-        }
-    }
-}
-
-void SdrObjList::ForceSwapOutObjects() const
-{
-    const size_t nObjAnz = GetObjCount();
-    for (size_t nObjNum=nObjAnz; nObjNum>0;) {
-        SdrObject* pObj=GetObj(--nObjNum);
-        SdrGrafObj* pGrafObj=PTR_CAST(SdrGrafObj,pObj);
-        if (pGrafObj!=NULL) {
-            pGrafObj->ForceSwapOut();
-        }
-        SdrObjList* pOL=pObj->GetSubList();
-        if (pOL!=NULL) {
-            pOL->ForceSwapOutObjects();
-        }
-    }
-}
-
 void SdrObjList::FlattenGroups()
 {
     const size_t nObj = GetObjCount();
commit 19596ddb11d167b357f1b5974c8c1ea97881c027
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 12:04:50 2014 +0100

    Remove duplicated swapping methods
    
    Change-Id: I0e61aeb0705ed13872d252ee1594f9ab4aab4f8a

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index b098f1b..f8d4300 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -174,9 +174,6 @@ public:
     void    ForceSwapInObjects() const;
     void    ForceSwapOutObjects() const;
 
-    void    SwapInAll() const { ForceSwapInObjects(); }
-    void    SwapOutAll() const { ForceSwapOutObjects(); }
-
     /** Makes the object list flat, i.e. the object list content are
         then tree leaves
 
commit 3956a8483852ec3df3a792ea67d8a8da2b3b7267
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 12:11:09 2014 +0100

    SdrUndoDelObj: one more manual swap out call
    
    This thing seems a good optimization to me, but
    it would be good to hide all of this swapping thing
    inside GraphicObject class, to make our code more
    robust (e.g. no image loss because of missing
    manual swap in / swap out call).
    Auto swapping mechanism will take care of that, anyway.
    
    Change-Id: I933dafd95597ffff038dc6aeb0a64fcaa3941bd8

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 739244f..c3e4861 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -301,9 +301,6 @@ public:
 
 class SVX_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj
 {
-private:
-    void TryToFlushGraphicContent();
-
 public:
     SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect = false);
 
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index e8a84e5..c88d2c3 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -889,34 +889,10 @@ void SdrUndoInsertObj::Redo()
     ImpShowPageOfThisObject();
 }
 
-
-
-void SdrUndoDelObj::TryToFlushGraphicContent()
-{
-    SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
-
-    if(pSdrGrafObj)
-    {
-        sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&pSdrGrafObj->GetViewContact());
-
-        if(pVC)
-        {
-            pVC->flushViewObjectContacts();
-            pVC->flushGraphicObjects();
-        }
-
-        pSdrGrafObj->ForceSwapOut();
-    }
-}
-
 SdrUndoDelObj::SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect)
 :   SdrUndoRemoveObj(rNewObj,bOrdNumDirect)
 {
     SetOwner(true);
-
-    // #i122985# if graphic object is deleted (but goes to undo) flush it's graphic content
-    // since it is potentially no longer needed
-    TryToFlushGraphicContent();
 }
 
 void SdrUndoDelObj::Undo()
@@ -931,10 +907,6 @@ void SdrUndoDelObj::Redo()
     SdrUndoRemoveObj::Redo();
     DBG_ASSERT(!IsOwner(),"RedoDeleteObj: pObj already belongs to UndoAction");
     SetOwner(true);
-
-    // #i122985# if graphic object is deleted (but goes to undo) flush it's graphic content
-    // since it is potentially no longer needed
-    TryToFlushGraphicContent();
 }
 
 OUString SdrUndoDelObj::GetComment() const
commit cf78f9c05aaef427c3907ebb7a2ce7247ed27273
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 11:55:52 2014 +0100

    SvxGraphicObject: remove more manual swap out calls
    
    Tested with importing large *.rtf and *.docx test documents
    with lots of images -> auto swapp out works.
    
    Change-Id: Ib040edaa89c9bcb966c58b75f0392e6d9f7a165e

diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 7ef7831..263ec03 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1537,7 +1537,6 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
             if( mpObj.is() )
             {
                 static_cast<SdrGrafObj*>(mpObj.get())->SetGrafStreamURL( aStreamURL );
-                static_cast<SdrGrafObj*>(mpObj.get())->ForceSwapOut();
             }
             bOk = true;
         }
@@ -1575,7 +1574,6 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
     {
     case OWN_ATTR_VALUE_FILLBITMAP:
     {
-        bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
         const Graphic& rGraphic = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic();
 
         if(rGraphic.GetType() != GRAPHIC_GDIMETAFILE)
@@ -1594,8 +1592,6 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
                 aDestStrm.GetEndOfData());
             rValue <<= aSeq;
         }
-        if ( bSwapped )
-            static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
         break;
     }
 
@@ -1607,13 +1603,10 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
         }
         else
         {
-            bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
             const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
             OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
             aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
             rValue <<= aURL;
-            if ( bSwapped )
-                static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
         }
         break;
     }
@@ -1642,11 +1635,8 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
 
     case OWN_ATTR_VALUE_GRAPHIC:
     {
-        bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
         Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( mpObj.get() )->GetGraphic().GetXGraphic() );
         rValue <<= xGraphic;
-        if ( bSwapped )
-            static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
         break;
     }
 
commit 6598a61ff42d9754949dde7ffeaff476183e06bd
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed Oct 29 23:14:57 2014 +0100

    Printing: remove an other manual swap out call
    
    Change-Id: I2b6d6eaa072d9948eb5734e978d68d3bc37701b2

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 7f86660..563144a 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -878,7 +878,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
             pOut->SetAntialiasing( nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW );
         }
 
-        bool bForceSwap = false, bContinue = true;
+        bool bContinue = true;
         const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
 
         GraphicAttr aGrfAttr;
@@ -917,7 +917,6 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
 
         if( bContinue )
         {
-            const bool bSwapped = rGrfObj.IsSwappedOut();
             const bool bSwappedIn = pGrfNd->SwapIn( bPrn );
             if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
             {
@@ -976,15 +975,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
 
                 ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, true );
             }
-
-            // When printing, we must not collect the graphics
-            if( bSwapped && bPrn )
-                bForceSwap = true;
         }
 
-        if( bForceSwap )
-            pGrfNd->SwapOut();
-
         if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
             pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
     }
commit 4415af54b4f7d2ce4d3b10f789801adc082d5afa
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 15:50:44 2014 +0100

    Remove unused IsInSwap() method
    
    Change-Id: Ib295bd71b5cf16fd75d04818dfd415ff24cb2655

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index 3ebb756..d9c1954 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -420,7 +420,6 @@ public:
 
     bool                    IsInSwapIn() const { return mbIsInSwapIn; }
     bool                    IsInSwapOut() const { return mbIsInSwapOut; }
-    bool                    IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
     bool                    IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
 
     bool                    Draw(
commit 2b8352eb44310fca3802a843e2c2674256b3e08c
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed Oct 29 10:45:24 2014 +0100

    Paint background images always via drawinglayer
    
    Painting via GraphicObject is obsolete.
    See fdo#68927 where the problem was the quality of svg
    graphics, it seems a good idea to extend this improvement
    to all graphic type.
    
    Change-Id: I57a26d4fcfea8e4f666504a90281365e8a9a7e1d

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index a8c391c..3ebb756 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -431,14 +431,6 @@ public:
                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD
                             );
 
-    bool                    DrawWithPDFHandling(
-                                OutputDevice& rOutDev,
-                                const Point& rPt,
-                                const Size& rSz,
-                                const GraphicAttr* pGrfAttr = NULL,
-                                const sal_uLong nFlags = GRFMGR_DRAW_STANDARD
-                            );
-
     /** Draw the graphic repeatedly into the given output rectangle
 
         @param pOut
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 7c1dc2f..fa87a2e 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -33,8 +33,6 @@
 #include <vcl/virdev.hxx>
 #include <svtools/grfmgr.hxx>
 
-#include <vcl/pdfextoutdevdata.hxx>
-
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <boost/scoped_ptr.hpp>
@@ -607,67 +605,6 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
     return bRet;
 }
 
-// #i105243#
-bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
-                                         const Point& rPt, const Size& rSz,
-                                         const GraphicAttr* pGrfAttr,
-                                         const sal_uLong nFlags )
-{
-    const GraphicAttr aGrfAttr( pGrfAttr ? *pGrfAttr : GetAttr() );
-
-    // Notify PDF writer about linked graphic (if any)
-    bool bWritingPdfLinkedGraphic( false );
-    Point aPt( rPt );
-    Size aSz( rSz );
-    Rectangle aCropRect;
-    vcl::PDFExtOutDevData* pPDFExtOutDevData =
-            dynamic_cast<vcl::PDFExtOutDevData*>(rOutDev.GetExtOutDevData());
-    if( pPDFExtOutDevData )
-    {
-        // only delegate image handling to PDF, if no special treatment is necessary
-        if( GetGraphic().IsLink() &&
-            rSz.Width() > 0L &&
-            rSz.Height() > 0L &&
-            !aGrfAttr.IsSpecialDrawMode() &&
-            !aGrfAttr.IsMirrored() &&
-            !aGrfAttr.IsRotated() &&
-            !aGrfAttr.IsAdjusted() )
-        {
-            bWritingPdfLinkedGraphic = true;
-
-            if( aGrfAttr.IsCropped() )
-            {
-                tools::PolyPolygon aClipPolyPoly;
-                bool bRectClip;
-                const bool bCrop = ImplGetCropParams( &rOutDev,
-                                                      aPt, aSz,
-                                                      &aGrfAttr,
-                                                      aClipPolyPoly,
-                                                      bRectClip );
-                if ( bCrop && bRectClip )
-                {
-                    aCropRect = aClipPolyPoly.GetBoundRect();
-                }
-            }
-
-            pPDFExtOutDevData->BeginGroup();
-        }
-    }
-
-    bool bRet = Draw( &rOutDev, rPt, rSz, &aGrfAttr, nFlags );
-
-    // Notify PDF writer about linked graphic (if any)
-    if( bWritingPdfLinkedGraphic )
-    {
-        pPDFExtOutDevData->EndGroup( const_cast< Graphic& >(GetGraphic()),
-                                     aGrfAttr.GetTransparency(),
-                                     Rectangle( aPt, aSz ),
-                                     aCropRect );
-    }
-
-    return bRet;
-}
-
 bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize,
                                const Size& rOffset, const GraphicAttr* pAttr, sal_uLong nFlags, int nTileCacheSize1D )
 {
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 9d81954..0272522 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1824,15 +1824,8 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
     // used, these coordinates have to be determined on pixel level.
     ::SwAlignGrfRect( &aAlignedGrfRect, *pOut );
 
-    if (pGrf->GetGraphic().getSvgData().get())
-    {   // fdo#68927 - SVGs are rasterized badly by DrawWithPDFHandling
-        paintGraphicUsingPrimitivesHelper(*pOut,
-                *pGrf, pGrf->GetAttr(), aAlignedGrfRect);
-    }
-    else
-    {
-        pGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() );
-    }
+    paintGraphicUsingPrimitivesHelper(*pOut,
+        *pGrf, pGrf->GetAttr(), aAlignedGrfRect);
 
     if ( bNotInside )
         pOut->Pop();
commit 2cfce42e0b2b68f045431e572b521fbe5a9f90ab
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed Oct 29 10:37:49 2014 +0100

    More useless static bool variables.
    
    Change-Id: If09aa23768f73bbf659966e4e5aac82dca83d1b6

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ec7adfa..9d81954 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1844,10 +1844,7 @@ bool DrawFillAttributes(
     const SwRect& rPaintRect,
     OutputDevice& rOut)
 {
-    static bool bUseNew(true);
-    static bool bReturnWhenNew(true);
-
-    if(bUseNew && rFillAttributes.get() && rFillAttributes->isUsed())
+    if(rFillAttributes.get() && rFillAttributes->isUsed())
     {
         basegfx::B2DRange aPaintRange(
             rPaintRect.Left(),
@@ -1917,10 +1914,7 @@ bool DrawFillAttributes(
 
                     delete pProcessor;
 
-                    if(bReturnWhenNew)
-                    {
-                        return true;
-                    }
+                    return true;
                 }
             }
         }
commit d4653a95896698f7dbaaeae253c5c06d78a4fe32
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed Oct 29 10:37:16 2014 +0100

    Remove these useless static bool variables.
    
    Change-Id: I7a8ad7814231f129d5d1146ceb36eb2c22b2aff1

diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index cdc7d7f..7c1dc2f 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -443,43 +443,25 @@ void GraphicObject::SetSwapStreamHdl()
     }
 }
 
-#define SWAPGRAPHIC_TIMEOUT     5000
-
 // #i122985# it is not correct to set the swap-timeout to a hard-coded 5000ms
 // as it was before.  Added code and experimented what to do as a good
 // compromise, see description.
 static sal_uInt32 GetCacheTimeInMs()
 {
-    static bool bSetAtAll(true);
-
-    if (bSetAtAll)
-    {
-        static bool bSetToPreferenceTime(true);
-
-        if (bSetToPreferenceTime)
-        {
-            const sal_uInt32 nSeconds =
-                officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::get(
-                    comphelper::getProcessComponentContext());
-
-
-            // The default is 10 minutes. The minimum is one minute, thus 60
-            // seconds. When the minimum should match to the former hard-coded
-            // 5 seconds, we have a divisor of 12 to use. For the default of 10
-            // minutes this would mean 50 seconds. Compared to before this is
-            // ten times more (would allow better navigation by switching
-            // through pages) and is controllable by the user by setting the
-            // tools/options/memory/Remove_from_memory_after setting. Seems to
-            // be a good compromise to me.
-            return nSeconds * 1000 / 12;
-        }
-        else
-        {
-            return SWAPGRAPHIC_TIMEOUT;
-        }
-    }
-
-    return 0;
+    const sal_uInt32 nSeconds =
+        officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::get(
+            comphelper::getProcessComponentContext());
+
+
+    // The default is 10 minutes. The minimum is one minute, thus 60
+    // seconds. When the minimum should match to the former hard-coded
+    // 5 seconds, we have a divisor of 12 to use. For the default of 10
+    // minutes this would mean 50 seconds. Compared to before this is
+    // ten times more (would allow better navigation by switching
+    // through pages) and is controllable by the user by setting the
+    // tools/options/memory/Remove_from_memory_after setting. Seems to
+    // be a good compromise to me.
+    return nSeconds * 1000 / 12;
 }
 
 void GraphicObject::SetSwapStreamHdl(const Link& rHdl)
commit 70dff8d4bb97a5b9b59f91f3cc168be84b473873
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Oct 27 15:55:38 2014 +0100

    Ignore the swapped in graphic, but use its size
    
    Change-Id: I75f17ab5e55119965fcede2b220979cefc1e26ab

diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index c97a043..7f93bf9 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -205,12 +205,15 @@ void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGrap
     for (size_t i = 0, n = maObjList.size(); i < n; ++i)
     {
         pObj = maObjList[i];
-        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes() && pObj != pGraphicToIgnore)
+        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes())
         {
-            aCandidates.push_back(pObj);
             size_t const nSize = pObj->GetSizeBytes();
             nUsedSize += nSize;
-            sizes.insert(std::make_pair(pObj, nSize));
+            if( pObj != pGraphicToIgnore )
+            {
+                aCandidates.push_back(pObj);
+                sizes.insert(std::make_pair(pObj, nSize));
+            }
         }
     }
 
commit ccd93fc33843b1349b67797fc5a26713e6b186e6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Oct 27 11:20:49 2014 +0100

    Assign graphic data also during auto swap in
    
    Change-Id: I09b8d11027f4a1e8470b81677388d4a573b372a6

diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index e3fa83f..cdc7d7f 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -265,6 +265,7 @@ void GraphicObject::ImplAutoSwapIn()
             if( !mbAutoSwapped && mpMgr )
                 mpMgr->ImplGraphicObjectWasSwappedIn( *this );
         }
+        ImplAssignGraphicData();
     }
 }
 
commit 5c2ec558ac5bbe76a0070cee90c3ff9ce0544a87
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Nov 3 16:37:26 2014 +0100

    Avoid an image loss situation of auto swapping
    
    Before an image data is used GraphicObject should be swapped in.
    When a GraphicObject is swapped in auto swapping mechanism
    is triggered which can swap out some of the images.
    We should avoid to swap out the same image on which the swap
    in method was called before because the caller code assumes that
    the image data is there.
    
    Change-Id: Ia4addc370742aea5fbf185cf87e3c062a5ebf5be

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index d452276..a8c391c 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -615,7 +615,7 @@ private:
     // For 32Bit systems this leads to situations where graphics will be missing. This method will actively swap out
     // the longest swapped in graphics until a maximum memory boundary (derived from user settings in tools/options/memory)
     // is no longer exceeded
-    void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics();
+    void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore);
 public:
 
                         GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL );
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 2c4746d..e3fa83f 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -70,7 +70,7 @@ void GraphicObject::ImplAfterDataChange()
 
     // check memory footprint of all GraphicObjects managed and evtl. take action
     if (mpMgr)
-        mpMgr->ImplCheckSizeOfSwappedInGraphics();
+        mpMgr->ImplCheckSizeOfSwappedInGraphics(this);
 }
 
 GraphicObject::GraphicObject( const GraphicManager* pMgr ) :
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index b61f079..c97a043 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -192,7 +192,7 @@ namespace
     };
 } // end of anonymous namespace
 
-void GraphicManager::ImplCheckSizeOfSwappedInGraphics()
+void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore)
 {
     // get the currently used memory footprint of all swapped in bitmap graphics
     // of this graphic manager. Remember candidates in a vector. The size in bytes is
@@ -205,7 +205,7 @@ void GraphicManager::ImplCheckSizeOfSwappedInGraphics()
     for (size_t i = 0, n = maObjList.size(); i < n; ++i)
     {
         pObj = maObjList[i];
-        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes())
+        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes() && pObj != pGraphicToIgnore)
         {
             aCandidates.push_back(pObj);
             size_t const nSize = pObj->GetSizeBytes();
commit ccdf558157b7e1b31d8bfd7cce45468f5013fb6d
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Nov 3 16:36:42 2014 +0100

    Swap in graphic by SwGrfNode and not manually
    
    It's a Writer specific problem, that images lost during export
    because of not swapped in graphic data.
    Other components (Impress, Calc...) use SdrGrafObj to get the
    graphic and SdrGrafObj calls swap in before retrun with the
    graphic.
    
    Change-Id: I7398d8e3f6535199b10de048acd58543bdb42531

diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 212a612..2b50fce 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -123,8 +123,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
 
 public:
     virtual ~SwGrfNode();
-    const Graphic&          GetGrf() const      { return maGrfObj.GetGraphic(); }
-    const GraphicObject&    GetGrfObj() const   { return maGrfObj; }
+    const Graphic&          GetGrf() const;
+    const GraphicObject&    GetGrfObj() const;
     const GraphicObject* GetReplacementGrfObj() const;
     virtual SwCntntNode *SplitCntntNode( const SwPosition & ) SAL_OVERRIDE;
 
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 910d285..ecbc5a0 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -396,6 +396,18 @@ void SwGrfNode::SetGraphic(const Graphic& rGraphic, const OUString& rLink)
     onGraphicChanged();
 }
 
+const Graphic& SwGrfNode::GetGrf() const
+{
+    const_cast<SwGrfNode*>(this)->SwapIn();
+    return maGrfObj.GetGraphic();
+}
+
+const GraphicObject& SwGrfNode::GetGrfObj() const
+{
+    const_cast<SwGrfNode*>(this)->SwapIn();
+    return maGrfObj;
+}
+
 const GraphicObject* SwGrfNode::GetReplacementGrfObj() const
 {
     if(!mpReplacementGraphic)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b027e46..c563f6a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4089,15 +4089,9 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
             // Not in cache, then need to write it.
             m_rDrawingML.SetFS( m_pSerializer ); // to be sure that we write to the right stream
 
-            if (pGraphic->IsSwapOut())
+            if (pGraphic->IsSwapOut() && !pGrfNode)
             {
-                if (pGrfNode)
-                {
-                    // always swapin via the Node
-                    const_cast<SwGrfNode*>(pGrfNode)->SwapIn();
-                }
-                else
-                    const_cast<Graphic*>(pGraphic)->SwapIn();
+                const_cast<Graphic*>(pGraphic)->SwapIn();
             }
 
             OUString aImageId = m_rDrawingML.WriteImage( *pGraphic );
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index fbf0871..b989b25 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3641,12 +3641,6 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
     if (rGraphic.GetType()==GRAPHIC_NONE)
         return;
 
-    if (rGraphic.IsSwapOut())
-    {
-        // always swapin via the Node
-        const_cast<SwGrfNode*>(pGrfNode)->SwapIn();
-    }
-
     GfxLink aGraphicLink;
     const sal_Char* pBLIPType = 0;
     if (rGraphic.IsLink())
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 240168e..a2dd8ee 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1639,8 +1639,6 @@ sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nSh
     }
     else
     {
-        pGrfNd->SwapIn(true);
-
         Graphic         aGraphic(pGrfNd->GetGrf());
         GraphicObject   aGraphicObject( aGraphic );
         OString aUniqueId = aGraphicObject.GetUniqueID();
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 27ed033..48787f5 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -725,8 +725,6 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd,
         else
         {
             Graphic& rGrf = const_cast<Graphic&>(rGrfNd.GetGrf());
-            // always swapin via the Node
-            const_cast<SwGrfNode&>(rGrfNd).SwapIn();
 
             GDIMetaFile aMeta;
             switch (rGrf.GetType())
commit a6d96c808d76ff0b45466902150929e339d19406
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Nov 3 16:24:10 2014 +0100

    Test for swapped out image loss during Calc export
    
    Related to the bug fdo#52226.
    The problem was that the images were somehow swapped out but
    were not swapped in during export.
    Test the main Calc formats: ODS, XLS, XLSX, HTML.
    
    Conflicts:
    	sc/qa/unit/subsequent_export-test.cxx
    
    Change-Id: I4835ff2960fbd11cc9750ed3da20df26cd6cbaba

diff --git a/sc/qa/unit/data/ods/document_with_an_image.ods b/sc/qa/unit/data/ods/document_with_an_image.ods
new file mode 100644
index 0000000..adfcd4c
Binary files /dev/null and b/sc/qa/unit/data/ods/document_with_an_image.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index dc7ea89..4474caf 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -41,6 +41,8 @@
 #include <dputil.hxx>
 
 #include <svx/svdoole2.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdograf.hxx>
 #include "tabprotection.hxx"
 #include <editeng/wghtitem.hxx>
 #include <editeng/postitem.hxx>
@@ -61,6 +63,10 @@
 #include <com/sun/star/table/BorderLineStyle.hpp>
 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
 #include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -123,6 +129,7 @@ public:
 
     void testPivotTableXLSX();
     void testPivotTableTwoDataFieldsXLSX();
+    void testSwappedOutImageExport();
 
     void testSupBookVirtualPath();
 
@@ -168,6 +175,7 @@ public:
 #if !defined(WNT)
     CPPUNIT_TEST(testSupBookVirtualPath);
 #endif
+    CPPUNIT_TEST(testSwappedOutImageExport);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2254,6 +2262,70 @@ void ScExportTest::testFunctionsExcel2010ODS()
     //testFunctionsExcel2010(ODS);
 }
 
+void ScExportTest::testSwappedOutImageExport()
+{
+    std::vector<OUString> aFilterNames = {
+        "calc8",
+        "MS Excel 97",
+        "Calc Office Open XML",
+        "generic_HTML",
+    };
+
+    for( size_t nFilter = 0; nFilter < aFilterNames.size(); ++nFilter )
+    {
+        // Check whether the export code swaps in the image which was swapped out before.
+        ScDocShellRef xDocSh = loadDoc("document_with_an_image.", ODS);
+
+        const OString sFailedMessage = OString("Failed on filter: ")
+                                       + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US);
+
+        // Find and swap out the image
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.Is());
+        ScDocument* pDoc = &xDocSh->GetDocument();
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc);
+        ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDrawLayer);
+        const SdrPage* pPage = pDrawLayer->GetPage(0);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pPage);
+        const SdrObject* pObj = pPage->GetObj(0);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pObj->GetObjIdentifier() == OBJ_GRAF);
+        const SdrGrafObj& rGrafObj = static_cast<const SdrGrafObj&>(*pObj);
+        rGrafObj.ForceSwapOut();
+
+        // Export the document and import again for a check
+        ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter);
+        xDocSh->DoClose();
+
+        // Check whether graphic exported well after it was swapped out
+        uno::Reference< frame::XModel > xModel = xDocSh2->GetModel();
+        uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, UNO_QUERY_THROW);
+        uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
+        uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xIA->getByIndex(0), UNO_QUERY_THROW);
+        uno::Reference< container::XIndexAccess > xDraws(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(1), xDraws->getCount());
+
+        uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
+        uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
+        // Check URL
+        {
+            OUString sURL;
+            XPropSet->getPropertyValue("GraphicURL") >>= sURL;
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                sFailedMessage.getStr(), OUString("vnd.sun.star.GraphicObject:10000000000002620000017D9F4CD7A2"), sURL);
+        }
+        // Check size
+        {
+            uno::Reference<graphic::XGraphic> xGraphic;
+            XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
+        }
+        xDocSh2->DoClose();
+    }
+}
+
 ScExportTest::ScExportTest()
       : ScBootstrapFixture("/sc/qa/unit/data")
 {
commit 8070b12454718d33d4452bb090f40ce8c629ca2c
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Oct 27 09:41:00 2014 +0100

    Test for swapped out image loss during Writer export
    
    Related to the bug fdo#52226. The fix in *.rtf and *.docx
    export was this commit:
    9dd5caac62083f7162d83319284df68ee83e3777
    The problem was that the images were somehow swapped out but
    were not swapped in during export.
    Test the main Writer formats: ODT, RTF, DOC, DOCX.

diff --git a/sw/CppunitTest_sw_globalfilter.mk b/sw/CppunitTest_sw_globalfilter.mk
new file mode 100644
index 0000000..96787c0
--- /dev/null
+++ b/sw/CppunitTest_sw_globalfilter.mk
@@ -0,0 +1,90 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_globalfilter))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_globalfilter, \
+    sw/qa/extras/globalfilter/globalfilter \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_globalfilter, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    sw \
+    test \
+    tl \
+    unotest \
+    utl \
+    vcl \
+    $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_globalfilter,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_globalfilter,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/qa/extras/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_globalfilter,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_globalfilter))
+$(eval $(call gb_CppunitTest_use_vcl,sw_globalfilter))
+
+$(eval $(call gb_CppunitTest_use_components,sw_globalfilter,\
+	basic/util/sb \
+	comphelper/util/comphelp \
+	configmgr/source/configmgr \
+	dbaccess/util/dba \
+	drawinglayer/drawinglayer \
+	embeddedobj/util/embobj \
+	filter/source/config/cache/filterconfig1 \
+	filter/source/storagefilterdetect/storagefd \
+	filter/source/textfilterdetect/textfd \
+	forms/util/frm \
+	framework/util/fwk \
+	i18npool/util/i18npool \
+	oox/util/oox \
+	package/source/xstor/xstor \
+	package/util/package2 \
+	sax/source/expatwrap/expwrap \
+	sfx2/util/sfx \
+	svl/source/fsstor/fsstorage \
+	svtools/util/svt \
+	sw/util/msword \
+	sw/util/sw \
+	sw/util/swd \
+	toolkit/util/tk \
+	ucb/source/core/ucb1 \
+	ucb/source/ucp/file/ucpfile1 \
+	unotools/util/utl \
+	unoxml/source/service/unoxml \
+	uui/util/uui \
+	$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
+	writerfilter/util/writerfilter \
+	xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_globalfilter))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,sw_globalfilter))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index b5809c2..a7a31ef 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -68,6 +68,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_odfimport \
     CppunitTest_sw_uiwriter \
     CppunitTest_sw_mailmerge \
+    CppunitTest_sw_globalfilter \
 ))
 
 ifneq ($(DISABLE_CVE_TESTS),TRUE)
diff --git a/sw/qa/extras/globalfilter/data/document_with_an_image.odt b/sw/qa/extras/globalfilter/data/document_with_an_image.odt
new file mode 100644
index 0000000..ce7a29a
Binary files /dev/null and b/sw/qa/extras/globalfilter/data/document_with_an_image.odt differ
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
new file mode 100644
index 0000000..b31afe3
--- /dev/null
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list