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