[Libreoffice-commits] core.git: 8 commits - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jun 25 05:16:33 PDT 2015


 sw/source/core/crsr/crsrsh.cxx               |    4 +--
 sw/source/core/draw/dpage.cxx                |    2 -
 sw/source/core/frmedt/fews.cxx               |    2 -
 sw/source/core/inc/layact.hxx                |    4 +--
 sw/source/core/inc/pagefrm.hxx               |    4 ++-
 sw/source/core/inc/viewimp.hxx               |   20 ++----------------
 sw/source/core/layout/anchoreddrawobject.cxx |    4 +--
 sw/source/core/layout/layact.cxx             |   23 ++++++++++----------
 sw/source/core/layout/pagechg.cxx            |    4 +--
 sw/source/core/layout/paintfrm.cxx           |   30 +++++++++++++--------------
 sw/source/core/unocore/unoflatpara.cxx       |    2 -
 sw/source/core/view/pagepreviewlayout.cxx    |    2 -
 sw/source/core/view/viewimp.cxx              |   22 ++++++++++++++++---
 sw/source/core/view/viewsh.cxx               |   18 ++++++++--------
 sw/source/core/view/vprint.cxx               |    2 -
 sw/source/uibase/docvw/PageBreakWin.cxx      |    2 -
 16 files changed, 74 insertions(+), 71 deletions(-)

New commits:
commit 08b3b6ed6c4d8599c9bb75719974c710462f2764
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 14:13:44 2015 +0200

    SwLayAction::Action: use vcl::RenderContext
    
    Change-Id: I4fb6c42da0c5defa1d5da4cf6f3a13d11388c88d

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index e85ff36..53e3c25 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -154,7 +154,7 @@ public:
     inline void SetCheckPageNum( sal_uInt16 nNew );
     inline void SetCheckPageNumDirect( sal_uInt16 nNew ) { nCheckPageNum = nNew; }
 
-    void Action();  // here it begins
+    void Action(OutputDevice* pRenderContext); // here it begins
     void Reset();   // back to CTor-defaults
 
     bool IsAgain()      const { return bAgain; }
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index f140b71..af2dcdc 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -341,7 +341,7 @@ bool SwLayAction::RemoveEmptyBrowserPages()
     return bRet;
 }
 
-void SwLayAction::Action()
+void SwLayAction::Action(OutputDevice* pRenderContext)
 {
     bActionInProgress = true;
 
@@ -366,12 +366,12 @@ void SwLayAction::Action()
     if ( IsCalcLayout() )
         SetCheckPages( false );
 
-    InternalAction(pImp->GetShell()->GetOut());
+    InternalAction(pRenderContext);
     bAgain |= RemoveEmptyBrowserPages();
     while ( IsAgain() )
     {
         bAgain = bNextCycle = false;
-        InternalAction(pImp->GetShell()->GetOut());
+        InternalAction(pRenderContext);
         bAgain |= RemoveEmptyBrowserPages();
     }
     pRoot->DeleteEmptySct();
@@ -2166,7 +2166,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pI ) :
             aAction.SetInputType( VCL_INPUT_ANY );
             aAction.SetIdle( true );
             aAction.SetWaitAllowed( false );
-            aAction.Action();
+            aAction.Action(pImp->GetShell()->GetOut());
             bInterrupt = aAction.IsInterrupt();
         }
 
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6587b90..017389b 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3237,7 +3237,7 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S
         aAction.SetPaint( false );
         aAction.SetComplete( false );
         aAction.SetReschedule( gProp.pSProgress != nullptr );
-        aAction.Action();
+        aAction.Action(&rRenderContext);
         ResetTurboFlag();
         if ( !pSh->ActionPend() )
             pSh->Imp()->DelRegion();
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index c9ad763..4ace932 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -283,7 +283,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
         if ( mnLockPaint )
             aAction.SetPaint( false );
         aAction.SetInputType( VclInputFlags::KEYBOARD );
-        aAction.Action();
+        aAction.Action(GetWin());
     }
 
     if ( bIsShellForCheckViewLayout )
@@ -948,7 +948,7 @@ void SwViewShell::CalcLayout()
     aAction.SetCalcLayout( true );
     aAction.SetReschedule( true );
     GetDoc()->getIDocumentFieldsAccess().LockExpFields();
-    aAction.Action();
+    aAction.Action(GetOut());
     GetDoc()->getIDocumentFieldsAccess().UnlockExpFields();
 
     //the SetNewFieldLst() on the Doc was cut off and must be fetched again
@@ -964,7 +964,7 @@ void SwViewShell::CalcLayout()
         GetDoc()->getIDocumentFieldsAccess().UpdatePageFields( &aMsgHint );
         GetDoc()->getIDocumentFieldsAccess().UpdateExpFields(NULL, true);
 
-        aAction.Action();
+        aAction.Action(GetOut());
     }
 
     if ( VisArea().HasArea() )
@@ -1596,7 +1596,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
         // can't format frames which are locked by the outer action. This may
         // cause and endless loop.
         ++mnStartAction;
-        aAction.Action();
+        aAction.Action(GetWin());
         --mnStartAction;
 
         SwRegionRects *pRegion = Imp()->GetRegion();
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 631f69a..4bec7c6 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -312,7 +312,7 @@ void SwViewShell::CalcPagesForPrint( sal_uInt16 nMax )
         aAction.SetWaitAllowed( false );
         aAction.SetReschedule( true );
 
-        aAction.Action();
+        aAction.Action(GetOut());
 
         maVisArea = aOldVis; //reset due to the paints
         Imp()->SetFirstVisPageInvalid();
commit 1a2705d16c945cdd85dd75c803039c05af0c853c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 12:27:54 2015 +0200

    SwLayAction::InternalAction: use vcl::RenderContext
    
    Change-Id: Icbc5e9a42cc7e7693c6584461505a3233046272c

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index 6977627..e85ff36 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -109,7 +109,7 @@ class SwLayAction
 
     bool TurboAction();
     bool _TurboAction( const SwContentFrm * );
-    void InternalAction();
+    void InternalAction(OutputDevice* pRenderContext);
 
     static SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage );
 
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 737c4ec..f140b71 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -366,12 +366,12 @@ void SwLayAction::Action()
     if ( IsCalcLayout() )
         SetCheckPages( false );
 
-    InternalAction();
+    InternalAction(pImp->GetShell()->GetOut());
     bAgain |= RemoveEmptyBrowserPages();
     while ( IsAgain() )
     {
         bAgain = bNextCycle = false;
-        InternalAction();
+        InternalAction(pImp->GetShell()->GetOut());
         bAgain |= RemoveEmptyBrowserPages();
     }
     pRoot->DeleteEmptySct();
@@ -442,7 +442,7 @@ static void unlockPositionOfObjects( SwPageFrm *pPageFrm )
     }
 }
 
-void SwLayAction::InternalAction()
+void SwLayAction::InternalAction(OutputDevice* pRenderContext)
 {
     OSL_ENSURE( pRoot->Lower()->IsPageFrm(), ":-( No page below the root.");
 
@@ -454,7 +454,7 @@ void SwLayAction::InternalAction()
     // number 1.  If we're doing a fake formatting, the number of the first
     // page is the number of the first visible page.
     SwPageFrm *pPage = IsComplete() ? static_cast<SwPageFrm*>(pRoot->Lower()) :
-                pImp->GetFirstVisPage(pImp->GetShell()->GetOut());
+                pImp->GetFirstVisPage(pRenderContext);
     if ( !pPage )
         pPage = static_cast<SwPageFrm*>(pRoot->Lower());
 
@@ -621,7 +621,7 @@ void SwLayAction::InternalAction()
                     if( !IsComplete() && nPreInvaPage + 2 < nFirstPageNum )
                     {
                         pImp->SetFirstVisPageInvalid();
-                        SwPageFrm *pTmpPage = pImp->GetFirstVisPage(pImp->GetShell()->GetOut());
+                        SwPageFrm *pTmpPage = pImp->GetFirstVisPage(pRenderContext);
                         nFirstPageNum = pTmpPage->GetPhyPageNum();
                         if( nPreInvaPage < nFirstPageNum )
                         {
commit c369f8644c45869cb1d80e5e243e445f5cb8b778
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 12:15:41 2015 +0200

    SwPageFrm::GetHorizontalShadowRect: use vcl::RenderContext
    
    Change-Id: Ife6c7404079aa1ae10d5c2bdbe77629e0689b167

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 5b4f87d..99097a9 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -96,6 +96,7 @@ class SwPageFrm: public SwFootnoteBossFrm
 
     static void GetHorizontalShadowRect( const SwRect& _rPageRect,
                                      const SwViewShell*    _pViewShell,
+                                     OutputDevice* pRenderContext,
                                      SwRect&       _orBottomShadowRect,
                                      bool bPaintLeftShadow,
                                      bool bPaintRightShadow,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6984d8c..6587b90 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6029,6 +6029,7 @@ bool SwPageFrm::IsLeftShadowNeeded() const
  */
 /*static*/ void SwPageFrm::GetHorizontalShadowRect( const SwRect& _rPageRect,
                                                 const SwViewShell*    _pViewShell,
+                                                OutputDevice* pRenderContext,
                                                 SwRect&       _orHorizontalShadowRect,
                                                 bool bPaintLeftShadow,
                                                 bool bPaintRightShadow,
@@ -6036,9 +6037,8 @@ bool SwPageFrm::IsLeftShadowNeeded() const
 {
     const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
     SwRect aAlignedPageRect( _rPageRect );
-    ::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
-    SwRect aPagePxRect =
-            _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
+    ::SwAlignRect( aAlignedPageRect, _pViewShell, pRenderContext );
+    SwRect aPagePxRect = pRenderContext->LogicToPixel( aAlignedPageRect.SVRect() );
 
     long lShadowAdjustment = mnShadowPxWidth - 1; // TODO: extract this
 
@@ -6177,7 +6177,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
     SwRect aPaintRect;
     OutputDevice *pOut = _pViewShell->GetOut();
 
-    SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, aPaintRect, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
+    SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, pOut, aPaintRect, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
 
     // Right shadow & corners
     if ( bPaintRightShadow )
@@ -6386,7 +6386,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
 
     // Always ask for full shadow since we want a bounding rect
     // including at least the page frame
-    SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, aTmpRect, false, false, bRightSidebar );
+    SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, pRenderContext, aTmpRect, false, false, bRightSidebar );
 
     if(bLeftShadow) aPagePxRect.Left( aTmpRect.Left() - mnShadowPxWidth - 1);
     if(bRightShadow) aPagePxRect.Right( aTmpRect.Right() + mnShadowPxWidth + 1);
commit cec17a4659389c5fe3a97c144d541c6aedc64d3f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 12:04:26 2015 +0200

    SwViewShellImp::GetFirstVisPage: use vcl::RenderContext
    
    Change-Id: I7acd380d2e199f042dca61d95596c3bc63c6a206

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c01966b..131b1da 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1144,7 +1144,7 @@ void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
     if( !bAtCrsrPos || 0 == (pCFrm = GetCurrFrm( bCalcFrm )) ||
                        0 == (pPg   = pCFrm->FindPageFrm()) )
     {
-        pPg = Imp()->GetFirstVisPage();
+        pPg = Imp()->GetFirstVisPage(GetOut());
         while( pPg && pPg->IsEmptyPage() )
             pPg = static_cast<const SwPageFrm *>(pPg->GetNext());
     }
@@ -1157,7 +1157,7 @@ sal_uInt16 SwCrsrShell::GetNextPrevPageNum( bool bNext )
 {
     SET_CURR_SHELL( this );
     // page number: first visible page or the one at the cursor
-    const SwPageFrm *pPg = Imp()->GetFirstVisPage();
+    const SwPageFrm *pPg = Imp()->GetFirstVisPage(GetOut());
     if( pPg )
     {
         const SwTwips nPageTop = pPg->Frm().Top();
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index fe774a1..db5707c 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -158,7 +158,7 @@ const SdrPageGridFrameList*  SwDPage::GetGridFrameList(
         else
         {
             //The drawing demands all visible pages
-            const SwFrm *pPg = pSh->Imp()->GetFirstVisPage();
+            const SwFrm *pPg = pSh->Imp()->GetFirstVisPage(pSh->GetOut());
             if ( pPg )
                 do
                 {   ::InsertGridFrame( const_cast<SwDPage*>(this)->pGridLst, pPg );
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 44dd490..0c46506 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -186,7 +186,7 @@ bool SwFEShell::GetPageNumber( long nYPos, bool bAtCrsrPos, sal_uInt16& rPhyNum,
     }
     else                                // first visible page
     {
-        pPage = Imp()->GetFirstVisPage();
+        pPage = Imp()->GetFirstVisPage(GetOut());
         if ( pPage && static_cast<const SwPageFrm*>(pPage)->IsEmptyPage() )
             pPage = pPage->GetNext();
     }
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index ecfd426..3146ec3 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -146,8 +146,8 @@ public:
     Color GetRetoucheColor() const;
 
     /// Management of the first visible Page
-    const SwPageFrm *GetFirstVisPage() const;
-          SwPageFrm *GetFirstVisPage();
+    const SwPageFrm *GetFirstVisPage(OutputDevice* pRenderContext) const;
+          SwPageFrm *GetFirstVisPage(OutputDevice* pRenderContext);
     void SetFirstVisPageInvalid() { bFirstPageInvalid = true; }
 
     bool AddPaintRect( const SwRect &rRect );
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 8eb237a..737c4ec 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -454,7 +454,7 @@ void SwLayAction::InternalAction()
     // number 1.  If we're doing a fake formatting, the number of the first
     // page is the number of the first visible page.
     SwPageFrm *pPage = IsComplete() ? static_cast<SwPageFrm*>(pRoot->Lower()) :
-                pImp->GetFirstVisPage();
+                pImp->GetFirstVisPage(pImp->GetShell()->GetOut());
     if ( !pPage )
         pPage = static_cast<SwPageFrm*>(pRoot->Lower());
 
@@ -621,7 +621,7 @@ void SwLayAction::InternalAction()
                     if( !IsComplete() && nPreInvaPage + 2 < nFirstPageNum )
                     {
                         pImp->SetFirstVisPageInvalid();
-                        SwPageFrm *pTmpPage = pImp->GetFirstVisPage();
+                        SwPageFrm *pTmpPage = pImp->GetFirstVisPage(pImp->GetShell()->GetOut());
                         nFirstPageNum = pTmpPage->GetPhyPageNum();
                         if( nPreInvaPage < nFirstPageNum )
                         {
@@ -2038,7 +2038,7 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly )
 
     SwPageFrm *pPage;
     if ( bVisAreaOnly )
-        pPage = pImp->GetFirstVisPage();
+        pPage = pImp->GetFirstVisPage(pViewShell->GetOut());
     else
         pPage = static_cast<SwPageFrm*>(pRoot->Lower());
 
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 67f3341..6984d8c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3257,7 +3257,7 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S
     const bool bOldAction = IsCallbackActionEnabled();
     const_cast<SwRootFrm*>(this)->SetCallbackActionEnabled( false );
 
-    const SwPageFrm *pPage = pSh->Imp()->GetFirstVisPage();
+    const SwPageFrm *pPage = pSh->Imp()->GetFirstVisPage(&rRenderContext);
     if ( pPage->GetPrev() )
         pPage = static_cast<const SwPageFrm*>(pPage->GetPrev());
     const bool bBookMode = gProp.pSGlobalShell->GetViewOptions()->IsViewLayoutBookMode();
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index a7a99b6..22fe58a 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -391,7 +391,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara()
     {
         SwViewShell* pViewShell = mpDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
 
-        SwPageFrm* pCurrentPage = pViewShell ? pViewShell->Imp()->GetFirstVisPage() : 0;
+        SwPageFrm* pCurrentPage = pViewShell ? pViewShell->Imp()->GetFirstVisPage(pViewShell->GetOut()) : 0;
         SwPageFrm* pStartPage = pCurrentPage;
         SwPageFrm* pStopPage = 0;
 
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 08e0645..b3957c4 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -270,17 +270,17 @@ Color SwViewShellImp::GetRetoucheColor() const
     return aRet;
 }
 
-SwPageFrm *SwViewShellImp::GetFirstVisPage()
+SwPageFrm *SwViewShellImp::GetFirstVisPage(OutputDevice* pRenderContext)
 {
     if ( bFirstPageInvalid )
-        SetFirstVisPage(pSh->GetOut());
+        SetFirstVisPage(pRenderContext);
     return pFirstVisPage;
 }
 
-const SwPageFrm *SwViewShellImp::GetFirstVisPage() const
+const SwPageFrm *SwViewShellImp::GetFirstVisPage(OutputDevice* pRenderContext) const
 {
     if ( bFirstPageInvalid )
-        const_cast<SwViewShellImp*>(this)->SetFirstVisPage(pSh->GetOut());
+        const_cast<SwViewShellImp*>(this)->SetFirstVisPage(pRenderContext);
     return pFirstVisPage;
 }
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 15cc9c0..c9ad763 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1031,7 +1031,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
 
     //First get the old visible page, so we don't have to look
     //for it afterwards.
-    const SwFrm *pOldPage = Imp()->GetFirstVisPage();
+    const SwFrm *pOldPage = Imp()->GetFirstVisPage(GetWin());
 
     const SwRect aPrevArea( VisArea() );
     const bool bFull = aPrevArea.IsEmpty();
@@ -1478,7 +1478,7 @@ void SwViewShell::PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect
     }
     else
     {
-        const SwFrm *pPage = Imp()->GetFirstVisPage();
+        const SwFrm *pPage = Imp()->GetFirstVisPage(&rRenderContext);
         //Here we have to get the previous page since
         //GetFirstVisPage return the current one but
         //there is a portion of the previous page
@@ -1568,7 +1568,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
     if ( !GetWin() )
         return false;
 
-    const SwPageFrm *pPage = Imp()->GetFirstVisPage();
+    const SwPageFrm *pPage = Imp()->GetFirstVisPage(GetOut());
     const SwTwips nBottom = VisArea().Bottom();
     const SwTwips nRight  = VisArea().Right();
     bool bRet = false;
commit 85cd7a6c6883d4d80d583f13d923527ed5e72343
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 11:47:46 2015 +0200

    SwViewShellImp::SetFirstVisPage: use vcl::RenderContext
    
    Change-Id: If36b6fdda54dfbe6e4eea14883d659302a1db6be

diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index 205938e..ecfd426 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -89,7 +89,7 @@ class SwViewShellImp
 
     SwPagePreviewLayout* mpPgPreviewLayout;
 
-    void SetFirstVisPage();     // Recalculate the first visible Page
+    void SetFirstVisPage(OutputDevice* pRenderContext); // Recalculate the first visible Page
 
     void StartAction();         // Show handle and hide
     void EndAction();           // Called by SwViewShell::ImplXXXAction
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index c7feb10..08e0645 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -169,7 +169,7 @@ bool SwViewShellImp::IsUpdateExpFields()
     return false;
 }
 
-void SwViewShellImp::SetFirstVisPage()
+void SwViewShellImp::SetFirstVisPage(OutputDevice* pRenderContext)
 {
     if ( pSh->mbDocSizeChgd && pSh->VisArea().Top() > pSh->GetLayout()->Frm().Height() )
     {
@@ -186,18 +186,18 @@ void SwViewShellImp::SetFirstVisPage()
         const bool bBookMode = pSwViewOption->IsViewLayoutBookMode();
 
         SwPageFrm *pPage = static_cast<SwPageFrm*>(pSh->GetLayout()->Lower());
-        SwRect aPageRect = pPage->GetBoundRect(pSh->GetOut());
+        SwRect aPageRect = pPage->GetBoundRect(pRenderContext);
         float fAmount = pSh->VisArea().Height() * 0.43;
         while ( pPage && aPageRect.Bottom() < pSh->VisArea().Top() + fAmount )
         {
             pPage = static_cast<SwPageFrm*>(pPage->GetNext());
             if ( pPage )
             {
-                aPageRect = pPage->GetBoundRect(pSh->GetOut());
+                aPageRect = pPage->GetBoundRect(pRenderContext);
                 if ( bBookMode && pPage->IsEmptyPage() )
                 {
                     const SwPageFrm& rFormatPage = pPage->GetFormatPage();
-                    aPageRect.SSize() = rFormatPage.GetBoundRect(pSh->GetOut()).SSize();
+                    aPageRect.SSize() = rFormatPage.GetBoundRect(pRenderContext).SSize();
                 }
             }
         }
@@ -273,14 +273,14 @@ Color SwViewShellImp::GetRetoucheColor() const
 SwPageFrm *SwViewShellImp::GetFirstVisPage()
 {
     if ( bFirstPageInvalid )
-        SetFirstVisPage();
+        SetFirstVisPage(pSh->GetOut());
     return pFirstVisPage;
 }
 
 const SwPageFrm *SwViewShellImp::GetFirstVisPage() const
 {
     if ( bFirstPageInvalid )
-        const_cast<SwViewShellImp*>(this)->SetFirstVisPage();
+        const_cast<SwViewShellImp*>(this)->SetFirstVisPage(pSh->GetOut());
     return pFirstVisPage;
 }
 
commit 7b6329479eeb3c416396404c0d371b7aab59dd64
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 11:44:01 2015 +0200

    sw: outline SwViewShellImp::GetFirstVisPage() methods
    
    Change-Id: Ib506b912752a16c514958896aa16b310f8e09200

diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index 2028ead..205938e 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -146,8 +146,8 @@ public:
     Color GetRetoucheColor() const;
 
     /// Management of the first visible Page
-    inline const SwPageFrm *GetFirstVisPage() const;
-    inline       SwPageFrm *GetFirstVisPage();
+    const SwPageFrm *GetFirstVisPage() const;
+          SwPageFrm *GetFirstVisPage();
     void SetFirstVisPageInvalid() { bFirstPageInvalid = true; }
 
     bool AddPaintRect( const SwRect &rRect );
@@ -272,20 +272,6 @@ public:
     void FireAccessibleEvents();
 };
 
-inline SwPageFrm *SwViewShellImp::GetFirstVisPage()
-{
-    if ( bFirstPageInvalid )
-        SetFirstVisPage();
-    return pFirstVisPage;
-}
-
-inline const SwPageFrm *SwViewShellImp::GetFirstVisPage() const
-{
-    if ( bFirstPageInvalid )
-        const_cast<SwViewShellImp*>(this)->SetFirstVisPage();
-    return pFirstVisPage;
-}
-
 inline SwAccessibleMap& SwViewShellImp::GetAccessibleMap()
 {
     if( !pAccMap )
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 24629c7..c7feb10 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -270,6 +270,20 @@ Color SwViewShellImp::GetRetoucheColor() const
     return aRet;
 }
 
+SwPageFrm *SwViewShellImp::GetFirstVisPage()
+{
+    if ( bFirstPageInvalid )
+        SetFirstVisPage();
+    return pFirstVisPage;
+}
+
+const SwPageFrm *SwViewShellImp::GetFirstVisPage() const
+{
+    if ( bFirstPageInvalid )
+        const_cast<SwViewShellImp*>(this)->SetFirstVisPage();
+    return pFirstVisPage;
+}
+
 // create page preview layout
 void SwViewShellImp::InitPagePreviewLayout()
 {
commit 3b7c803b1b2f5d13f5ca225a9d4aabab348c7786
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 11:31:55 2015 +0200

    SwPageFrm::GetBoundRect: use vcl::RenderContext
    
    Change-Id: Id9e9aa312d8fd4e0d776b41c9cca8073fa57b6fa

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 58559fd..5b4f87d 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -139,7 +139,7 @@ public:
     inline const SwContentFrm  *FindFirstBodyContent() const;
     inline const SwContentFrm  *FindLastBodyContent() const;
 
-    SwRect GetBoundRect() const;
+    SwRect GetBoundRect(OutputDevice* pOutputDevice) const;
 
     // Specialized GetContentPos() for Field in Frames
     void GetContentPosition( const Point &rPt, SwPosition &rPos ) const;
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index a5141df..1f7ebb2 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -640,7 +640,7 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
                 // Exclude margins.
                 aPageRect = GetPageFrm()->Prt().SVRect();
             else
-                aPageRect = GetPageFrm( )->GetBoundRect( ).SVRect();
+                aPageRect = GetPageFrm( )->GetBoundRect( GetPageFrm()->getRootFrm()->GetCurrShell()->GetOut() ).SVRect();
             nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( )->GetRelativeWidth());
         }
 
@@ -652,7 +652,7 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
                 // Exclude margins.
                 aPageRect = GetPageFrm()->Prt().SVRect();
             else
-                aPageRect = GetPageFrm( )->GetBoundRect( ).SVRect();
+                aPageRect = GetPageFrm( )->GetBoundRect( GetPageFrm()->getRootFrm()->GetCurrShell()->GetOut() ).SVRect();
             nTargetHeight = aPageRect.GetHeight( ) * (*GetDrawObj( )->GetRelativeHeight());
         }
 
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 7563bce..8eb237a 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1236,7 +1236,7 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect )
         SwRect aOldRect( aOldFrame );
         if( pLay->IsPageFrm() )
         {
-            aOldRect = static_cast<SwPageFrm*>(pLay)->GetBoundRect();
+            aOldRect = static_cast<SwPageFrm*>(pLay)->GetBoundRect(pLay->getRootFrm()->GetCurrShell()->GetOut());
         }
 
         pLay->Calc();
@@ -1264,7 +1264,7 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect )
             if ( pLay->IsPageFrm() )
             {
                 SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay);
-                aPaint = pPageFrm->GetBoundRect();
+                aPaint = pPageFrm->GetBoundRect(pPageFrm->getRootFrm()->GetCurrShell()->GetOut());
             }
 
             bool bPageInBrowseMode = pLay->IsPageFrm();
@@ -1414,7 +1414,7 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect )
     // OD 11.11.2002 #104414# - add complete frame area as paint area, if frame
     // area has been already added and after formatting its lowers the frame area
     // is enlarged.
-    SwRect aBoundRect(pLay->IsPageFrm() ? static_cast<SwPageFrm*>(pLay)->GetBoundRect() : pLay->Frm() );
+    SwRect aBoundRect(pLay->IsPageFrm() ? static_cast<SwPageFrm*>(pLay)->GetBoundRect(pLay->getRootFrm()->GetCurrShell()->GetOut()) : pLay->Frm() );
 
     if ( bAlreadyPainted &&
          ( aBoundRect.Width() > aFrmAtCompletePaint.Width() ||
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index b5ee414..67f3341 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6394,7 +6394,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
     _orBorderAndShadowBoundRect = pRenderContext->PixelToLogic( aPagePxRect.SVRect() );
 }
 
-SwRect SwPageFrm::GetBoundRect() const
+SwRect SwPageFrm::GetBoundRect(OutputDevice* pOutputDevice) const
 {
     const SwViewShell *pSh = getRootFrm()->GetCurrShell();
     SwRect aPageRect( Frm() );
@@ -6404,7 +6404,7 @@ SwRect SwPageFrm::GetBoundRect() const
         return SwRect( Point(0, 0), Size(0, 0) );
     }
 
-    SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, pSh->GetOut(), aResult,
+    SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, pOutputDevice, aResult,
         IsLeftShadowNeeded(), IsRightShadowNeeded(), SidebarPosition() ==  sw::sidebarwindows::SidebarPosition::RIGHT );
     return aResult;
 }
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 6f9068a..24629c7 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -186,18 +186,18 @@ void SwViewShellImp::SetFirstVisPage()
         const bool bBookMode = pSwViewOption->IsViewLayoutBookMode();
 
         SwPageFrm *pPage = static_cast<SwPageFrm*>(pSh->GetLayout()->Lower());
-        SwRect aPageRect = pPage->GetBoundRect();
+        SwRect aPageRect = pPage->GetBoundRect(pSh->GetOut());
         float fAmount = pSh->VisArea().Height() * 0.43;
         while ( pPage && aPageRect.Bottom() < pSh->VisArea().Top() + fAmount )
         {
             pPage = static_cast<SwPageFrm*>(pPage->GetNext());
             if ( pPage )
             {
-                aPageRect = pPage->GetBoundRect();
+                aPageRect = pPage->GetBoundRect(pSh->GetOut());
                 if ( bBookMode && pPage->IsEmptyPage() )
                 {
                     const SwPageFrm& rFormatPage = pPage->GetFormatPage();
-                    aPageRect.SSize() = rFormatPage.GetBoundRect().SSize();
+                    aPageRect.SSize() = rFormatPage.GetBoundRect(pSh->GetOut()).SSize();
                 }
             }
         }
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 5d66750..15cc9c0 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1078,11 +1078,11 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
 
             while ( pPage && pPage->Frm().Top() <= nBottom )
             {
-                SwRect aPageRect( pPage->GetBoundRect() );
+                SwRect aPageRect( pPage->GetBoundRect(GetWin()) );
                 if ( bBookMode )
                 {
                     const SwPageFrm& rFormatPage = static_cast<const SwPageFrm*>(pPage)->GetFormatPage();
-                    aPageRect.SSize() = rFormatPage.GetBoundRect().SSize();
+                    aPageRect.SSize() = rFormatPage.GetBoundRect(GetWin()).SSize();
                 }
 
                 // OD 12.02.2003 #i9719#, #105645# - consider new border and shadow width
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index cbee466..b407898 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -341,7 +341,7 @@ void SwPageBreakWin::UpdatePosition( const Point* pEvtPt )
     while ( pPrevPage && ( ( pPrevPage->Frm().Top( ) == pPageFrm->Frm().Top( ) )
                 || static_cast< const SwPageFrm* >( pPrevPage )->IsEmptyPage( ) ) );
 
-    Rectangle aBoundRect = GetEditWin()->LogicToPixel( pPageFrm->GetBoundRect().SVRect() );
+    Rectangle aBoundRect = GetEditWin()->LogicToPixel( pPageFrm->GetBoundRect(GetEditWin()).SVRect() );
     Rectangle aFrmRect = GetEditWin()->LogicToPixel( pPageFrm->Frm().SVRect() );
 
     long nYLineOffset = ( aBoundRect.Top() + aFrmRect.Top() ) / 2;
commit d7dd8bb3bdd0fee44d6704cbf34d4a39cd7a3d29
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 11:18:01 2015 +0200

    SwPageFrm::GetBorderAndShadowBoundRect: use vcl::RenderContext
    
    Change-Id: If861aa0a579eb953cd2fc7b790b3514ab1d0ffd0

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 1023bee..58559fd 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -300,6 +300,7 @@ public:
     */
     static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
                                              const SwViewShell*    _pViewShell,
+                                             OutputDevice* pRenderContext,
                                              SwRect& _orBorderAndShadowBoundRect,
                                              const bool bLeftShadow,
                                              const bool bRightShadow,
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 520808d..7563bce 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1320,6 +1320,7 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect )
                 if(pSh)
                 {
                     SwPageFrm::GetBorderAndShadowBoundRect(aPageRect, pSh,
+                        pSh->GetOut(),
                         aPageRect, pPageFrm->IsLeftShadowNeeded(), pPageFrm->IsRightShadowNeeded(),
                         pPageFrm->SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT);
                 }
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 8a070d8..0ba69f9 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -260,7 +260,7 @@ void SwPageFrm::DestroyImpl()
                 // including border and shadow area.
                 const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT);
                 SwRect aRetoucheRect;
-                SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, aRetoucheRect, IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar );
+                SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, pSh->GetOut(), aRetoucheRect, IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar );
                 pSh->AddPaintRect( aRetoucheRect );
             }
         }
@@ -623,7 +623,7 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
                 // page frame for determine 'old' rectangle - it's used for invalidating.
                 const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT);
                 SwRect aOldRectWithBorderAndShadow;
-                SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, aOldRectWithBorderAndShadow,
+                SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, pSh->GetOut(), aOldRectWithBorderAndShadow,
                     IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar );
                 pSh->InvalidateWindows( aOldRectWithBorderAndShadow );
             }
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index bbde2a8..b5ee414 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3295,7 +3295,7 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S
         if ( !pPage->IsEmptyPage() )
         {
             SwRect aPaintRect;
-            SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, aPaintRect,
+            SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, &rRenderContext, aPaintRect,
                 bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
 
             if ( aRect.IsOver( aPaintRect ) )
@@ -3459,7 +3459,7 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S
             const SwPageFrm& rFormatPage = pPage->GetFormatPage();
             aEmptyPageRect.SSize() = rFormatPage.Frm().SSize();
 
-            SwPageFrm::GetBorderAndShadowBoundRect( aEmptyPageRect, pSh, aPaintRect,
+            SwPageFrm::GetBorderAndShadowBoundRect( aEmptyPageRect, pSh, &rRenderContext, aPaintRect,
                 bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
             aPaintRect._Intersection( aRect );
 
@@ -6369,6 +6369,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
  */
 /*static*/ void SwPageFrm::GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
                                                         const SwViewShell*    _pViewShell,
+                                                        OutputDevice* pRenderContext,
                                                         SwRect& _orBorderAndShadowBoundRect,
                                                         bool bLeftShadow,
                                                         bool bRightShadow,
@@ -6376,9 +6377,8 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
                                                       )
 {
     SwRect aAlignedPageRect( _rPageRect );
-    ::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
-    SwRect aPagePxRect =
-            _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
+    ::SwAlignRect( aAlignedPageRect, _pViewShell, pRenderContext );
+    SwRect aPagePxRect = pRenderContext->LogicToPixel( aAlignedPageRect.SVRect() );
     aPagePxRect.Bottom( aPagePxRect.Bottom() + mnShadowPxWidth + 1 );
     aPagePxRect.Top( aPagePxRect.Top() - mnShadowPxWidth - 1 );
 
@@ -6391,7 +6391,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
     if(bLeftShadow) aPagePxRect.Left( aTmpRect.Left() - mnShadowPxWidth - 1);
     if(bRightShadow) aPagePxRect.Right( aTmpRect.Right() + mnShadowPxWidth + 1);
 
-    _orBorderAndShadowBoundRect = _pViewShell->GetOut()->PixelToLogic( aPagePxRect.SVRect() );
+    _orBorderAndShadowBoundRect = pRenderContext->PixelToLogic( aPagePxRect.SVRect() );
 }
 
 SwRect SwPageFrm::GetBoundRect() const
@@ -6404,7 +6404,7 @@ SwRect SwPageFrm::GetBoundRect() const
         return SwRect( Point(0, 0), Size(0, 0) );
     }
 
-    SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, aResult,
+    SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, pSh->GetOut(), aResult,
         IsLeftShadowNeeded(), IsRightShadowNeeded(), SidebarPosition() ==  sw::sidebarwindows::SidebarPosition::RIGHT );
     return aResult;
 }
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 4fb2249..9d91d13 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -1102,7 +1102,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan
                 // paint page border and shadow
                 {
                     SwRect aPageBorderRect;
-                    SwPageFrm::GetBorderAndShadowBoundRect( SwRect( aPageRect ), &mrParentViewShell, aPageBorderRect,
+                    SwPageFrm::GetBorderAndShadowBoundRect( SwRect( aPageRect ), &mrParentViewShell, &rRenderContext, aPageBorderRect,
                         (*aPageIter)->pPage->IsLeftShadowNeeded(), (*aPageIter)->pPage->IsRightShadowNeeded(), true );
                     const vcl::Region aDLRegion(aPageBorderRect.SVRect());
                     mrParentViewShell.DLPrePaint2(aDLRegion);


More information about the Libreoffice-commits mailing list