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

Miklos Vajna vmiklos at collabora.co.uk
Thu Jun 25 01:53:23 PDT 2015


 sw/source/core/crsr/viscrs.cxx            |    2 
 sw/source/core/doc/notxtfrm.cxx           |    2 
 sw/source/core/inc/frmtool.hxx            |    2 
 sw/source/core/layout/paintfrm.cxx        |   67 ++++++++++++++----------------
 sw/source/core/text/inftxt.cxx            |    2 
 sw/source/core/text/txtfly.cxx            |    2 
 sw/source/core/view/pagepreviewlayout.cxx |    6 +-
 7 files changed, 41 insertions(+), 42 deletions(-)

New commits:
commit 702cb2b28431d4acec302af20169fbb447a2980a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 09:53:02 2015 +0200

    SwAlignRect: use vcl::RenderContext
    
    If the caller has a vcl::RenderContext already, use it. Otherwise just
    use GetOut() on the shell in the caller for now.
    
    Change-Id: I8070dd3d6622d211885067514d6eb728716830ee

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 38cb79e..3e92ce5 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -167,7 +167,7 @@ void SwVisCrsr::_SetPosAndShow()
     if( aRect.Height() )
     {
         ::SwCalcPixStatics( m_pCrsrShell->GetOut() );
-        ::SwAlignRect( aRect, static_cast<SwViewShell const *>(m_pCrsrShell) );
+        ::SwAlignRect( aRect, static_cast<SwViewShell const *>(m_pCrsrShell), m_pCrsrShell->GetOut() );
     }
     if( !m_pCrsrShell->IsOverwriteCrsr() || m_bIsDragCrsr ||
         m_pCrsrShell->IsSelection() )
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index aa2975b..14e7d3e 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -848,7 +848,7 @@ void SwNoTextFrm::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfArea
     //     Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
     //     the following code.
     SwRect aAlignedGrfArea = rGrfArea;
-    ::SwAlignRect( aAlignedGrfArea,  pShell );
+    ::SwAlignRect( aAlignedGrfArea,  pShell, pOut );
 
     if( !bIsChart )
     {
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index cc86fdc..23a2226 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -79,7 +79,7 @@ void paintGraphicUsingPrimitivesHelper(
 
 // method to align rectangle.
 // Created declaration here to avoid <extern> declarations
-void SwAlignRect( SwRect &rRect, const SwViewShell *pSh );
+void SwAlignRect( SwRect &rRect, const SwViewShell *pSh, const vcl::RenderContext* pRenderContext );
 
 // method to align graphic rectangle
 // Created declaration here to avoid <extern> declarations
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 33b6187..bbde2a8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1235,7 +1235,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
  * that the border "leaves its original pixel", if it has to
  * No prior adjustments for odd relation between pixel and twip
  */
-void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
+void SwAlignRect( SwRect &rRect, const SwViewShell *pSh, const vcl::RenderContext* pRenderContext )
 {
     if( !rRect.HasArea() )
         return;
@@ -1249,7 +1249,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
     }
 
     const vcl::RenderContext *pOut = gProp.bSFlyMetafile ?
-                        gProp.pSFlyMetafileOut.get() : pSh->GetOut();
+                        gProp.pSFlyMetafileOut.get() : pRenderContext;
 
     // Hold original rectangle in pixel
     const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() );
@@ -1510,7 +1510,7 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm,
         }
     }
 
-    ::SwAlignRect( rRect, properties.pSGlobalShell );
+    ::SwAlignRect( rRect, properties.pSGlobalShell, properties.pSGlobalShell->GetOut() );
 }
 
 /**
@@ -1826,7 +1826,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOu
     // Calculate align rectangle from parameter <rGrf> and use aligned
     // rectangle <aAlignedGrfRect> in the following code
     SwRect aAlignedGrfRect = rGrf;
-    ::SwAlignRect( aAlignedGrfRect, &rSh );
+    ::SwAlignRect( aAlignedGrfRect, &rSh, pOut );
 
     // Change type from <bool> to <bool>.
     const bool bNotInside = bClip && !rOut.IsInside( aAlignedGrfRect );
@@ -2077,7 +2077,7 @@ void DrawGraphic(
             GraphicObject* pGraphicObj = const_cast< GraphicObject* >(pBrush->GetGraphicObject());
             // calculate aligned paint rectangle
             SwRect aAlignedPaintRect = rOut;
-            ::SwAlignRect( aAlignedPaintRect, &rSh );
+            ::SwAlignRect( aAlignedPaintRect, &rSh, pOutDev );
             // draw background color for aligned paint rectangle
             lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum, gProp );
 
@@ -2587,7 +2587,7 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const
     SwRect aUpper( pUpper->Prt() );
     aUpper.Pos() += pUpper->Frm().Pos();
     SwRect aUpperAligned( aUpper );
-    ::SwAlignRect( aUpperAligned, gProp.pSGlobalShell );
+    ::SwAlignRect( aUpperAligned, gProp.pSGlobalShell, &rDev );
 
     while ( true )
     {
@@ -3479,7 +3479,7 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S
                 // OD 20.02.2003 #107369# - use aligned page rectangle
                 {
                     SwRect aTmpPageRect( aEmptyPageRect );
-                    ::SwAlignRect( aTmpPageRect, pSh );
+                    ::SwAlignRect( aTmpPageRect, pSh, &rRenderContext );
                     aEmptyPageRect = aTmpPageRect;
                 }
 
@@ -5073,7 +5073,7 @@ void PaintCharacterBorder(
     const bool bJoinWithNext )
 {
     SwRect aAlignedRect(rPaintArea);
-    SwAlignRect(aAlignedRect, gProp.pSGlobalShell);
+    SwAlignRect(aAlignedRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut());
 
     bool bTop = true;
     bool bBottom = true;
@@ -5468,7 +5468,7 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
         //happen, that some parts won't be processed.
         SwRect aRect( Prt() );
         aRect += Frm().Pos();
-        ::SwAlignRect( aRect, gProp.pSGlobalShell );
+        ::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
         // OD 27.09.2002 #103636# - new local boolean variable in order to
         // suspend border paint under special cases - see below.
         // NOTE: This is a fix for the implementation of feature #99657#.
@@ -6036,7 +6036,7 @@ bool SwPageFrm::IsLeftShadowNeeded() const
 {
     const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
     SwRect aAlignedPageRect( _rPageRect );
-    ::SwAlignRect( aAlignedPageRect, _pViewShell );
+    ::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
     SwRect aPagePxRect =
             _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
 
@@ -6126,7 +6126,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
     static Color aShadowColor( COL_AUTO );
 
     SwRect aAlignedPageRect( _rPageRect );
-    ::SwAlignRect( aAlignedPageRect, _pViewShell );
+    ::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
     SwRect aPagePxRect = _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
 
     if (aShadowColor != SwViewOption::GetShadowColor())
@@ -6254,7 +6254,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
         return;
 
     SwRect aPageRect( _rPageRect );
-    SwAlignRect( aPageRect, _pViewShell );
+    SwAlignRect( aPageRect, _pViewShell, _pViewShell->GetOut() );
 
     const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
     if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())  // do not show anything in print preview
@@ -6376,7 +6376,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
                                                       )
 {
     SwRect aAlignedPageRect( _rPageRect );
-    ::SwAlignRect( aAlignedPageRect, _pViewShell );
+    ::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
     SwRect aPagePxRect =
             _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
     aPagePxRect.Bottom( aPagePxRect.Bottom() + mnShadowPxWidth + 1 );
@@ -6566,7 +6566,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
                  (IsTextFrm() && Prt().SSize() == Frm().SSize()) )
             {
                 aRect = Frm();
-                ::SwAlignRect( aRect, gProp.pSGlobalShell );
+                ::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
             }
             else
             {
@@ -6642,7 +6642,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
                     {
                         if (1 < aRegion.size())
                         {
-                            ::SwAlignRect( aRegion[i], gProp.pSGlobalShell );
+                            ::SwAlignRect( aRegion[i], gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
                             if( !aRegion[i].HasArea() )
                               continue;
                         }
@@ -7044,7 +7044,7 @@ void SwColumnFrm::PaintSubsidiaryLines( const SwPageFrm *,
     if ( pFootnoteCont )
         aArea.AddBottom( pFootnoteCont->Frm().Bottom() - aArea.Bottom() );
 
-    ::SwAlignRect( aArea, gProp.pSGlobalShell );
+    ::SwAlignRect( aArea, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
 
     if ( !gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars( ) )
         ProcessPrimitives( lcl_CreateColumnAreaDelimiterPrimitives( aArea ) );
@@ -7134,7 +7134,7 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage,
     if ( !bUseFrmArea )
         aOriginal.Pos() += Frm().Pos();
 
-    ::SwAlignRect( aOriginal, gProp.pSGlobalShell );
+    ::SwAlignRect( aOriginal, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
 
     if ( !aOriginal.IsOver( rRect ) )
         return;
@@ -7236,7 +7236,7 @@ void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const
         || (sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE;
 
     SwRect aRect( rRect );
-    ::SwAlignRect( aRect, gProp.pSGlobalShell );
+    ::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
     if ( aRect.HasArea() )
     {
         SwLayoutFrm::RefreshExtraData( aRect );
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index e07a40b..861f412 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -766,7 +766,7 @@ void SwTextPaintInfo::CalcRect( const SwLinePortion& rPor,
 
     if( aRect.HasArea() && pIntersect )
     {
-        ::SwAlignRect( aRect, GetVsh() );
+        ::SwAlignRect( aRect, GetVsh(), GetOut() );
 
         if ( GetOut()->IsClipRegion() )
         {
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 8b58551..1f79bba 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -623,7 +623,7 @@ void SwTextFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect,
                     // #i68520#
                     SwRect aFly( pAnchoredObjTmp->GetObjRect() );
                     // OD 24.01.2003 #106593#
-                    ::SwAlignRect( aFly, pPage->getRootFrm()->GetCurrShell() );
+                    ::SwAlignRect( aFly, pPage->getRootFrm()->GetCurrShell(), pOut );
                     if( aFly.Width() > 0 && aFly.Height() > 0 )
                         aRegion -= aFly;
                 }
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index e2f8fc7..4fb2249 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -1075,7 +1075,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan
                 // OD 20.02.2003 #107369# - use aligned page rectangle
                 {
                     SwRect aTmpPageRect( aPageRect );
-                    ::SwAlignRect( aTmpPageRect, &mrParentViewShell);
+                    ::SwAlignRect( aTmpPageRect, &mrParentViewShell, &rRenderContext );
                     aPageRect = aTmpPageRect.SVRect();
                 }
                 pOutputDev->DrawRect( aPageRect );
@@ -1228,7 +1228,7 @@ void SwPagePreviewLayout::_PaintSelectMarkAtPage(
                          _aSelectedPreviewPage->aPageSize );
     // OD 19.02.2003 #107369# - use aligned page rectangle, as it is used for
     // page border and shadow paint - see <SwPageFrm::PaintBorderAndShadow(..)>
-    ::SwAlignRect( aPageRect, &mrParentViewShell);
+    ::SwAlignRect( aPageRect, &mrParentViewShell, pOutputDev );
     Rectangle aPxPageRect = pOutputDev->LogicToPixel( aPageRect.SVRect() );
 
     // draw two rectangle
@@ -1273,8 +1273,8 @@ void SwPagePreviewLayout::MarkNewSelectedPage( const sal_uInt16 _nSelectedPage )
         // OD 20.02.2003 #107369# - invalidate only areas of selection mark.
         SwRect aPageRect( pOldSelectedPreviewPage->aPreviewWinPos,
                               pOldSelectedPreviewPage->aPageSize );
-        ::SwAlignRect( aPageRect, &mrParentViewShell);
         OutputDevice* pOutputDev = mrParentViewShell.GetOut();
+        ::SwAlignRect( aPageRect, &mrParentViewShell, pOutputDev );
         Rectangle aPxPageRect = pOutputDev->LogicToPixel( aPageRect.SVRect() );
         // invalidate top mark line
         Rectangle aInvalPxRect( aPxPageRect.Left(), aPxPageRect.Top(),
commit 5cfc0e3899b51fd2751141d7f1f523803f46c8d1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 09:52:35 2015 +0200

    SwTabFrm::Paint: use vcl::RenderContext
    
    Change-Id: Iccadf6cd95a0ed9f9ba365d117d819f065193e60

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 28158c2..33b6187 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4386,7 +4386,7 @@ void SwTabFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
             }
 
             SwTabFrmPainter aHelper(*this);
-            aHelper.PaintLines(*gProp.pSGlobalShell->GetOut(), rRect);
+            aHelper.PaintLines(rRenderContext, rRect);
         }
 
         SwLayoutFrm::Paint( rRenderContext, rRect );
@@ -4399,7 +4399,7 @@ void SwTabFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
         aTabRect.Pos() += Frm().Pos();
         SwRect aTabOutRect( rRect );
         aTabOutRect.Intersection( aTabRect );
-        SwViewOption::DrawRect( gProp.pSGlobalShell->GetOut(), aTabOutRect, COL_LIGHTGRAY );
+        SwViewOption::DrawRect( &rRenderContext, aTabOutRect, COL_LIGHTGRAY );
     }
     const_cast<SwTabFrm*>(this)->ResetComplete();
 }
commit 74768909b7aad4ac0f23e3210ea97f9dcd1fc93d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 25 09:47:21 2015 +0200

    SwFlyFrm::Paint: use vcl::RenderContext
    
    Change-Id: Id6bd21deda59a6eecfff39907d967b78b881a1e6

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 48c3f63..28158c2 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4135,9 +4135,8 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
     SwRect aRect( rRect );
     aRect._Intersection( Frm() );
 
-    OutputDevice* pOut = gProp.pSGlobalShell->GetOut();
-    pOut->Push( PushFlags::CLIPREGION );
-    pOut->SetClipRegion();
+    rRenderContext.Push( PushFlags::CLIPREGION );
+    rRenderContext.SetClipRegion();
     const SwPageFrm* pPage = FindPageFrm();
 
     const SwNoTextFrm *pNoText = Lower() && Lower()->IsNoTextFrm()
@@ -4240,8 +4239,8 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
             //one.
 
             // OD 2004-04-23 #116347#
-            pOut->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
-            pOut->SetLineColor();
+            rRenderContext.Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+            rRenderContext.SetLineColor();
 
             pPage = FindPageFrm();
 
@@ -4264,20 +4263,20 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
                 }
                 if ( bContour )
                 {
-                    pOut->Push();
+                    rRenderContext.Push();
                     // #i80822#
                     // apply clip region under the same conditions, which are
                     // used in <SwNoTextFrm::Paint(..)> to set the clip region
                     // for painting the graphic/OLE. Thus, the clip region is
                     // also applied for the PDF export.
                     SwViewShell *pSh = getRootFrm()->GetCurrShell();
-                    if ( !pOut->GetConnectMetaFile() || !pSh || !pSh->GetWin() )
+                    if ( !rRenderContext.GetConnectMetaFile() || !pSh || !pSh->GetWin() )
                     {
-                        pOut->SetClipRegion(vcl::Region(aPoly));
+                        rRenderContext.SetClipRegion(vcl::Region(aPoly));
                     }
                     for ( size_t i = 0; i < aRegion.size(); ++i )
                         PaintBackground( aRegion[i], pPage, rAttrs, false, true );
-                    pOut->Pop();
+                    rRenderContext.Pop();
                 }
                 else
                     for ( size_t i = 0; i < aRegion.size(); ++i )
@@ -4291,7 +4290,7 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
                 PaintBorder( aTmp, pPage, rAttrs );
             }
 
-            pOut->Pop();
+            rRenderContext.Pop();
         }
     }
 
@@ -4331,8 +4330,8 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
         // Add subsidiary lines of fly frame and its lowers
         RefreshLaySubsidiary( pPage, aRect );
         // paint subsidiary lines of fly frame and its lowers
-        gProp.pSSpecSubsLines->PaintSubsidiary( pOut, NULL, gProp );
-        gProp.pSSubsLines->PaintSubsidiary( pOut, gProp.pSLines, gProp );
+        gProp.pSSpecSubsLines->PaintSubsidiary( &rRenderContext, NULL, gProp );
+        gProp.pSSubsLines->PaintSubsidiary( &rRenderContext, gProp.pSLines, gProp );
         if ( !bSubsLineRectsCreated )
             // unlock subsidiary lines
             gProp.pSSubsLines->LockLines( false );
@@ -4356,12 +4355,12 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw
 
     // OD 19.12.2002 #106318# - first paint lines added by fly frame paint
     // and then unlock other lines.
-    gProp.pSLines->PaintLines( pOut, gProp );
+    gProp.pSLines->PaintLines( &rRenderContext, gProp );
     gProp.pSLines->LockLines( false );
     // have to paint frame borders added in heaven layer here...
     ProcessPrimitives(gProp.pBLines->GetBorderLines_Clear());
 
-    pOut->Pop();
+    rRenderContext.Pop();
 
     if ( gProp.pSProgress && pNoText )
         gProp.pSProgress->Reschedule();


More information about the Libreoffice-commits mailing list