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

Michaël Lefèvre lefevre00 at yahoo.fr
Tue Dec 2 05:36:19 PST 2014


 sw/source/core/layout/paintfrm.cxx |   43 ++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

New commits:
commit ababde703007557c59595d551efb118cf84a3911
Author: Michaël Lefèvre <lefevre00 at yahoo.fr>
Date:   Mon Dec 1 23:20:11 2014 +0100

    Use parameter instead of static global access inside the module.
    
    SwPaintProperties is now just use by SwFrm and derivated classes, plus two globales functions.
    
    Change-Id: Icfe299163a4a8f1232a3d5076aceb949f97a4787
    Reviewed-on: https://gerrit.libreoffice.org/13258
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index d59e907..6107635 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -200,9 +200,9 @@ public:
 
 class SwSubsRects : public SwLineRects
 {
-    void RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects );
+    void RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects, SwPaintProperties &properties );
 public:
-    void PaintSubsidiary( OutputDevice *pOut, const SwLineRects *pRects );
+    void PaintSubsidiary( OutputDevice *pOut, const SwLineRects *pRects, SwPaintProperties &properties );
 };
 
 class BorderLines
@@ -856,7 +856,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut, SwPaintProperties& propertie
     }
 }
 
-void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
+void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects, SwPaintProperties& properties )
 {
     // All help lines that are covered by any border will be removed or split
     for (size_t i = 0; i < aLineRects.size(); ++i)
@@ -875,13 +875,13 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
         SwRect aSubsRect( aSubsLineRect );
         if ( bVerticalSubs )
         {
-            aSubsRect.Left  ( aSubsRect.Left()  - (gProp.nSPixelSzW+gProp.nSHalfPixelSzW) );
-            aSubsRect.Right ( aSubsRect.Right() + (gProp.nSPixelSzW+gProp.nSHalfPixelSzW) );
+            aSubsRect.Left  ( aSubsRect.Left()  - (properties.nSPixelSzW+properties.nSHalfPixelSzW) );
+            aSubsRect.Right ( aSubsRect.Right() + (properties.nSPixelSzW+properties.nSHalfPixelSzW) );
         }
         else
         {
-            aSubsRect.Top   ( aSubsRect.Top()    - (gProp.nSPixelSzH+gProp.nSHalfPixelSzH) );
-            aSubsRect.Bottom( aSubsRect.Bottom() + (gProp.nSPixelSzH+gProp.nSHalfPixelSzH) );
+            aSubsRect.Top   ( aSubsRect.Top()    - (properties.nSPixelSzH+properties.nSHalfPixelSzH) );
+            aSubsRect.Bottom( aSubsRect.Bottom() + (properties.nSPixelSzH+properties.nSHalfPixelSzH) );
         }
         for (const_iterator itK = rRects.aLineRects.begin(); itK != rRects.aLineRects.end(); ++itK)
         {
@@ -902,7 +902,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
                     if ( aSubsRect.Left()  <= rLine.Right() &&
                          aSubsRect.Right() >= rLine.Left() )
                     {
-                        long nTmp = rLine.Top()-(gProp.nSPixelSzH+1);
+                        long nTmp = rLine.Top()-(properties.nSPixelSzH+1);
                         if ( aSubsLineRect.Top() < nTmp )
                         {
                             SwRect aNewSubsRect( aSubsLineRect );
@@ -910,7 +910,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
                             aLineRects.push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
                                                 aSubsLineRect.GetSubColor() ) );
                         }
-                        nTmp = rLine.Bottom()+gProp.nSPixelSzH+1;
+                        nTmp = rLine.Bottom()+properties.nSPixelSzH+1;
                         if ( aSubsLineRect.Bottom() > nTmp )
                         {
                             SwRect aNewSubsRect( aSubsLineRect );
@@ -928,7 +928,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
                     if ( aSubsRect.Top() <= rLine.Bottom() &&
                          aSubsRect.Bottom() >= rLine.Top() )
                     {
-                        long nTmp = rLine.Left()-(gProp.nSPixelSzW+1);
+                        long nTmp = rLine.Left()-(properties.nSPixelSzW+1);
                         if ( aSubsLineRect.Left() < nTmp )
                         {
                             SwRect aNewSubsRect( aSubsLineRect );
@@ -936,7 +936,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
                             aLineRects.push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
                                                 aSubsLineRect.GetSubColor() ) );
                         }
-                        nTmp = rLine.Right()+gProp.nSPixelSzW+1;
+                        nTmp = rLine.Right()+properties.nSPixelSzW+1;
                         if ( aSubsLineRect.Right() > nTmp )
                         {
                             SwRect aNewSubsRect( aSubsLineRect );
@@ -1063,7 +1063,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties
                     pLast = &rLRect.GetColor();
 
                     sal_uLong nOldDrawMode = pOut->GetDrawMode();
-                    if( gProp.pSGlobalShell->GetWin() &&
+                    if( properties.pSGlobalShell->GetWin() &&
                         Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
                         pOut->SetDrawMode( 0 );
 
@@ -1098,7 +1098,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties
                     pLast = &rLRect.GetColor();
 
                     sal_uLong nOldDrawMode = pOut->GetDrawMode();
-                    if( gProp.pSGlobalShell->GetWin() &&
+                    if( properties.pSGlobalShell->GetWin() &&
                         Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
                     {
                         pOut->SetDrawMode( 0 );
@@ -1118,7 +1118,8 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties
 }
 
 void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
-                                   const SwLineRects *pRects )
+                                   const SwLineRects *pRects,
+                                   SwPaintProperties& properties )
 {
     if ( !aLineRects.empty() )
     {
@@ -1174,7 +1175,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
         }
 
         if ( pRects && (!pRects->aLineRects.empty()) )
-            RemoveSuperfluousSubsidiaryLines( *pRects );
+            RemoveSuperfluousSubsidiaryLines( *pRects, properties );
 
         if ( !aLineRects.empty() )
         {
@@ -3364,7 +3365,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
                     // collect sub-lines
                     pPage->RefreshSubsidiary( aPaintRect );
                     // paint special sub-lines
-                    gProp.pSSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL );
+                    gProp.pSSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL, gProp );
                 }
 
                 pPage->Paint( aPaintRect );
@@ -3380,7 +3381,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
                 gProp.pSLines->PaintLines( pSh->GetOut(), gProp );
                 if ( pSh->GetWin() )
                 {
-                    gProp.pSSubsLines->PaintSubsidiary( pSh->GetOut(), gProp.pSLines );
+                    gProp.pSSubsLines->PaintSubsidiary( pSh->GetOut(), gProp.pSLines, gProp );
                     DELETEZ( gProp.pSSubsLines );
                     DELETEZ( gProp.pSSpecSubsLines );
                 }
@@ -4323,8 +4324,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
         // 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.pSSubsLines->PaintSubsidiary( pOut, gProp.pSLines );
+        gProp.pSSpecSubsLines->PaintSubsidiary( pOut, NULL, gProp );
+        gProp.pSSubsLines->PaintSubsidiary( pOut, gProp.pSLines, gProp );
         if ( !bSubsLineRectsCreated )
             // unlock subsidiary lines
             gProp.pSSubsLines->LockLines( false );
@@ -6713,10 +6714,10 @@ void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const
             {
                 // OD 20.12.2002 #106318# - paint special subsidiary lines
                 // and delete its container
-                gProp.pSSpecSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), NULL );
+                gProp.pSSpecSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), NULL, gProp );
                 DELETEZ( gProp.pSSpecSubsLines );
 
-                gProp.pSSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), gProp.pSLines );
+                gProp.pSSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), gProp.pSLines, gProp );
                 DELETEZ( gProp.pSSubsLines );
             }
         }


More information about the Libreoffice-commits mailing list