Kaydet (Commit) ababde70 authored tarafından Michaël Lefèvre's avatar Michaël Lefèvre Kaydeden (comit) Caolán McNamara

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/13258Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 4edba255
...@@ -200,9 +200,9 @@ public: ...@@ -200,9 +200,9 @@ public:
class SwSubsRects : public SwLineRects class SwSubsRects : public SwLineRects
{ {
void RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ); void RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects, SwPaintProperties &properties );
public: public:
void PaintSubsidiary( OutputDevice *pOut, const SwLineRects *pRects ); void PaintSubsidiary( OutputDevice *pOut, const SwLineRects *pRects, SwPaintProperties &properties );
}; };
class BorderLines class BorderLines
...@@ -856,7 +856,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut, SwPaintProperties& propertie ...@@ -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 // All help lines that are covered by any border will be removed or split
for (size_t i = 0; i < aLineRects.size(); ++i) for (size_t i = 0; i < aLineRects.size(); ++i)
...@@ -875,13 +875,13 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) ...@@ -875,13 +875,13 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
SwRect aSubsRect( aSubsLineRect ); SwRect aSubsRect( aSubsLineRect );
if ( bVerticalSubs ) if ( bVerticalSubs )
{ {
aSubsRect.Left ( aSubsRect.Left() - (gProp.nSPixelSzW+gProp.nSHalfPixelSzW) ); aSubsRect.Left ( aSubsRect.Left() - (properties.nSPixelSzW+properties.nSHalfPixelSzW) );
aSubsRect.Right ( aSubsRect.Right() + (gProp.nSPixelSzW+gProp.nSHalfPixelSzW) ); aSubsRect.Right ( aSubsRect.Right() + (properties.nSPixelSzW+properties.nSHalfPixelSzW) );
} }
else else
{ {
aSubsRect.Top ( aSubsRect.Top() - (gProp.nSPixelSzH+gProp.nSHalfPixelSzH) ); aSubsRect.Top ( aSubsRect.Top() - (properties.nSPixelSzH+properties.nSHalfPixelSzH) );
aSubsRect.Bottom( aSubsRect.Bottom() + (gProp.nSPixelSzH+gProp.nSHalfPixelSzH) ); aSubsRect.Bottom( aSubsRect.Bottom() + (properties.nSPixelSzH+properties.nSHalfPixelSzH) );
} }
for (const_iterator itK = rRects.aLineRects.begin(); itK != rRects.aLineRects.end(); ++itK) for (const_iterator itK = rRects.aLineRects.begin(); itK != rRects.aLineRects.end(); ++itK)
{ {
...@@ -902,7 +902,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) ...@@ -902,7 +902,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
if ( aSubsRect.Left() <= rLine.Right() && if ( aSubsRect.Left() <= rLine.Right() &&
aSubsRect.Right() >= rLine.Left() ) aSubsRect.Right() >= rLine.Left() )
{ {
long nTmp = rLine.Top()-(gProp.nSPixelSzH+1); long nTmp = rLine.Top()-(properties.nSPixelSzH+1);
if ( aSubsLineRect.Top() < nTmp ) if ( aSubsLineRect.Top() < nTmp )
{ {
SwRect aNewSubsRect( aSubsLineRect ); SwRect aNewSubsRect( aSubsLineRect );
...@@ -910,7 +910,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) ...@@ -910,7 +910,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
aLineRects.push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0, aLineRects.push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
aSubsLineRect.GetSubColor() ) ); aSubsLineRect.GetSubColor() ) );
} }
nTmp = rLine.Bottom()+gProp.nSPixelSzH+1; nTmp = rLine.Bottom()+properties.nSPixelSzH+1;
if ( aSubsLineRect.Bottom() > nTmp ) if ( aSubsLineRect.Bottom() > nTmp )
{ {
SwRect aNewSubsRect( aSubsLineRect ); SwRect aNewSubsRect( aSubsLineRect );
...@@ -928,7 +928,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) ...@@ -928,7 +928,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
if ( aSubsRect.Top() <= rLine.Bottom() && if ( aSubsRect.Top() <= rLine.Bottom() &&
aSubsRect.Bottom() >= rLine.Top() ) aSubsRect.Bottom() >= rLine.Top() )
{ {
long nTmp = rLine.Left()-(gProp.nSPixelSzW+1); long nTmp = rLine.Left()-(properties.nSPixelSzW+1);
if ( aSubsLineRect.Left() < nTmp ) if ( aSubsLineRect.Left() < nTmp )
{ {
SwRect aNewSubsRect( aSubsLineRect ); SwRect aNewSubsRect( aSubsLineRect );
...@@ -936,7 +936,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) ...@@ -936,7 +936,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
aLineRects.push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0, aLineRects.push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
aSubsLineRect.GetSubColor() ) ); aSubsLineRect.GetSubColor() ) );
} }
nTmp = rLine.Right()+gProp.nSPixelSzW+1; nTmp = rLine.Right()+properties.nSPixelSzW+1;
if ( aSubsLineRect.Right() > nTmp ) if ( aSubsLineRect.Right() > nTmp )
{ {
SwRect aNewSubsRect( aSubsLineRect ); SwRect aNewSubsRect( aSubsLineRect );
...@@ -1063,7 +1063,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties ...@@ -1063,7 +1063,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties
pLast = &rLRect.GetColor(); pLast = &rLRect.GetColor();
sal_uLong nOldDrawMode = pOut->GetDrawMode(); sal_uLong nOldDrawMode = pOut->GetDrawMode();
if( gProp.pSGlobalShell->GetWin() && if( properties.pSGlobalShell->GetWin() &&
Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
pOut->SetDrawMode( 0 ); pOut->SetDrawMode( 0 );
...@@ -1098,7 +1098,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties ...@@ -1098,7 +1098,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties
pLast = &rLRect.GetColor(); pLast = &rLRect.GetColor();
sal_uLong nOldDrawMode = pOut->GetDrawMode(); sal_uLong nOldDrawMode = pOut->GetDrawMode();
if( gProp.pSGlobalShell->GetWin() && if( properties.pSGlobalShell->GetWin() &&
Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
{ {
pOut->SetDrawMode( 0 ); pOut->SetDrawMode( 0 );
...@@ -1118,7 +1118,8 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties ...@@ -1118,7 +1118,8 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties &properties
} }
void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
const SwLineRects *pRects ) const SwLineRects *pRects,
SwPaintProperties& properties )
{ {
if ( !aLineRects.empty() ) if ( !aLineRects.empty() )
{ {
...@@ -1174,7 +1175,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, ...@@ -1174,7 +1175,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
} }
if ( pRects && (!pRects->aLineRects.empty()) ) if ( pRects && (!pRects->aLineRects.empty()) )
RemoveSuperfluousSubsidiaryLines( *pRects ); RemoveSuperfluousSubsidiaryLines( *pRects, properties );
if ( !aLineRects.empty() ) if ( !aLineRects.empty() )
{ {
...@@ -3364,7 +3365,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c ...@@ -3364,7 +3365,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
// collect sub-lines // collect sub-lines
pPage->RefreshSubsidiary( aPaintRect ); pPage->RefreshSubsidiary( aPaintRect );
// paint special sub-lines // paint special sub-lines
gProp.pSSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL ); gProp.pSSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL, gProp );
} }
pPage->Paint( aPaintRect ); pPage->Paint( aPaintRect );
...@@ -3380,7 +3381,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c ...@@ -3380,7 +3381,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
gProp.pSLines->PaintLines( pSh->GetOut(), gProp ); gProp.pSLines->PaintLines( pSh->GetOut(), gProp );
if ( pSh->GetWin() ) if ( pSh->GetWin() )
{ {
gProp.pSSubsLines->PaintSubsidiary( pSh->GetOut(), gProp.pSLines ); gProp.pSSubsLines->PaintSubsidiary( pSh->GetOut(), gProp.pSLines, gProp );
DELETEZ( gProp.pSSubsLines ); DELETEZ( gProp.pSSubsLines );
DELETEZ( gProp.pSSpecSubsLines ); DELETEZ( gProp.pSSpecSubsLines );
} }
...@@ -4323,8 +4324,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const ...@@ -4323,8 +4324,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
// Add subsidiary lines of fly frame and its lowers // Add subsidiary lines of fly frame and its lowers
RefreshLaySubsidiary( pPage, aRect ); RefreshLaySubsidiary( pPage, aRect );
// paint subsidiary lines of fly frame and its lowers // paint subsidiary lines of fly frame and its lowers
gProp.pSSpecSubsLines->PaintSubsidiary( pOut, NULL ); gProp.pSSpecSubsLines->PaintSubsidiary( pOut, NULL, gProp );
gProp.pSSubsLines->PaintSubsidiary( pOut, gProp.pSLines ); gProp.pSSubsLines->PaintSubsidiary( pOut, gProp.pSLines, gProp );
if ( !bSubsLineRectsCreated ) if ( !bSubsLineRectsCreated )
// unlock subsidiary lines // unlock subsidiary lines
gProp.pSSubsLines->LockLines( false ); gProp.pSSubsLines->LockLines( false );
...@@ -6713,10 +6714,10 @@ void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const ...@@ -6713,10 +6714,10 @@ void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const
{ {
// OD 20.12.2002 #106318# - paint special subsidiary lines // OD 20.12.2002 #106318# - paint special subsidiary lines
// and delete its container // and delete its container
gProp.pSSpecSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), NULL ); gProp.pSSpecSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), NULL, gProp );
DELETEZ( gProp.pSSpecSubsLines ); DELETEZ( gProp.pSSpecSubsLines );
gProp.pSSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), gProp.pSLines ); gProp.pSSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), gProp.pSLines, gProp );
DELETEZ( gProp.pSSubsLines ); DELETEZ( gProp.pSSubsLines );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment