1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <tools/ref.hxx> 32*cdf0e10cSrcweir #include <tools/debug.hxx> 33*cdf0e10cSrcweir #include <tools/poly.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <vcl/svapp.hxx> 36*cdf0e10cSrcweir #include <vcl/region.hxx> 37*cdf0e10cSrcweir #include <vcl/virdev.hxx> 38*cdf0e10cSrcweir #include <vcl/window.hxx> 39*cdf0e10cSrcweir #include <vcl/metaact.hxx> 40*cdf0e10cSrcweir #include <vcl/gdimtf.hxx> 41*cdf0e10cSrcweir #include <vcl/print.hxx> 42*cdf0e10cSrcweir #include <vcl/outdev.hxx> 43*cdf0e10cSrcweir #include <vcl/unowrap.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include <window.h> 46*cdf0e10cSrcweir #include <region.h> 47*cdf0e10cSrcweir #include <outdev.h> 48*cdf0e10cSrcweir #include <sallayout.hxx> 49*cdf0e10cSrcweir #include <salgdi.hxx> 50*cdf0e10cSrcweir #include <salframe.hxx> 51*cdf0e10cSrcweir #include <salvd.hxx> 52*cdf0e10cSrcweir #include <salprn.hxx> 53*cdf0e10cSrcweir #include <svdata.hxx> 54*cdf0e10cSrcweir #include <outdata.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir #include "basegfx/polygon/b2dpolygon.hxx" 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir // ---------------------------------------------------------------------------- 60*cdf0e10cSrcweir // The only common SalFrame method 61*cdf0e10cSrcweir // ---------------------------------------------------------------------------- 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir SalFrameGeometry SalFrame::GetGeometry() 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir // mirror frame coordinates at parent 66*cdf0e10cSrcweir SalFrame *pParent = GetParent(); 67*cdf0e10cSrcweir if( pParent && Application::GetSettings().GetLayoutRTL() ) 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir SalFrameGeometry aGeom = maGeometry; 70*cdf0e10cSrcweir int parent_x = aGeom.nX - pParent->maGeometry.nX; 71*cdf0e10cSrcweir aGeom.nX = pParent->maGeometry.nX + pParent->maGeometry.nWidth - maGeometry.nWidth - parent_x; 72*cdf0e10cSrcweir return aGeom; 73*cdf0e10cSrcweir } 74*cdf0e10cSrcweir else 75*cdf0e10cSrcweir return maGeometry; 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir // ---------------------------------------------------------------------------- 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir SalGraphics::SalGraphics() 81*cdf0e10cSrcweir : m_nLayout( 0 ), 82*cdf0e10cSrcweir m_bAntiAliasB2DDraw(false) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir // read global RTL settings 85*cdf0e10cSrcweir if( Application::GetSettings().GetLayoutRTL() ) 86*cdf0e10cSrcweir m_nLayout = SAL_LAYOUT_BIDI_RTL; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir SalGraphics::~SalGraphics() 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // ---------------------------------------------------------------------------- 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir bool SalGraphics::drawAlphaBitmap( const SalTwoRect&, 96*cdf0e10cSrcweir const SalBitmap&, const SalBitmap& ) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir return false; 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir // ---------------------------------------------------------------------------- 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) const 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir long w; 106*cdf0e10cSrcweir if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) 107*cdf0e10cSrcweir w = pOutDev->GetOutputWidthPixel(); 108*cdf0e10cSrcweir else 109*cdf0e10cSrcweir w = GetGraphicsWidth(); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir if( w ) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir if( pOutDev && pOutDev->ImplIsAntiparallel() ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; 116*cdf0e10cSrcweir // mirror this window back 117*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 120*cdf0e10cSrcweir if( bBack ) 121*cdf0e10cSrcweir x = x - devX + pOutDevRef->GetOutOffXPixel(); 122*cdf0e10cSrcweir else 123*cdf0e10cSrcweir x = devX + (x - pOutDevRef->GetOutOffXPixel()); 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir else 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 128*cdf0e10cSrcweir if( bBack ) 129*cdf0e10cSrcweir x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; 130*cdf0e10cSrcweir else 131*cdf0e10cSrcweir x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - 1; 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) 135*cdf0e10cSrcweir x = w-1-x; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bool bBack ) const 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir long w; 142*cdf0e10cSrcweir if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) 143*cdf0e10cSrcweir w = pOutDev->GetOutputWidthPixel(); 144*cdf0e10cSrcweir else 145*cdf0e10cSrcweir w = GetGraphicsWidth(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir if( w ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir if( pOutDev && pOutDev->ImplIsAntiparallel() ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; 152*cdf0e10cSrcweir // mirror this window back 153*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 156*cdf0e10cSrcweir if( bBack ) 157*cdf0e10cSrcweir x = x - devX + pOutDevRef->GetOutOffXPixel(); 158*cdf0e10cSrcweir else 159*cdf0e10cSrcweir x = devX + (x - pOutDevRef->GetOutOffXPixel()); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir else 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 164*cdf0e10cSrcweir if( bBack ) 165*cdf0e10cSrcweir x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + nWidth; 166*cdf0e10cSrcweir else 167*cdf0e10cSrcweir x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - nWidth; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) 171*cdf0e10cSrcweir x = w-nWidth-x; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir sal_Bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev, bool bBack ) const 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir long w; 179*cdf0e10cSrcweir if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) 180*cdf0e10cSrcweir w = pOutDev->GetOutputWidthPixel(); 181*cdf0e10cSrcweir else 182*cdf0e10cSrcweir w = GetGraphicsWidth(); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir if( w ) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir sal_uInt32 i, j; 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir if( pOutDev && pOutDev->ImplIsAntiparallel() ) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; 191*cdf0e10cSrcweir // mirror this window back 192*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 195*cdf0e10cSrcweir if( bBack ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir //long x = w-1-pPtAry[i].mnX; 200*cdf0e10cSrcweir //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); 201*cdf0e10cSrcweir pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); 202*cdf0e10cSrcweir pPtAry2[j].mnY = pPtAry[i].mnY; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir else 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir //long x = w-1-pPtAry[i].mnX; 210*cdf0e10cSrcweir //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); 211*cdf0e10cSrcweir pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); 212*cdf0e10cSrcweir pPtAry2[j].mnY = pPtAry[i].mnY; 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir else 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 219*cdf0e10cSrcweir if( bBack ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir //long x = w-1-pPtAry[i].mnX; 224*cdf0e10cSrcweir //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); 225*cdf0e10cSrcweir pPtAry2[j].mnX = pPtAry[i].mnX - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; 226*cdf0e10cSrcweir pPtAry2[j].mnY = pPtAry[i].mnY; 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir else 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir //long x = w-1-pPtAry[i].mnX; 234*cdf0e10cSrcweir //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); 235*cdf0e10cSrcweir pPtAry2[j].mnX = pOutDevRef->GetOutputWidthPixel() - (pPtAry[i].mnX - devX) + pOutDevRef->GetOutOffXPixel() - 1; 236*cdf0e10cSrcweir pPtAry2[j].mnY = pPtAry[i].mnY; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir pPtAry2[j].mnX = w-1-pPtAry[i].mnX; 246*cdf0e10cSrcweir pPtAry2[j].mnY = pPtAry[i].mnY; 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir return sal_True; 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir else 252*cdf0e10cSrcweir return sal_False; 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir void SalGraphics::mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack ) const 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if( rRgn.HasPolyPolygon() ) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir basegfx::B2DPolyPolygon aPolyPoly( rRgn.ConvertToB2DPolyPolygon() ); 260*cdf0e10cSrcweir aPolyPoly = mirror( aPolyPoly, pOutDev, bBack ); 261*cdf0e10cSrcweir rRgn = Region( aPolyPoly ); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir else 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir ImplRegionInfo aInfo; 266*cdf0e10cSrcweir bool bRegionRect; 267*cdf0e10cSrcweir Region aMirroredRegion; 268*cdf0e10cSrcweir long nX, nY, nWidth, nHeight; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir bRegionRect = rRgn.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); 271*cdf0e10cSrcweir while ( bRegionRect ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir Rectangle aRect( Point(nX, nY), Size(nWidth, nHeight) ); 274*cdf0e10cSrcweir mirror( aRect, pOutDev, bBack ); 275*cdf0e10cSrcweir aMirroredRegion.Union( aRect ); 276*cdf0e10cSrcweir bRegionRect = rRgn.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir rRgn = aMirroredRegion; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir void SalGraphics::mirror( Rectangle& rRect, const OutputDevice *pOutDev, bool bBack ) const 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir long nWidth = rRect.GetWidth(); 285*cdf0e10cSrcweir long x = rRect.Left(); 286*cdf0e10cSrcweir long x_org = x; 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir mirror( x, nWidth, pOutDev, bBack ); 289*cdf0e10cSrcweir rRect.Move( x - x_org, 0 ); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir basegfx::B2DPoint SalGraphics::mirror( const basegfx::B2DPoint& i_rPoint, const OutputDevice *i_pOutDev, bool i_bBack ) const 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir long w; 295*cdf0e10cSrcweir if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) 296*cdf0e10cSrcweir w = i_pOutDev->GetOutputWidthPixel(); 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir w = GetGraphicsWidth(); 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir DBG_ASSERT( w, "missing graphics width" ); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir basegfx::B2DPoint aRet( i_rPoint ); 303*cdf0e10cSrcweir if( w ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir if( i_pOutDev && !i_pOutDev->IsRTLEnabled() ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir OutputDevice *pOutDevRef = (OutputDevice*)i_pOutDev; 308*cdf0e10cSrcweir // mirror this window back 309*cdf0e10cSrcweir double devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX 310*cdf0e10cSrcweir if( i_bBack ) 311*cdf0e10cSrcweir aRet.setX( i_rPoint.getX() - devX + pOutDevRef->GetOutOffXPixel() ); 312*cdf0e10cSrcweir else 313*cdf0e10cSrcweir aRet.setX( devX + (i_rPoint.getX() - pOutDevRef->GetOutOffXPixel()) ); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir else 316*cdf0e10cSrcweir aRet.setX( w-1-i_rPoint.getX() ); 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir return aRet; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir basegfx::B2DPolygon SalGraphics::mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *i_pOutDev, bool i_bBack ) const 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir long w; 324*cdf0e10cSrcweir if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) 325*cdf0e10cSrcweir w = i_pOutDev->GetOutputWidthPixel(); 326*cdf0e10cSrcweir else 327*cdf0e10cSrcweir w = GetGraphicsWidth(); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir DBG_ASSERT( w, "missing graphics width" ); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir basegfx::B2DPolygon aRet; 332*cdf0e10cSrcweir if( w ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir sal_Int32 nPoints = i_rPoly.count(); 335*cdf0e10cSrcweir for( sal_Int32 i = 0; i < nPoints; i++ ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir aRet.append( mirror( i_rPoly.getB2DPoint( i ), i_pOutDev, i_bBack ) ); 338*cdf0e10cSrcweir if( i_rPoly.isPrevControlPointUsed( i ) ) 339*cdf0e10cSrcweir aRet.setPrevControlPoint( i, mirror( i_rPoly.getPrevControlPoint( i ), i_pOutDev, i_bBack ) ); 340*cdf0e10cSrcweir if( i_rPoly.isNextControlPointUsed( i ) ) 341*cdf0e10cSrcweir aRet.setNextControlPoint( i, mirror( i_rPoly.getNextControlPoint( i ), i_pOutDev, i_bBack ) ); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir aRet.setClosed( i_rPoly.isClosed() ); 344*cdf0e10cSrcweir aRet.flip(); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir else 347*cdf0e10cSrcweir aRet = i_rPoly; 348*cdf0e10cSrcweir return aRet; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *i_pOutDev, bool i_bBack ) const 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir long w; 354*cdf0e10cSrcweir if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) 355*cdf0e10cSrcweir w = i_pOutDev->GetOutputWidthPixel(); 356*cdf0e10cSrcweir else 357*cdf0e10cSrcweir w = GetGraphicsWidth(); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir DBG_ASSERT( w, "missing graphics width" ); 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir basegfx::B2DPolyPolygon aRet; 362*cdf0e10cSrcweir if( w ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir sal_Int32 nPoly = i_rPoly.count(); 365*cdf0e10cSrcweir for( sal_Int32 i = 0; i < nPoly; i++ ) 366*cdf0e10cSrcweir aRet.append( mirror( i_rPoly.getB2DPolygon( i ), i_pOutDev, i_bBack ) ); 367*cdf0e10cSrcweir aRet.setClosed( i_rPoly.isClosed() ); 368*cdf0e10cSrcweir aRet.flip(); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir else 371*cdf0e10cSrcweir aRet = i_rPoly; 372*cdf0e10cSrcweir return aRet; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir // ---------------------------------------------------------------------------- 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir bool SalGraphics::SetClipRegion( const Region& i_rClip, const OutputDevice *pOutDev ) 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir Region aMirror( i_rClip ); 382*cdf0e10cSrcweir mirror( aMirror, pOutDev ); 383*cdf0e10cSrcweir return setClipRegion( aMirror ); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir return setClipRegion( i_rClip ); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 391*cdf0e10cSrcweir mirror( nX, pOutDev ); 392*cdf0e10cSrcweir drawPixel( nX, nY ); 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 397*cdf0e10cSrcweir mirror( nX, pOutDev ); 398*cdf0e10cSrcweir drawPixel( nX, nY, nSalColor ); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ) 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir mirror( nX1, pOutDev ); 405*cdf0e10cSrcweir mirror( nX2, pOutDev ); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir drawLine( nX1, nY1, nX2, nY2 ); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 412*cdf0e10cSrcweir mirror( nX, nWidth, pOutDev ); 413*cdf0e10cSrcweir drawRect( nX, nY, nWidth, nHeight ); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir bool SalGraphics::drawPolyLine( 416*cdf0e10cSrcweir const basegfx::B2DPolygon& /*rPolyPolygon*/, 417*cdf0e10cSrcweir double /*fTransparency*/, 418*cdf0e10cSrcweir const basegfx::B2DVector& /*rLineWidths*/, 419*cdf0e10cSrcweir basegfx::B2DLineJoin /*eLineJoin*/) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir return false; 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir void SalGraphics::DrawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir SalPoint* pPtAry2 = new SalPoint[nPoints]; 429*cdf0e10cSrcweir sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); 430*cdf0e10cSrcweir drawPolyLine( nPoints, bCopied ? pPtAry2 : pPtAry ); 431*cdf0e10cSrcweir delete [] pPtAry2; 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir else 434*cdf0e10cSrcweir drawPolyLine( nPoints, pPtAry ); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir void SalGraphics::DrawPolygon( sal_uLong nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir SalPoint* pPtAry2 = new SalPoint[nPoints]; 442*cdf0e10cSrcweir sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); 443*cdf0e10cSrcweir drawPolygon( nPoints, bCopied ? pPtAry2 : pPtAry ); 444*cdf0e10cSrcweir delete [] pPtAry2; 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir else 447*cdf0e10cSrcweir drawPolygon( nPoints, pPtAry ); 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir // TODO: optimize, reduce new/delete calls 455*cdf0e10cSrcweir SalPoint **pPtAry2 = new SalPoint*[nPoly]; 456*cdf0e10cSrcweir sal_uLong i; 457*cdf0e10cSrcweir for(i=0; i<nPoly; i++) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir sal_uLong nPoints = pPoints[i]; 460*cdf0e10cSrcweir pPtAry2[i] = new SalPoint[ nPoints ]; 461*cdf0e10cSrcweir mirror( nPoints, pPtAry[i], pPtAry2[i], pOutDev ); 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir drawPolyPolygon( nPoly, pPoints, (PCONSTSALPOINT*)pPtAry2 ); 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir for(i=0; i<nPoly; i++) 467*cdf0e10cSrcweir delete [] pPtAry2[i]; 468*cdf0e10cSrcweir delete [] pPtAry2; 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir else 471*cdf0e10cSrcweir drawPolyPolygon( nPoly, pPoints, pPtAry ); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir bool SalGraphics::DrawPolyPolygon( const ::basegfx::B2DPolyPolygon& i_rPolyPolygon, double i_fTransparency, const OutputDevice* i_pOutDev ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir bool bRet = false; 477*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir basegfx::B2DPolyPolygon aMirror( mirror( i_rPolyPolygon, i_pOutDev ) ); 480*cdf0e10cSrcweir bRet = drawPolyPolygon( aMirror, i_fTransparency ); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir else 483*cdf0e10cSrcweir bRet = drawPolyPolygon( i_rPolyPolygon, i_fTransparency ); 484*cdf0e10cSrcweir return bRet; 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir bool SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir return false; 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir sal_Bool SalGraphics::DrawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev ) 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir sal_Bool bResult = sal_False; 495*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir SalPoint* pPtAry2 = new SalPoint[nPoints]; 498*cdf0e10cSrcweir sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); 499*cdf0e10cSrcweir bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry ); 500*cdf0e10cSrcweir delete [] pPtAry2; 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir else 503*cdf0e10cSrcweir bResult = drawPolyLineBezier( nPoints, pPtAry, pFlgAry ); 504*cdf0e10cSrcweir return bResult; 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir sal_Bool SalGraphics::DrawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev ) 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir sal_Bool bResult = sal_False; 510*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir SalPoint* pPtAry2 = new SalPoint[nPoints]; 513*cdf0e10cSrcweir sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); 514*cdf0e10cSrcweir bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry ); 515*cdf0e10cSrcweir delete [] pPtAry2; 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir else 518*cdf0e10cSrcweir bResult = drawPolygonBezier( nPoints, pPtAry, pFlgAry ); 519*cdf0e10cSrcweir return bResult; 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i_pPoints, 523*cdf0e10cSrcweir const SalPoint* const* i_pPtAry, const sal_uInt8* const* i_pFlgAry, const OutputDevice* i_pOutDev ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir sal_Bool bRet = sal_False; 526*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir // TODO: optimize, reduce new/delete calls 529*cdf0e10cSrcweir SalPoint **pPtAry2 = new SalPoint*[i_nPoly]; 530*cdf0e10cSrcweir sal_uLong i; 531*cdf0e10cSrcweir for(i=0; i<i_nPoly; i++) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir sal_uLong nPoints = i_pPoints[i]; 534*cdf0e10cSrcweir pPtAry2[i] = new SalPoint[ nPoints ]; 535*cdf0e10cSrcweir mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_pOutDev ); 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, (PCONSTSALPOINT*)pPtAry2, i_pFlgAry ); 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir for(i=0; i<i_nPoly; i++) 541*cdf0e10cSrcweir delete [] pPtAry2[i]; 542*cdf0e10cSrcweir delete [] pPtAry2; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir else 545*cdf0e10cSrcweir bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, i_pPtAry, i_pFlgAry ); 546*cdf0e10cSrcweir return bRet; 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double fTransparency, 550*cdf0e10cSrcweir const ::basegfx::B2DVector& i_rLineWidth, basegfx::B2DLineJoin i_eLineJoin, 551*cdf0e10cSrcweir const OutputDevice* i_pOutDev ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir bool bRet = false; 554*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); 557*cdf0e10cSrcweir bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin ); 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir else 560*cdf0e10cSrcweir bRet = drawPolyLine( i_rPolygon, fTransparency, i_rLineWidth, i_eLineJoin ); 561*cdf0e10cSrcweir return bRet; 562*cdf0e10cSrcweir } 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir void SalGraphics::CopyArea( long nDestX, long nDestY, 565*cdf0e10cSrcweir long nSrcX, long nSrcY, 566*cdf0e10cSrcweir long nSrcWidth, long nSrcHeight, 567*cdf0e10cSrcweir sal_uInt16 nFlags, const OutputDevice *pOutDev ) 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir mirror( nDestX, nSrcWidth, pOutDev ); 572*cdf0e10cSrcweir mirror( nSrcX, nSrcWidth, pOutDev ); 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, nFlags ); 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir void SalGraphics::CopyBits( const SalTwoRect* pPosAry, 577*cdf0e10cSrcweir SalGraphics* pSrcGraphics, const OutputDevice *pOutDev, const OutputDevice *pSrcOutDev ) 578*cdf0e10cSrcweir { 579*cdf0e10cSrcweir if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) || 580*cdf0e10cSrcweir (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) ) 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir SalTwoRect pPosAry2 = *pPosAry; 583*cdf0e10cSrcweir if( (pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL)) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) 584*cdf0e10cSrcweir mirror( pPosAry2.mnSrcX, pPosAry2.mnSrcWidth, pSrcOutDev ); 585*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 586*cdf0e10cSrcweir mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); 587*cdf0e10cSrcweir copyBits( &pPosAry2, pSrcGraphics ); 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir else 590*cdf0e10cSrcweir copyBits( pPosAry, pSrcGraphics ); 591*cdf0e10cSrcweir } 592*cdf0e10cSrcweir void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, 593*cdf0e10cSrcweir const SalBitmap& rSalBitmap, const OutputDevice *pOutDev ) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir SalTwoRect pPosAry2 = *pPosAry; 598*cdf0e10cSrcweir mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); 599*cdf0e10cSrcweir drawBitmap( &pPosAry2, rSalBitmap ); 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir else 602*cdf0e10cSrcweir drawBitmap( pPosAry, rSalBitmap ); 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, 605*cdf0e10cSrcweir const SalBitmap& rSalBitmap, 606*cdf0e10cSrcweir SalColor nTransparentColor, const OutputDevice *pOutDev ) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir SalTwoRect pPosAry2 = *pPosAry; 611*cdf0e10cSrcweir mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); 612*cdf0e10cSrcweir drawBitmap( &pPosAry2, rSalBitmap, nTransparentColor ); 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir else 615*cdf0e10cSrcweir drawBitmap( pPosAry, rSalBitmap, nTransparentColor ); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, 618*cdf0e10cSrcweir const SalBitmap& rSalBitmap, 619*cdf0e10cSrcweir const SalBitmap& rTransparentBitmap, const OutputDevice *pOutDev ) 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir SalTwoRect pPosAry2 = *pPosAry; 624*cdf0e10cSrcweir mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); 625*cdf0e10cSrcweir drawBitmap( &pPosAry2, rSalBitmap, rTransparentBitmap ); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir else 628*cdf0e10cSrcweir drawBitmap( pPosAry, rSalBitmap, rTransparentBitmap ); 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir void SalGraphics::DrawMask( const SalTwoRect* pPosAry, 631*cdf0e10cSrcweir const SalBitmap& rSalBitmap, 632*cdf0e10cSrcweir SalColor nMaskColor, const OutputDevice *pOutDev ) 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir SalTwoRect pPosAry2 = *pPosAry; 637*cdf0e10cSrcweir mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); 638*cdf0e10cSrcweir drawMask( &pPosAry2, rSalBitmap, nMaskColor ); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir else 641*cdf0e10cSrcweir drawMask( pPosAry, rSalBitmap, nMaskColor ); 642*cdf0e10cSrcweir } 643*cdf0e10cSrcweir SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 646*cdf0e10cSrcweir mirror( nX, nWidth, pOutDev ); 647*cdf0e10cSrcweir return getBitmap( nX, nY, nWidth, nHeight ); 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir SalColor SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 652*cdf0e10cSrcweir mirror( nX, pOutDev ); 653*cdf0e10cSrcweir return getPixel( nX, nY ); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice *pOutDev ) 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 658*cdf0e10cSrcweir mirror( nX, nWidth, pOutDev ); 659*cdf0e10cSrcweir invert( nX, nY, nWidth, nHeight, nFlags ); 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir void SalGraphics::Invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir SalPoint* pPtAry2 = new SalPoint[nPoints]; 666*cdf0e10cSrcweir sal_Bool bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); 667*cdf0e10cSrcweir invert( nPoints, bCopied ? pPtAry2 : pPtAry, nFlags ); 668*cdf0e10cSrcweir delete [] pPtAry2; 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir else 671*cdf0e10cSrcweir invert( nPoints, pPtAry, nFlags ); 672*cdf0e10cSrcweir } 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir sal_Bool SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize, const OutputDevice *pOutDev ) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 677*cdf0e10cSrcweir mirror( nX, nWidth, pOutDev ); 678*cdf0e10cSrcweir return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir sal_Bool SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, 682*cdf0e10cSrcweir const Point& aPos, sal_Bool& rIsInside, const OutputDevice *pOutDev ) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir Point pt( aPos ); 687*cdf0e10cSrcweir Rectangle rgn( rControlRegion ); 688*cdf0e10cSrcweir mirror( pt.X(), pOutDev ); 689*cdf0e10cSrcweir mirror( rgn, pOutDev ); 690*cdf0e10cSrcweir return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside ); 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir else 693*cdf0e10cSrcweir return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside ); 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir void SalGraphics::mirror( ControlType , const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir switch( rVal.getType() ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir case CTRL_SLIDER: 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir SliderValue* pSlVal = static_cast<SliderValue*>(const_cast<ImplControlValue*>(&rVal)); 703*cdf0e10cSrcweir mirror(pSlVal->maThumbRect,pOutDev,bBack); 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir break; 706*cdf0e10cSrcweir case CTRL_SCROLLBAR: 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir ScrollbarValue* pScVal = static_cast<ScrollbarValue*>(const_cast<ImplControlValue*>(&rVal)); 709*cdf0e10cSrcweir mirror(pScVal->maThumbRect,pOutDev,bBack); 710*cdf0e10cSrcweir mirror(pScVal->maButton1Rect,pOutDev,bBack); 711*cdf0e10cSrcweir mirror(pScVal->maButton2Rect,pOutDev,bBack); 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir break; 714*cdf0e10cSrcweir case CTRL_SPINBOX: 715*cdf0e10cSrcweir case CTRL_SPINBUTTONS: 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir SpinbuttonValue* pSpVal = static_cast<SpinbuttonValue*>(const_cast<ImplControlValue*>(&rVal)); 718*cdf0e10cSrcweir mirror(pSpVal->maUpperRect,pOutDev,bBack); 719*cdf0e10cSrcweir mirror(pSpVal->maLowerRect,pOutDev,bBack); 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir break; 722*cdf0e10cSrcweir case CTRL_TOOLBAR: 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir ToolbarValue* pTVal = static_cast<ToolbarValue*>(const_cast<ImplControlValue*>(&rVal)); 725*cdf0e10cSrcweir mirror(pTVal->maGripRect,pOutDev,bBack); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir break; 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir sal_Bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, 732*cdf0e10cSrcweir ControlState nState, const ImplControlValue& aValue, 733*cdf0e10cSrcweir const OUString& aCaption, const OutputDevice *pOutDev ) 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 736*cdf0e10cSrcweir { 737*cdf0e10cSrcweir Rectangle rgn( rControlRegion ); 738*cdf0e10cSrcweir mirror( rgn, pOutDev ); 739*cdf0e10cSrcweir mirror( nType, aValue, pOutDev ); 740*cdf0e10cSrcweir sal_Bool bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); 741*cdf0e10cSrcweir mirror( nType, aValue, pOutDev, true ); 742*cdf0e10cSrcweir return bRet; 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir else 745*cdf0e10cSrcweir return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption ); 746*cdf0e10cSrcweir } 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir sal_Bool SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, 749*cdf0e10cSrcweir ControlState nState, const ImplControlValue& aValue, 750*cdf0e10cSrcweir const OUString& aCaption, const OutputDevice *pOutDev ) 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir Rectangle rgn( rControlRegion ); 755*cdf0e10cSrcweir mirror( rgn, pOutDev ); 756*cdf0e10cSrcweir mirror( nType, aValue, pOutDev ); 757*cdf0e10cSrcweir sal_Bool bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); 758*cdf0e10cSrcweir mirror( nType, aValue, pOutDev, true ); 759*cdf0e10cSrcweir return bRet; 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir else 762*cdf0e10cSrcweir return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption ); 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir sal_Bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, 766*cdf0e10cSrcweir const ImplControlValue& aValue, const OUString& aCaption, 767*cdf0e10cSrcweir Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion, const OutputDevice *pOutDev ) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 770*cdf0e10cSrcweir { 771*cdf0e10cSrcweir Rectangle rgn( rControlRegion ); 772*cdf0e10cSrcweir mirror( rgn, pOutDev ); 773*cdf0e10cSrcweir mirror( nType, aValue, pOutDev ); 774*cdf0e10cSrcweir if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption, 775*cdf0e10cSrcweir rNativeBoundingRegion, rNativeContentRegion ) ) 776*cdf0e10cSrcweir { 777*cdf0e10cSrcweir mirror( rNativeBoundingRegion, pOutDev, true ); 778*cdf0e10cSrcweir mirror( rNativeContentRegion, pOutDev, true ); 779*cdf0e10cSrcweir mirror( nType, aValue, pOutDev, true ); 780*cdf0e10cSrcweir return sal_True; 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir else 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir mirror( nType, aValue, pOutDev, true ); 785*cdf0e10cSrcweir return sal_False; 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir } 788*cdf0e10cSrcweir else 789*cdf0e10cSrcweir return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption, 790*cdf0e10cSrcweir rNativeBoundingRegion, rNativeContentRegion ); 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, 794*cdf0e10cSrcweir const SalBitmap& rSourceBitmap, 795*cdf0e10cSrcweir const SalBitmap& rAlphaBitmap, 796*cdf0e10cSrcweir const OutputDevice *pOutDev ) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 799*cdf0e10cSrcweir { 800*cdf0e10cSrcweir SalTwoRect pPosAry2 = rPosAry; 801*cdf0e10cSrcweir mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); 802*cdf0e10cSrcweir return drawAlphaBitmap( pPosAry2, rSourceBitmap, rAlphaBitmap ); 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir else 805*cdf0e10cSrcweir return drawAlphaBitmap( rPosAry, rSourceBitmap, rAlphaBitmap ); 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir bool SalGraphics::DrawAlphaRect( long nX, long nY, long nWidth, long nHeight, 809*cdf0e10cSrcweir sal_uInt8 nTransparency, const OutputDevice *pOutDev ) 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) 812*cdf0e10cSrcweir mirror( nX, nWidth, pOutDev ); 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency ); 815*cdf0e10cSrcweir } 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir bool SalGraphics::filterText( const String&, String&, xub_StrLen, xub_StrLen&, xub_StrLen&, xub_StrLen& ) 818*cdf0e10cSrcweir { 819*cdf0e10cSrcweir return false; 820*cdf0e10cSrcweir } 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir void SalGraphics::AddDevFontSubstitute( OutputDevice* pOutDev, 823*cdf0e10cSrcweir const String& rFontName, 824*cdf0e10cSrcweir const String& rReplaceFontName, 825*cdf0e10cSrcweir sal_uInt16 nFlags ) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir pOutDev->ImplAddDevFontSubstitute( rFontName, rReplaceFontName, nFlags ); 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir 830