[Libreoffice-commits] core.git: Branch 'feature/image_rework' - 13 commits - include/svtools include/svx svtools/source svx/source sw/inc sw/source

Zolnai Tamás tamas.zolnai at collabora.com
Thu Oct 30 07:56:10 PDT 2014


 include/svtools/grfmgr.hxx                  |    9 --
 include/svx/svdpage.hxx                     |   17 ----
 include/svx/svdundo.hxx                     |    3 
 svtools/source/graphic/grfmgr.cxx           |  109 +++-------------------------
 svx/source/svdraw/svdpage.cxx               |   34 --------
 svx/source/svdraw/svdundo.cxx               |   28 -------
 svx/source/unodraw/unoshap2.cxx             |   10 --
 sw/inc/editsh.hxx                           |    2 
 sw/inc/ndgrf.hxx                            |    4 -
 sw/source/core/doc/notxtfrm.cxx             |   28 ++-----
 sw/source/core/docnode/ndnotxt.cxx          |    3 
 sw/source/core/edit/editsh.cxx              |   35 --------
 sw/source/core/frmedt/fefly1.cxx            |    3 
 sw/source/core/graphic/ndgrf.cxx            |   12 ++-
 sw/source/core/layout/paintfrm.cxx          |   21 +----
 sw/source/core/undo/unins.cxx               |    3 
 sw/source/core/unocore/unoframe.cxx         |   17 ----
 sw/source/filter/inc/msfilter.hxx           |   21 -----
 sw/source/filter/ww8/rtfattributeoutput.cxx |    4 -
 sw/source/filter/ww8/writerhelper.cxx       |   22 -----
 sw/source/ui/frmdlg/wrap.cxx                |    2 
 sw/source/uibase/shells/basesh.cxx          |    4 -
 22 files changed, 52 insertions(+), 339 deletions(-)

New commits:
commit 839ad234daa0edba899c2823c17d0ab3eb2f87ab
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 15:38:07 2014 +0100

    SwapIn by SwGrfNode::GetGrf(bool)/GetGrfObj() methods and not manually
    
    Change-Id: Ie56584c03af8a6d3ea8f8d4294f5492a841933b7

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 8117d4d..b869896 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -619,7 +619,7 @@ public:
 
     // #i73788#
     /// Remove default parameter, because method always called this default value.
-    Graphic GetIMapGraphic(bool bSwapIn = true) const; ///< @return a graphic for all Flys!
+    Graphic GetIMapGraphic() const; ///< @return a graphic for all Flys!
     const SwFlyFrmFmt* FindFlyByName( const OUString& rName, sal_uInt8 nNdTyp = 0 ) const;
 
     /** @return a ClientObject, if CurCrsr->Point() points to a SwOLENode
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 2b804ea..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;
 }
@@ -599,7 +578,7 @@ void *SwEditShell::GetIMapInventor() const
 }
 
 // #i73788#
-Graphic SwEditShell::GetIMapGraphic(bool bSwapIn) const
+Graphic SwEditShell::GetIMapGraphic() const
 {
     // returns always a graphic if the cursor is in a Fly
     SET_CURR_SHELL( (SwViewShell*)this );
@@ -611,15 +590,7 @@ Graphic SwEditShell::GetIMapGraphic(bool bSwapIn) const
         if( rNd.IsGrfNode() )
         {
             SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
-            const Graphic& rGrf = rGrfNode.GetGrf();
-            if( bSwapIn && (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();
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index ba6b6b1..9d0b32a 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -159,7 +159,7 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
             int nSelType = pWrtSh->GetSelectionType();
             if( ( nSelType & nsSelectionType::SEL_GRF ) ||
                 ( nSelType & nsSelectionType::SEL_OLE && GRAPHIC_NONE !=
-                            pWrtSh->GetIMapGraphic(false).GetType() ))
+                            pWrtSh->GetIMapGraphic().GetType() ))
                 bShowCB = true;
         }
         if( bShowCB )
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 366feec..96f5218 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1509,7 +1509,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                         if ( nSel & nsSelectionType::SEL_GRF )
                             bDisable = GRAPHIC_NONE == rSh.GetGraphicType();
                         else
-                            bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic(false).GetType();
+                            bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
                     }
 
                     if( bDisable )
@@ -1695,7 +1695,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                                     // #i102253# applied patch from OD (see task)
                                     bDisable =
                                         nSel & nsSelectionType::SEL_FRM ||
-                                        GRAPHIC_NONE == rSh.GetIMapGraphic(false).GetType();
+                                        GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
                                 }
                             }
                             bSet = bDisable ? sal_False : rWrap.IsContour();
commit b9a67fb1fbd4d82a9ab17da6e219a040466ccd53
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 43c7659..7034bef 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2133,22 +2133,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 8f06754..dfbecc5 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3576,7 +3576,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();
@@ -3713,7 +3713,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 80c2af2f253163ddf0f92b18910fb8bda64867b7
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 12:23:20 2014 +0100

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

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 3a75ab6..3fba43b 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 70a24faa910e693c71bbc0ed5d1dd2280faaa2d6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 12:09:44 2014 +0100

    ForceSwap{In,Out}Objects method 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 5e37e50..3a75ab6 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 d66947edd3684feaae36218e41d57196aa7b69d4
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 ae8dbc8..5e37e50 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 1707bf73f78ca31fc9f9b67eda4abe58cc155081
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 fde666e8cc7ac104ec8e05725e4944c9a8950399
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 06dd7e5b407dc7c6d8c1c8afe2843b5f591e7dd6
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 eaed62ffebd3563f2e0a853636a760e7b551fce2
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 dd4a2b8ea3cd051efc4b27adf0dcd8786d83d553
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Oct 30 15:49:48 2014 +0100

    DrawWithPDFHandling() is unused now
    
    Change-Id: I599ee9de92f57b549606f355677b6de92d6dcdda

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 8ff0a38..64f2b10 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 )
 {
commit 579fb774b3c6d0ef2f00a36095a3aaa8819e6841
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/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index cd9cbdc..f1827d6 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1832,15 +1832,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 95a14ff8c0fdd32cc8a68818e00cccadd3d849c3
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 8c177fc..cd9cbdc 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1852,10 +1852,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(),
@@ -1925,10 +1922,7 @@ bool DrawFillAttributes(
 
                     delete pProcessor;
 
-                    if(bReturnWhenNew)
-                    {
-                        return true;
-                    }
+                    return true;
                 }
             }
         }
commit 0cd35fb731a09d584dc4b2162c22ba8bc546ecd0
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 098e1f6..8ff0a38 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)


More information about the Libreoffice-commits mailing list