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