sw,sc,sd,starmath: convert to vcl::RenderContext

Change-Id: I5d0a3b8ed1c49ba2806e0fa528d908da45afd58c
This commit is contained in:
Noel Grandin 2015-05-11 08:37:50 +02:00
parent 80244bff5f
commit fc9e78c788
26 changed files with 105 additions and 61 deletions

View File

@ -16,7 +16,8 @@
// Check for calls to OutputDevice methods that are not passing through RenderContext // Check for calls to OutputDevice methods that are not passing through RenderContext
namespace { namespace
{
class RenderContext: class RenderContext:
public RecursiveASTVisitor<RenderContext>, public loplugin::Plugin public RecursiveASTVisitor<RenderContext>, public loplugin::Plugin
@ -24,7 +25,9 @@ class RenderContext:
public: public:
explicit RenderContext(InstantiationData const & data): Plugin(data) {} explicit RenderContext(InstantiationData const & data): Plugin(data) {}
virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } virtual void run() override {
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
bool TraverseFunctionDecl(const FunctionDecl * decl); bool TraverseFunctionDecl(const FunctionDecl * decl);
@ -34,7 +37,8 @@ private:
bool mbChecking = false; bool mbChecking = false;
}; };
bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl) { bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl)
{
if (ignoreLocation(pFunctionDecl)) { if (ignoreLocation(pFunctionDecl)) {
return true; return true;
} }
@ -67,19 +71,53 @@ bool RenderContext::VisitCXXMemberCallExpr(const CXXMemberCallExpr* pCXXMemberCa
if (pCXXRecordDecl->getQualifiedNameAsString() != "OutputDevice") { if (pCXXRecordDecl->getQualifiedNameAsString() != "OutputDevice") {
return true; return true;
} }
// ignore a handful of methods. They will most probably still be present in Window for use during processing outside of the Paint()
// method lifecycle
const CXXMethodDecl *pCXXMethodDecl = pCXXMemberCallExpr->getMethodDecl();
if (pCXXMethodDecl->isInstance()) {
StringRef name = pCXXMethodDecl->getName();
if (name == "LogicToPixel" || name == "GetMapMode" || name == "GetFontMetric" || name == "LogicToLogic"
|| name == "PixelToLogic" || name == "SetDigitLanguage")
{
return true;
}
}
// for calling through a pointer
const ImplicitCastExpr *pImplicitCastExpr = dyn_cast<ImplicitCastExpr>(pCXXMemberCallExpr->getImplicitObjectArgument()); const ImplicitCastExpr *pImplicitCastExpr = dyn_cast<ImplicitCastExpr>(pCXXMemberCallExpr->getImplicitObjectArgument());
std::string t2 = "0"; std::string x = "0"; // for debugging
if (pImplicitCastExpr) { if (pImplicitCastExpr) {
t2 = "2"; x += "1";
QualType aType = pImplicitCastExpr->getSubExpr()->getType(); QualType aType = pImplicitCastExpr->getSubExpr()->getType();
if (aType->isPointerType()) if (aType->isPointerType())
aType = aType->getPointeeType(); aType = aType->getPointeeType();
t2 = aType.getAsString(); std::string t2 = aType.getAsString();
if (t2 == "vcl::RenderContext") if (t2 == "vcl::RenderContext" || t2 == "const vcl::RenderContext")
return true;
}
// for calling through a reference
const DeclRefExpr *pDeclRefExpr = dyn_cast<DeclRefExpr>(pCXXMemberCallExpr->getImplicitObjectArgument());
if (pDeclRefExpr) {
x += "2";
QualType aType = pDeclRefExpr->getType();
std::string t2 = aType.getAsString();
if (t2 == "vcl::RenderContext" || t2 == "const vcl::RenderContext")
return true;
}
// for calling through a chain of methods
const CXXMemberCallExpr *pMemberExpr = dyn_cast<CXXMemberCallExpr>(pCXXMemberCallExpr->getImplicitObjectArgument());
if (pMemberExpr) {
x += "3";
QualType aType = pMemberExpr->getType();
if (aType->isPointerType())
aType = aType->getPointeeType();
std::string t2 = aType.getAsString();
x += t2;
if (t2 == "vcl::RenderContext" || t2 == "const vcl::RenderContext")
return true; return true;
} }
report( report(
DiagnosticsEngine::Warning, DiagnosticsEngine::Warning,
// + x + pCXXMemberCallExpr->getImplicitObjectArgument()->getStmtClassName()
"Should be calling OutputDevice method through RenderContext.", "Should be calling OutputDevice method through RenderContext.",
pCXXMemberCallExpr->getLocStart()) pCXXMemberCallExpr->getLocStart())
<< pCXXMemberCallExpr->getSourceRange(); << pCXXMemberCallExpr->getSourceRange();

View File

@ -76,7 +76,7 @@ static void lcl_LimitRect( Rectangle& rRect, const Rectangle& rVisible )
// Wenn's weit daneben liegt, wird lcl_DrawOneFrame erst gar nicht gerufen. // Wenn's weit daneben liegt, wird lcl_DrawOneFrame erst gar nicht gerufen.
} }
static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel, static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const Rectangle& rInnerPixel,
const OUString& rTitle, const Color& rColor, bool bTextBelow, const OUString& rTitle, const Color& rColor, bool bTextBelow,
double nPPTX, double nPPTY, const Fraction& rZoomY, double nPPTX, double nPPTY, const Fraction& rZoomY,
ScDocument* pDoc, ScViewData* pButtonViewData, bool bLayoutRTL ) ScDocument* pDoc, ScViewData* pButtonViewData, bool bLayoutRTL )

View File

@ -111,7 +111,7 @@ IMPL_LINK_NOARG_TYPED(ScNoteMarker, TimeHdl, Timer *, void)
Draw(); Draw();
} }
static void lcl_DrawWin( SdrObject* pObject, vcl::Window* pWindow, const MapMode& rMap ) static void lcl_DrawWin( SdrObject* pObject, vcl::RenderContext* pWindow, const MapMode& rMap )
{ {
MapMode aOld = pWindow->GetMapMode(); MapMode aOld = pWindow->GetMapMode();
pWindow->SetMapMode( rMap ); pWindow->SetMapMode( rMap );

View File

@ -780,7 +780,7 @@ namespace {
static const double lclCornerRectTransparency = 40.0; static const double lclCornerRectTransparency = 40.0;
void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, const Rectangle& rRect) void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDev, const Rectangle& rRect)
{ {
long nPosZero = 0; long nPosZero = 0;
Rectangle aPaintRect = rRect; Rectangle aPaintRect = rRect;
@ -856,7 +856,7 @@ BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex )
return ScIconSetFormat::getBitmap( eType, nIndex ); return ScIconSetFormat::getBitmap( eType, nIndex );
} }
void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, OutputDevice* pDev, const Rectangle& rRect ) void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, vcl::RenderContext* pDev, const Rectangle& rRect )
{ {
//long nSize = 16; //long nSize = 16;
ScIconSetType eType = pOldIconSetInfo->eIconSetType; ScIconSetType eType = pOldIconSetInfo->eIconSetType;
@ -867,7 +867,7 @@ void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, OutputDevice* pDev, con
} }
void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground, void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground,
Rectangle& rRect, long nPosX, long nSignedOneX, OutputDevice* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo, Rectangle& rRect, long nPosX, long nSignedOneX, vcl::RenderContext* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo,
const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo) const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo)
{ {

View File

@ -1074,7 +1074,7 @@ void ScPrintFunc::SetDateTime( const Date& rDate, const tools::Time& rTime )
aFieldData.aTime = rTime; aFieldData.aTime = rTime;
} }
static void lcl_DrawGraphic( const Graphic &rGraphic, OutputDevice *pOut, static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext *pOut,
const Rectangle &rGrf, const Rectangle &rOut ) const Rectangle &rGrf, const Rectangle &rOut )
{ {
const bool bNotInside = !rOut.IsInside( rGrf ); const bool bNotInside = !rOut.IsInside( rGrf );
@ -1090,7 +1090,7 @@ static void lcl_DrawGraphic( const Graphic &rGraphic, OutputDevice *pOut,
pOut->Pop(); pOut->Pop();
} }
static void lcl_DrawGraphic( const SvxBrushItem &rBrush, OutputDevice *pOut, OutputDevice* pRefDev, static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext *pOut, OutputDevice* pRefDev,
const Rectangle &rOrg, const Rectangle &rOut, const Rectangle &rOrg, const Rectangle &rOut,
OUString const & referer ) OUString const & referer )
{ {

View File

@ -63,8 +63,8 @@ private:
}; };
void DeviceCopy ( void DeviceCopy (
OutputDevice& rTargetDevice, vcl::RenderContext& rTargetDevice,
OutputDevice& rSourceDevice, vcl::RenderContext& rSourceDevice,
const Rectangle& rBox) const Rectangle& rBox)
{ {
rTargetDevice.DrawOutDev( rTargetDevice.DrawOutDev(

View File

@ -398,7 +398,7 @@ void SmFontDialog::dispose()
namespace namespace
{ {
void getColors(vcl::Window &rRef, ColorData &rBgCol, ColorData &rTxtCol) void getColors(vcl::RenderContext &rRef, ColorData &rBgCol, ColorData &rTxtCol)
{ {
const StyleSettings &rS = rRef.GetSettings().GetStyleSettings(); const StyleSettings &rS = rRef.GetSettings().GetStyleSettings();
if (rS.GetHighContrastMode()) if (rS.GetHighContrastMode())

View File

@ -593,7 +593,7 @@ SmRect SmRect::AsGlyphRect() const
return aRect; return aRect;
} }
bool SmGetGlyphBoundRect(const OutputDevice &rDev, bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev,
const OUString &rText, Rectangle &rRect) const OUString &rText, Rectangle &rRect)
// basically the same as 'GetTextBoundRect' (in class 'OutputDevice') // basically the same as 'GetTextBoundRect' (in class 'OutputDevice')
// but with a string as argument. // but with a string as argument.

View File

@ -81,6 +81,7 @@ class SwAccessibleMap;
namespace vcl namespace vcl
{ {
typedef OutputDevice RenderContext;
class OldStylePrintAdaptor; class OldStylePrintAdaptor;
} }
@ -348,9 +349,9 @@ public:
// 1. GetRefDev: Either the printer or the virtual device from the doc // 1. GetRefDev: Either the printer or the virtual device from the doc
// 2. GetWin: Available if we not printing // 2. GetWin: Available if we not printing
// 3. GetOut: Printer, Window or Virtual device // 3. GetOut: Printer, Window or Virtual device
OutputDevice& GetRefDev() const; vcl::RenderContext& GetRefDev() const;
inline vcl::Window* GetWin() const { return mpWin; } inline vcl::Window* GetWin() const { return mpWin; }
inline OutputDevice* GetOut() const { return mpOut; } inline vcl::RenderContext* GetOut() const { return mpOut; }
void SetWin(vcl::Window* win) { mpWin = win; } void SetWin(vcl::Window* win) { mpWin = win; }
static inline bool IsLstEndAction() { return SwViewShell::mbLstAct; } static inline bool IsLstEndAction() { return SwViewShell::mbLstAct; }

View File

@ -78,7 +78,7 @@ IMPL_FIXEDMEMPOOL_NEWDEL( SwTableLineFmt )
IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBoxFmt ) IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBoxFmt )
IMPL_FIXEDMEMPOOL_NEWDEL( _SwCursor_SavePos ) IMPL_FIXEDMEMPOOL_NEWDEL( _SwCursor_SavePos )
Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev ) Size GetGraphicSizeTwip( const Graphic& rGraphic, vcl::RenderContext* pOutDev )
{ {
const MapMode aMapTwip( MAP_TWIP ); const MapMode aMapTwip( MAP_TWIP );
Size aSize( rGraphic.GetPrefSize() ); Size aSize( rGraphic.GetPrefSize() );

View File

@ -177,7 +177,7 @@ void SetOutDev( SwViewShell *pSh, OutputDevice *pOut )
} }
static void lcl_ClearArea( const SwFrm &rFrm, static void lcl_ClearArea( const SwFrm &rFrm,
OutputDevice &rOut, const SwRect& rPtArea, vcl::RenderContext &rOut, const SwRect& rPtArea,
const SwRect &rGrfArea ) const SwRect &rGrfArea )
{ {
SwRegionRects aRegion( rPtArea, 4 ); SwRegionRects aRegion( rPtArea, 4 );
@ -676,7 +676,7 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
} }
} }
static void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut ) static void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, vcl::RenderContext* pOut )
{ {
if(!pOut) if(!pOut)
@ -706,7 +706,7 @@ static void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInAr
} }
bool paintUsingPrimitivesHelper( bool paintUsingPrimitivesHelper(
OutputDevice& rOutputDevice, vcl::RenderContext& rOutputDevice,
const drawinglayer::primitive2d::Primitive2DSequence& rSequence, const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
const basegfx::B2DRange& rSourceRange, const basegfx::B2DRange& rSourceRange,
const basegfx::B2DRange& rTargetRange) const basegfx::B2DRange& rTargetRange)
@ -753,7 +753,7 @@ bool paintUsingPrimitivesHelper(
return false; return false;
} }
void paintGraphicUsingPrimitivesHelper(OutputDevice & rOutputDevice, void paintGraphicUsingPrimitivesHelper(vcl::RenderContext & rOutputDevice,
GraphicObject const& rGrfObj, GraphicAttr const& rGraphicAttr, GraphicObject const& rGrfObj, GraphicAttr const& rGraphicAttr,
SwRect const& rAlignedGrfArea) SwRect const& rAlignedGrfArea)
{ {
@ -832,7 +832,7 @@ void paintGraphicUsingPrimitivesHelper(OutputDevice & rOutputDevice,
@todo use aligned rectangle for drawing graphic. @todo use aligned rectangle for drawing graphic.
@todo pixel-align coordinations for drawing graphic. */ @todo pixel-align coordinations for drawing graphic. */
void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) const void SwNoTxtFrm::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfArea ) const
{ {
SwViewShell* pShell = getRootFrm()->GetCurrShell(); SwViewShell* pShell = getRootFrm()->GetCurrShell();

View File

@ -35,6 +35,7 @@ class SwFont;
namespace vcl { namespace vcl {
class Font; class Font;
class TextLayoutCache; class TextLayoutCache;
typedef OutputDevice RenderContext;
} }
class SwUnderlineFont; class SwUnderlineFont;
@ -176,12 +177,12 @@ public:
return pSh; return pSh;
} }
OutputDevice& GetOut() const vcl::RenderContext& GetOut() const
{ {
return *pOut; return *pOut;
} }
OutputDevice *GetpOut() const vcl::RenderContext *GetpOut() const
{ {
return pOut; return pOut;
} }

View File

@ -35,8 +35,7 @@ class SwNoTxtFrm: public SwCntntFrm
void InitCtor(); void InitCtor();
void Format ( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE; void Format ( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
void PaintCntnt ( OutputDevice*, const SwRect&, const SwRect& ) const; void PaintPicture( vcl::RenderContext*, const SwRect& ) const;
void PaintPicture( OutputDevice*, const SwRect& ) const;
virtual void DestroyImpl() SAL_OVERRIDE; virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwNoTxtFrm(); virtual ~SwNoTxtFrm();

View File

@ -333,7 +333,7 @@ bool isTableBoundariesEnabled()
* For 'small' twip-to-pixel relations (less then 2:1) * For 'small' twip-to-pixel relations (less then 2:1)
* values of <gProp.nSHalfPixelSzW> and <gProp.nSHalfPixelSzH> are set to ZERO * values of <gProp.nSHalfPixelSzW> and <gProp.nSHalfPixelSzH> are set to ZERO
*/ */
void SwCalcPixStatics( OutputDevice *pOut ) void SwCalcPixStatics( vcl::RenderContext *pOut )
{ {
// determine 'small' twip-to-pixel relation // determine 'small' twip-to-pixel relation
bool bSmallTwipToPxRelW = false; bool bSmallTwipToPxRelW = false;
@ -1247,7 +1247,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
return; return;
} }
const OutputDevice *pOut = gProp.bSFlyMetafile ? const vcl::RenderContext *pOut = gProp.bSFlyMetafile ?
gProp.pSFlyMetafileOut.get() : pSh->GetOut(); gProp.pSFlyMetafileOut.get() : pSh->GetOut();
// Hold original rectangle in pixel // Hold original rectangle in pixel
@ -1332,7 +1332,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
* If the x-/y-pixel positions are the same, the x-/y-pixel position of * If the x-/y-pixel positions are the same, the x-/y-pixel position of
* the second twip point is adjusted by a given amount of pixels * the second twip point is adjusted by a given amount of pixels
*/ */
static void lcl_CompPxPosAndAdjustPos( const OutputDevice& _rOut, static void lcl_CompPxPosAndAdjustPos( const vcl::RenderContext& _rOut,
const Point& _rRefPt, const Point& _rRefPt,
Point& _rCompPt, Point& _rCompPt,
const bool _bChkXPos, const bool _bChkXPos,
@ -1376,7 +1376,7 @@ static void lcl_CompPxPosAndAdjustPos( const OutputDevice& _rOut,
* *
* NOTE: Call this method before each <GraphicObject.Draw(...)> * NOTE: Call this method before each <GraphicObject.Draw(...)>
*/ */
void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut ) void SwAlignGrfRect( SwRect *pGrfRect, const vcl::RenderContext &rOut )
{ {
Rectangle aPxRect = rOut.LogicToPixel( pGrfRect->SVRect() ); Rectangle aPxRect = rOut.LogicToPixel( pGrfRect->SVRect() );
pGrfRect->Pos( rOut.PixelToLogic( aPxRect.TopLeft() ) ); pGrfRect->Pos( rOut.PixelToLogic( aPxRect.TopLeft() ) );
@ -1697,7 +1697,7 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
} }
static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush, static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
OutputDevice* _pOut, vcl::RenderContext* _pOut,
const SwRect& _rAlignedPaintRect, const SwRect& _rAlignedPaintRect,
const GraphicObject& _rGraphicObj, const GraphicObject& _rGraphicObj,
SwPaintProperties& properties) SwPaintProperties& properties)
@ -1814,7 +1814,7 @@ static inline void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
* *
* Also, change type of <bGrfNum> and <bClip> from <bool> to <bool> * Also, change type of <bGrfNum> and <bClip> from <bool> to <bool>
*/ */
static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut, static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext *pOut,
SwViewShell &rSh, const SwRect &rGrf, const SwRect &rOut, SwViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
bool bClip, bool bGrfNum, bool bClip, bool bGrfNum,
SwPaintProperties& properties, SwPaintProperties& properties,
@ -1857,7 +1857,7 @@ bool DrawFillAttributes(
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
const SwRect& rOriginalLayoutRect, const SwRect& rOriginalLayoutRect,
const SwRegionRects& rPaintRegion, const SwRegionRects& rPaintRegion,
OutputDevice& rOut) vcl::RenderContext& rOut)
{ {
if(rFillAttributes.get() && rFillAttributes->isUsed()) if(rFillAttributes.get() && rFillAttributes->isUsed())
{ {
@ -1961,7 +1961,7 @@ bool DrawFillAttributes(
void DrawGraphic( void DrawGraphic(
const SvxBrushItem *pBrush, const SvxBrushItem *pBrush,
OutputDevice *pOutDev, vcl::RenderContext *pOutDev,
const SwRect &rOrg, const SwRect &rOrg,
const SwRect &rOut, const SwRect &rOut,
const sal_uInt8 nGrfNum, const sal_uInt8 nGrfNum,
@ -2316,7 +2316,7 @@ void DrawGraphic(
* and other changes to the to be painted rectangle, this method is called for the * and other changes to the to be painted rectangle, this method is called for the
* rectangle to be painted in order to adjust it to the pixel it is overlapping * rectangle to be painted in order to adjust it to the pixel it is overlapping
*/ */
static void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const OutputDevice &aOut ) static void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const vcl::RenderContext &aOut )
{ {
// local constant object of class <Size> to determine number of Twips // local constant object of class <Size> to determine number of Twips
// representing a pixel. // representing a pixel.
@ -4585,7 +4585,7 @@ static void lcl_PaintShadow( const SwRect& rRect, SwRect& rOutRect,
break; break;
} }
OutputDevice *pOut = properties.pSGlobalShell->GetOut(); vcl::RenderContext *pOut = properties.pSGlobalShell->GetOut();
sal_uLong nOldDrawMode = pOut->GetDrawMode(); sal_uLong nOldDrawMode = pOut->GetDrawMode();
Color aShadowColor( rShadow.GetColor().GetRGBColor() ); Color aShadowColor( rShadow.GetColor().GetRGBColor() );
@ -6062,7 +6062,7 @@ bool SwPageFrm::IsLeftShadowNeeded() const
enum PaintArea {LEFT, RIGHT, TOP, BOTTOM}; enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
/// Wrapper around pOut->DrawBitmapEx. /// Wrapper around pOut->DrawBitmapEx.
static void lcl_paintBitmapExToRect(OutputDevice *pOut, const Point& aPoint, const Size& aSize, const BitmapEx& rBitmapEx, PaintArea eArea) static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoint, const Size& aSize, const BitmapEx& rBitmapEx, PaintArea eArea)
{ {
// The problem is that if we get called multiple times and the color is // The problem is that if we get called multiple times and the color is
// partly transparent, then the result will get darker and darker. To avoid // partly transparent, then the result will get darker and darker. To avoid

View File

@ -100,8 +100,8 @@ bool SwRootFrm::HasSameRect( const SwRect& rRect )
// an virtual output device is used. // an virtual output device is used.
void SetMappingForVirtDev( const Point& _rNewOrigin, void SetMappingForVirtDev( const Point& _rNewOrigin,
MapMode* , MapMode* ,
const OutputDevice* _pOrgOutDev, const vcl::RenderContext* _pOrgOutDev,
VirtualDevice* _pVirDev ) vcl::RenderContext* _pVirDev )
{ {
// new solution: set pixel offset at virtual output device // new solution: set pixel offset at virtual output device
Point aPixelOffset = _pOrgOutDev->LogicToPixel( _rNewOrigin ); Point aPixelOffset = _pOrgOutDev->LogicToPixel( _rNewOrigin );

View File

@ -274,12 +274,12 @@ public:
inline SwViewShell *GetVsh() { return m_pVsh; } inline SwViewShell *GetVsh() { return m_pVsh; }
inline const SwViewShell *GetVsh() const { return m_pVsh; } inline const SwViewShell *GetVsh() const { return m_pVsh; }
inline OutputDevice *GetOut() { return m_pOut; } inline vcl::RenderContext *GetOut() { return m_pOut; }
inline const OutputDevice *GetOut() const { return m_pOut; } inline const vcl::RenderContext *GetOut() const { return m_pOut; }
inline void SetOut( OutputDevice* pNewOut ) { m_pOut = pNewOut; } inline void SetOut( OutputDevice* pNewOut ) { m_pOut = pNewOut; }
inline OutputDevice *GetRefDev() { return m_pRef; } inline vcl::RenderContext *GetRefDev() { return m_pRef; }
inline const OutputDevice *GetRefDev() const { return m_pRef; } inline const vcl::RenderContext *GetRefDev() const { return m_pRef; }
inline SwFont *GetFont() { return m_pFnt; } inline SwFont *GetFont() { return m_pFnt; }
inline const SwFont *GetFont() const { return m_pFnt; } inline const SwFont *GetFont() const { return m_pFnt; }

View File

@ -167,8 +167,8 @@ void SwFntObj::CreatePrtFont( const OutputDevice& rPrt )
* 2. PDF export from online layout * 2. PDF export from online layout
* 3. Prospect/PagePreview pringing * 3. Prospect/PagePreview pringing
*/ */
static bool lcl_IsFontAdjustNecessary( const OutputDevice& rOutDev, static bool lcl_IsFontAdjustNecessary( const vcl::RenderContext& rOutDev,
const OutputDevice& rRefDev ) const vcl::RenderContext& rRefDev )
{ {
return &rRefDev != &rOutDev && return &rRefDev != &rOutDev &&
OUTDEV_WINDOW != rRefDev.GetOutDevType() && OUTDEV_WINDOW != rRefDev.GetOutDevType() &&
@ -619,7 +619,7 @@ static sal_uInt8 lcl_WhichPunctuation( sal_Unicode cChar )
return SwScriptInfo::SPECIAL_LEFT; return SwScriptInfo::SPECIAL_LEFT;
} }
static bool lcl_IsMonoSpaceFont( const OutputDevice& rOut ) static bool lcl_IsMonoSpaceFont( const vcl::RenderContext& rOut )
{ {
const OUString aStr1( sal_Unicode( 0x3008 ) ); const OUString aStr1( sal_Unicode( 0x3008 ) );
const OUString aStr2( sal_Unicode( 0x307C ) ); const OUString aStr2( sal_Unicode( 0x307C ) );

View File

@ -1521,7 +1521,7 @@ SwUnderlineFont::~SwUnderlineFont()
/// Helper for filters to find true lineheight of a font /// Helper for filters to find true lineheight of a font
long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess, long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
const SwAttrSet &rSet, const SwAttrSet &rSet,
const OutputDevice &rOut, sal_Int16 nScript) const vcl::RenderContext &rOut, sal_Int16 nScript)
{ {
SwFont aFont(&rSet, &rIDocumentSettingAccess); SwFont aFont(&rSet, &rIDocumentSettingAccess);
sal_uInt8 nActual; sal_uInt8 nActual;
@ -1540,7 +1540,7 @@ long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
} }
aFont.SetActual(nActual); aFont.SetActual(nActual);
OutputDevice &rMutableOut = const_cast<OutputDevice &>(rOut); vcl::RenderContext &rMutableOut = const_cast<vcl::RenderContext &>(rOut);
const vcl::Font aOldFont(rMutableOut.GetFont()); const vcl::Font aOldFont(rMutableOut.GetFont());
rMutableOut.SetFont(aFont.GetActualFont()); rMutableOut.SetFont(aFont.GetActualFont());

View File

@ -146,7 +146,7 @@ lcl_PaintTransparentFormControls(SwViewShell & rShell, SwRect const& rRect)
if (rShell.GetWin()) if (rShell.GetWin())
{ {
vcl::Window& rWindow = *(rShell.GetWin()); vcl::Window& rWindow = *(rShell.GetWin());
const Rectangle aRectanglePixel(rWindow.LogicToPixel(rRect.SVRect())); const Rectangle aRectanglePixel(rShell.GetOut()->LogicToPixel(rRect.SVRect()));
PaintTransparentChildren(rWindow, aRectanglePixel); PaintTransparentChildren(rWindow, aRectanglePixel);
} }
} }

View File

@ -188,7 +188,7 @@ void SetSwVisArea( SwViewShell *pSh, const SwRect &rRect )
// at the same position // at the same position
aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y(); aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
OutputDevice *pOut = pSh->GetOut(); vcl::RenderContext *pOut = pSh->GetOut();
MapMode aMapMode( pOut->GetMapMode() ); MapMode aMapMode( pOut->GetMapMode() );
aMapMode.SetOrigin( aPt ); aMapMode.SetOrigin( aPt );

View File

@ -190,7 +190,7 @@ OUString GetDefaultString(sal_Int32 nChars)
return aStr; return aStr;
} }
static void calcFontHeightAnyAscent( OutputDevice* _pWin, vcl::Font& _rFont, long& _nHeight, long& _nAscent ) static void calcFontHeightAnyAscent( vcl::RenderContext* _pWin, vcl::Font& _rFont, long& _nHeight, long& _nAscent )
{ {
if ( !_nHeight ) if ( !_nHeight )
{ {

View File

@ -879,7 +879,7 @@ void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType
m_pStartEdit->GetModifyHdl().Call(m_pStartEdit); m_pStartEdit->GetModifyHdl().Call(m_pStartEdit);
} }
static long lcl_DrawBullet(VirtualDevice* pVDev, static long lcl_DrawBullet(vcl::RenderContext* pVDev,
const SwNumFmt& rFmt, long nXStart, const SwNumFmt& rFmt, long nXStart,
long nYStart, const Size& rSize) long nYStart, const Size& rSize)
{ {
@ -897,7 +897,7 @@ static long lcl_DrawBullet(VirtualDevice* pVDev,
return nRet; return nRet;
} }
static long lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, long nXStart, static long lcl_DrawGraphic(vcl::RenderContext* pVDev, const SwNumFmt &rFmt, long nXStart,
long nYStart, long nDivision) long nYStart, long nDivision)
{ {
const SvxBrushItem* pBrushItem = rFmt.GetBrush(); const SvxBrushItem* pBrushItem = rFmt.GetBrush();

View File

@ -128,7 +128,7 @@ void SwSrcView::InitInterface_Impl()
TYPEINIT1(SwSrcView, SfxViewShell) TYPEINIT1(SwSrcView, SfxViewShell)
static void lcl_PrintHeader( OutputDevice &rOutDev, sal_Int32 nPages, sal_Int32 nCurPage, const OUString& rTitle ) static void lcl_PrintHeader( vcl::RenderContext &rOutDev, sal_Int32 nPages, sal_Int32 nCurPage, const OUString& rTitle )
{ {
short nLeftMargin = LMARGPRN; short nLeftMargin = LMARGPRN;
Size aSz = rOutDev.GetOutputSize(); Size aSz = rOutDev.GetOutputSize();

View File

@ -37,7 +37,7 @@ VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& );
void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ); void SetAppPrintOptions( SwViewShell* pSh, bool bWeb );
// The following functions are available in viewport.cxx // The following functions are available in viewport.cxx
void ViewResizePixel( const vcl::Window &rRef, void ViewResizePixel( const vcl::RenderContext &rRef,
const Point &rOfst, const Point &rOfst,
const Size &rSize, const Size &rSize,
const Size &rEditSz, const Size &rEditSz,

View File

@ -832,7 +832,7 @@ void SwView::CalcAndSetBorderPixel( SvBorder &rToFill, bool /*bInner*/ )
SetBorderPixel( rToFill ); SetBorderPixel( rToFill );
} }
void ViewResizePixel( const vcl::Window &rRef, void ViewResizePixel( const vcl::RenderContext &rRef,
const Point &rOfst, const Point &rOfst,
const Size &rSize, const Size &rSize,
const Size &rEditSz, const Size &rEditSz,

View File

@ -1006,6 +1006,11 @@ OutputDevice* Application::GetDefaultDevice()
return ImplGetDefaultWindow(); return ImplGetDefaultWindow();
} }
vcl::RenderContext* Application::GetDefaultRenderContext()
{
return ImplGetDefaultWindow();
}
vcl::Window* Application::GetFirstTopLevelWindow() vcl::Window* Application::GetFirstTopLevelWindow()
{ {
ImplSVData* pSVData = ImplGetSVData(); ImplSVData* pSVData = ImplGetSVData();