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

Move bFlyMetafile and pFlyMetafileOut into properties container

Change-Id: I88b9a193a790fd1985bdd0f83d7b75993a746c0e
Reviewed-on: https://gerrit.libreoffice.org/12483Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7b2985ed
...@@ -224,11 +224,6 @@ public: ...@@ -224,11 +224,6 @@ public:
} }
}; };
//Only repaint the Fly content as well as the background of the Fly content if
//a metafile is taken of the Fly.
static bool bFlyMetafile = false;
static OutputDevice *pFlyMetafileOut = 0;
//Retouch for transparent Flys is done by the background of the Flys. //Retouch for transparent Flys is done by the background of the Flys.
//The Fly itself should certainly not be spared out. See PaintBackground and //The Fly itself should certainly not be spared out. See PaintBackground and
//lcl_SubtractFlys() //lcl_SubtractFlys()
...@@ -266,9 +261,12 @@ Color aGlobalRetoucheColor; ...@@ -266,9 +261,12 @@ Color aGlobalRetoucheColor;
* Container for static properties * Container for static properties
*/ */
struct SwPaintProperties { struct SwPaintProperties {
bool bSFlyMetafile; //Only repaint the Fly content as well as the background of the Fly content if
//a metafile is taken of the Fly.
bool bSFlyMetafile = false;
OutputDevice *pSFlyMetafileOut = 0;
SwViewShell *pSGlobalShell = 0; SwViewShell *pSGlobalShell = 0;
OutputDevice *pSFlyMetafileOut;
SwFlyFrm *pSRetoucheFly, SwFlyFrm *pSRetoucheFly,
*pSRetoucheFly2; *pSRetoucheFly2;
SwFlyFrm *pSFlyOnlyDraw = 0; SwFlyFrm *pSFlyOnlyDraw = 0;
...@@ -385,9 +383,9 @@ public: ...@@ -385,9 +383,9 @@ public:
SwSavePaintStatics::SwSavePaintStatics() SwSavePaintStatics::SwSavePaintStatics()
{ {
// Saving globales // Saving globales
bSFlyMetafile = bFlyMetafile; bSFlyMetafile = gProp.bSFlyMetafile;
pSGlobalShell = gProp.pSGlobalShell; pSGlobalShell = gProp.pSGlobalShell;
pSFlyMetafileOut = pFlyMetafileOut; pSFlyMetafileOut = gProp.pSFlyMetafileOut;
pSRetoucheFly = pRetoucheFly; pSRetoucheFly = pRetoucheFly;
pSRetoucheFly2 = pRetoucheFly2; pSRetoucheFly2 = pRetoucheFly2;
pSFlyOnlyDraw = gProp.pSFlyOnlyDraw; pSFlyOnlyDraw = gProp.pSFlyOnlyDraw;
...@@ -407,8 +405,8 @@ SwSavePaintStatics::SwSavePaintStatics() ...@@ -407,8 +405,8 @@ SwSavePaintStatics::SwSavePaintStatics()
aSScaleY = gProp.aSScaleY; aSScaleY = gProp.aSScaleY;
// Restoring globales to default // Restoring globales to default
bFlyMetafile = false; gProp.bSFlyMetafile = false;
pFlyMetafileOut = 0; gProp.pSFlyMetafileOut = 0;
pRetoucheFly = 0; pRetoucheFly = 0;
pRetoucheFly2 = 0; pRetoucheFly2 = 0;
nPixelSzW = nPixelSzH = nPixelSzW = nPixelSzH =
...@@ -426,8 +424,8 @@ SwSavePaintStatics::~SwSavePaintStatics() ...@@ -426,8 +424,8 @@ SwSavePaintStatics::~SwSavePaintStatics()
{ {
// Restoring globales to saved one // Restoring globales to saved one
gProp.pSGlobalShell = pSGlobalShell; gProp.pSGlobalShell = pSGlobalShell;
bFlyMetafile = bSFlyMetafile; gProp.bSFlyMetafile = bSFlyMetafile;
pFlyMetafileOut = pSFlyMetafileOut; gProp.pSFlyMetafileOut = pSFlyMetafileOut;
pRetoucheFly = pSRetoucheFly; pRetoucheFly = pSRetoucheFly;
pRetoucheFly2 = pSRetoucheFly2; pRetoucheFly2 = pSRetoucheFly2;
gProp.pSFlyOnlyDraw = pSFlyOnlyDraw; gProp.pSFlyOnlyDraw = pSFlyOnlyDraw;
...@@ -1222,14 +1220,14 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh ) ...@@ -1222,14 +1220,14 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
// Make sure that view shell (parameter <pSh>) exists, if the output device // Make sure that view shell (parameter <pSh>) exists, if the output device
// is taken from this view shell --> no output device, no alignment // is taken from this view shell --> no output device, no alignment
// Output device taken from view shell <pSh>, if <bFlyMetafile> not set // Output device taken from view shell <pSh>, if <gProp.bSFlyMetafile> not set
if ( !bFlyMetafile && !pSh ) if ( !gProp.bSFlyMetafile && !pSh )
{ {
return; return;
} }
const OutputDevice *pOut = bFlyMetafile ? const OutputDevice *pOut = gProp.bSFlyMetafile ?
pFlyMetafileOut : pSh->GetOut(); gProp.pSFlyMetafileOut : pSh->GetOut();
// Hold original rectangle in pixel // Hold original rectangle in pixel
const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() ); const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() );
...@@ -1687,9 +1685,9 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush, ...@@ -1687,9 +1685,9 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
{ {
/// determine color of background /// determine color of background
/// If color of background brush is not "no fill"/"auto fill" or /// If color of background brush is not "no fill"/"auto fill" or
/// <bFlyMetafile> is set, use color of background brush, otherwise /// <gProp.bSFlyMetafile> is set, use color of background brush, otherwise
/// use global retouche color. /// use global retouche color.
const Color aColor( ( (_rBackgrdBrush.GetColor() != COL_TRANSPARENT) || bFlyMetafile ) const Color aColor( ( (_rBackgrdBrush.GetColor() != COL_TRANSPARENT) || gProp.bSFlyMetafile )
? _rBackgrdBrush.GetColor() ? _rBackgrdBrush.GetColor()
: aGlobalRetoucheColor ); : aGlobalRetoucheColor );
...@@ -2140,7 +2138,7 @@ void DrawGraphic( ...@@ -2140,7 +2138,7 @@ void DrawGraphic(
// instead of checking, if transparency is not set. // instead of checking, if transparency is not set.
const Color aColor( pBrush && const Color aColor( pBrush &&
( !(pBrush->GetColor() == COL_TRANSPARENT) || ( !(pBrush->GetColor() == COL_TRANSPARENT) ||
bFlyMetafile ) gProp.bSFlyMetafile )
? pBrush->GetColor() ? pBrush->GetColor()
: aGlobalRetoucheColor ); : aGlobalRetoucheColor );
...@@ -6463,7 +6461,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, ...@@ -6463,7 +6461,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode ); bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode );
//- Output if a separate background is used. //- Output if a separate background is used.
bool bNoFlyBackground = !bFlyMetafile && !bBack && IsFlyFrm(); bool bNoFlyBackground = !gProp.bSFlyMetafile && !bBack && IsFlyFrm();
if ( bNoFlyBackground ) if ( bNoFlyBackground )
{ {
// OD 05.09.2002 #102912# - Fly frame has no background. // OD 05.09.2002 #102912# - Fly frame has no background.
...@@ -7331,7 +7329,7 @@ const vcl::Font& SwPageFrm::GetEmptyPageFont() ...@@ -7331,7 +7329,7 @@ const vcl::Font& SwPageFrm::GetEmptyPageFont()
*/ */
void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
{ {
if ( bFlyMetafile ) if ( gProp.bSFlyMetafile )
return; return;
OSL_ENSURE( GetUpper(), "Retouche try without Upper." ); OSL_ENSURE( GetUpper(), "Retouche try without Upper." );
...@@ -7643,8 +7641,8 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) ...@@ -7643,8 +7641,8 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
vcl::Window *pWin = pSh->GetWin(); vcl::Window *pWin = pSh->GetWin();
sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom(); sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom();
::SetOutDevAndWin( pSh, &aDev, 0, 100 ); ::SetOutDevAndWin( pSh, &aDev, 0, 100 );
bFlyMetafile = true; gProp.bSFlyMetafile = true;
pFlyMetafileOut = pWin; gProp.pSFlyMetafileOut = pWin;
SwViewImp *pImp = pSh->Imp(); SwViewImp *pImp = pSh->Imp();
gProp.pSFlyOnlyDraw = pFly; gProp.pSFlyOnlyDraw = pFly;
...@@ -7672,8 +7670,8 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) ...@@ -7672,8 +7670,8 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
DELETEZ( pLines ); DELETEZ( pLines );
gProp.pSFlyOnlyDraw = 0; gProp.pSFlyOnlyDraw = 0;
pFlyMetafileOut = 0; gProp.pSFlyMetafileOut = 0;
bFlyMetafile = false; gProp.bSFlyMetafile = false;
::SetOutDevAndWin( pSh, pOld, pWin, nZoom ); ::SetOutDevAndWin( pSh, pOld, pWin, nZoom );
// #i92711# end Pre/PostPaint encapsulation when pOut is back and content is painted // #i92711# end Pre/PostPaint encapsulation when pOut is back and content is painted
......
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