LibreOffice Module vcl (master)  1
map.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <tools/bigint.hxx>
21 #include <tools/debug.hxx>
22 #include <vcl/cursor.hxx>
23 #include <vcl/gdimtf.hxx>
24 #include <vcl/lineinfo.hxx>
25 #include <vcl/metaact.hxx>
26 #include <vcl/virdev.hxx>
27 #include <vcl/wrkwin.hxx>
28 #include <sal/log.hxx>
29 #include <osl/diagnose.h>
30 
31 #include <svdata.hxx>
32 #include <window.h>
33 #include <outdev.h>
34 
36 #include <o3tl/enumarray.hxx>
37 
38 // we don't actually handle units beyond, hence the zeros in the arrays
39 const MapUnit s_MaxValidUnit = MapUnit::MapPixel;
41  { 1, 1, 5, 50, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 };
43  { 2540, 254, 127, 127, 1000, 100, 10, 1, 72, 1440, 1, 0, 0, 0 };
44 
45 /*
46 Reduces accuracy until it is a fraction (should become
47 ctor fraction once); we could also do this with BigInts
48 */
49 
51 {
52  if( nD1 == 0 || nD2 == 0 ) //under these bad circumstances the following while loop will be endless
53  {
54  SAL_WARN("vcl.gdi", "Invalid parameter for ImplMakeFraction");
55  return Fraction( 1, 1 );
56  }
57 
58  tools::Long i = 1;
59 
60  if ( nN1 < 0 ) { i = -i; nN1 = -nN1; }
61  if ( nN2 < 0 ) { i = -i; nN2 = -nN2; }
62  if ( nD1 < 0 ) { i = -i; nD1 = -nD1; }
63  if ( nD2 < 0 ) { i = -i; nD2 = -nD2; }
64  // all positive; i sign
65 
66  Fraction aF = Fraction( i*nN1, nD1 ) * Fraction( nN2, nD2 );
67 
68  while ( !aF.IsValid() ) {
69  if ( nN1 > nN2 )
70  nN1 = (nN1 + 1) / 2;
71  else
72  nN2 = (nN2 + 1) / 2;
73  if ( nD1 > nD2 )
74  nD1 = (nD1 + 1) / 2;
75  else
76  nD2 = (nD2 + 1) / 2;
77 
78  aF = Fraction( i*nN1, nD1 ) * Fraction( nN2, nD2 );
79  }
80 
81  aF.ReduceInaccurate(32);
82  return aF;
83 }
84 
85 static void ImplCalcMapResolution( const MapMode& rMapMode,
86  tools::Long nDPIX, tools::Long nDPIY, ImplMapRes& rMapRes )
87 {
88  switch ( rMapMode.GetMapUnit() )
89  {
90  case MapUnit::MapRelative:
91  break;
92  case MapUnit::Map100thMM:
93  rMapRes.mnMapScNumX = 1;
94  rMapRes.mnMapScDenomX = 2540;
95  rMapRes.mnMapScNumY = 1;
96  rMapRes.mnMapScDenomY = 2540;
97  break;
98  case MapUnit::Map10thMM:
99  rMapRes.mnMapScNumX = 1;
100  rMapRes.mnMapScDenomX = 254;
101  rMapRes.mnMapScNumY = 1;
102  rMapRes.mnMapScDenomY = 254;
103  break;
104  case MapUnit::MapMM:
105  rMapRes.mnMapScNumX = 5; // 10
106  rMapRes.mnMapScDenomX = 127; // 254
107  rMapRes.mnMapScNumY = 5; // 10
108  rMapRes.mnMapScDenomY = 127; // 254
109  break;
110  case MapUnit::MapCM:
111  rMapRes.mnMapScNumX = 50; // 100
112  rMapRes.mnMapScDenomX = 127; // 254
113  rMapRes.mnMapScNumY = 50; // 100
114  rMapRes.mnMapScDenomY = 127; // 254
115  break;
116  case MapUnit::Map1000thInch:
117  rMapRes.mnMapScNumX = 1;
118  rMapRes.mnMapScDenomX = 1000;
119  rMapRes.mnMapScNumY = 1;
120  rMapRes.mnMapScDenomY = 1000;
121  break;
122  case MapUnit::Map100thInch:
123  rMapRes.mnMapScNumX = 1;
124  rMapRes.mnMapScDenomX = 100;
125  rMapRes.mnMapScNumY = 1;
126  rMapRes.mnMapScDenomY = 100;
127  break;
128  case MapUnit::Map10thInch:
129  rMapRes.mnMapScNumX = 1;
130  rMapRes.mnMapScDenomX = 10;
131  rMapRes.mnMapScNumY = 1;
132  rMapRes.mnMapScDenomY = 10;
133  break;
134  case MapUnit::MapInch:
135  rMapRes.mnMapScNumX = 1;
136  rMapRes.mnMapScDenomX = 1;
137  rMapRes.mnMapScNumY = 1;
138  rMapRes.mnMapScDenomY = 1;
139  break;
140  case MapUnit::MapPoint:
141  rMapRes.mnMapScNumX = 1;
142  rMapRes.mnMapScDenomX = 72;
143  rMapRes.mnMapScNumY = 1;
144  rMapRes.mnMapScDenomY = 72;
145  break;
146  case MapUnit::MapTwip:
147  rMapRes.mnMapScNumX = 1;
148  rMapRes.mnMapScDenomX = 1440;
149  rMapRes.mnMapScNumY = 1;
150  rMapRes.mnMapScDenomY = 1440;
151  break;
152  case MapUnit::MapPixel:
153  rMapRes.mnMapScNumX = 1;
154  rMapRes.mnMapScDenomX = nDPIX;
155  rMapRes.mnMapScNumY = 1;
156  rMapRes.mnMapScDenomY = nDPIY;
157  break;
158  case MapUnit::MapSysFont:
159  case MapUnit::MapAppFont:
160  {
161  ImplSVData* pSVData = ImplGetSVData();
162  if ( !pSVData->maGDIData.mnAppFontX )
163  {
164  if (pSVData->maFrameData.mpFirstFrame)
166  else
167  {
168  ScopedVclPtrInstance<WorkWindow> pWin( nullptr, 0 );
170  }
171  }
172  rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
173  rMapRes.mnMapScDenomX = nDPIX * 40;
174  rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY;
175  rMapRes.mnMapScDenomY = nDPIY * 80;
176  }
177  break;
178  default:
179  OSL_FAIL( "unhandled MapUnit" );
180  break;
181  }
182 
183  const Fraction& aScaleX = rMapMode.GetScaleX();
184  const Fraction& aScaleY = rMapMode.GetScaleY();
185 
186  // set offset according to MapMode
187  Point aOrigin = rMapMode.GetOrigin();
188  if ( rMapMode.GetMapUnit() != MapUnit::MapRelative )
189  {
190  rMapRes.mnMapOfsX = aOrigin.X();
191  rMapRes.mnMapOfsY = aOrigin.Y();
192  }
193  else
194  {
195  auto nXNumerator = aScaleX.GetNumerator();
196  auto nYNumerator = aScaleY.GetNumerator();
197  assert(nXNumerator != 0 && nYNumerator != 0);
198 
199  BigInt aX( rMapRes.mnMapOfsX );
200  aX *= BigInt( aScaleX.GetDenominator() );
201  if ( rMapRes.mnMapOfsX >= 0 )
202  {
203  if (nXNumerator >= 0)
204  aX += BigInt(nXNumerator / 2);
205  else
206  aX -= BigInt((nXNumerator + 1) / 2);
207  }
208  else
209  {
210  if (nXNumerator >= 0 )
211  aX -= BigInt((nXNumerator - 1) / 2);
212  else
213  aX += BigInt(nXNumerator / 2);
214  }
215  aX /= BigInt(nXNumerator);
216  rMapRes.mnMapOfsX = static_cast<tools::Long>(aX) + aOrigin.X();
217  BigInt aY( rMapRes.mnMapOfsY );
218  aY *= BigInt( aScaleY.GetDenominator() );
219  if( rMapRes.mnMapOfsY >= 0 )
220  {
221  if (nYNumerator >= 0)
222  aY += BigInt(nYNumerator / 2);
223  else
224  aY -= BigInt((nYNumerator + 1) / 2);
225  }
226  else
227  {
228  if (nYNumerator >= 0)
229  aY -= BigInt((nYNumerator - 1) / 2);
230  else
231  aY += BigInt(nYNumerator / 2);
232  }
233  aY /= BigInt(nYNumerator);
234  rMapRes.mnMapOfsY = static_cast<tools::Long>(aY) + aOrigin.Y();
235  }
236 
237  // calculate scaling factor according to MapMode
238  // aTemp? = rMapRes.mnMapSc? * aScale?
239  Fraction aTempX = ImplMakeFraction( rMapRes.mnMapScNumX,
240  aScaleX.GetNumerator(),
241  rMapRes.mnMapScDenomX,
242  aScaleX.GetDenominator() );
243  Fraction aTempY = ImplMakeFraction( rMapRes.mnMapScNumY,
244  aScaleY.GetNumerator(),
245  rMapRes.mnMapScDenomY,
246  aScaleY.GetDenominator() );
247  rMapRes.mnMapScNumX = aTempX.GetNumerator();
248  rMapRes.mnMapScDenomX = aTempX.GetDenominator();
249  rMapRes.mnMapScNumY = aTempY.GetNumerator();
250  rMapRes.mnMapScDenomY = aTempY.GetDenominator();
251 }
252 
253 // #i75163#
255 {
256  if(!mpOutDevData)
257  return;
258 
259  if(mpOutDevData->mpViewTransform)
260  {
261  delete mpOutDevData->mpViewTransform;
262  mpOutDevData->mpViewTransform = nullptr;
263  }
264 
265  if(mpOutDevData->mpInverseViewTransform)
266  {
267  delete mpOutDevData->mpInverseViewTransform;
268  mpOutDevData->mpInverseViewTransform = nullptr;
269  }
270 }
271 
273  tools::Long nMapDenom)
274 {
275  assert(nDPI > 0);
276  assert(nMapDenom != 0);
277  if constexpr (sizeof(tools::Long) >= 8)
278  {
279  assert(nMapNum >= 0);
280  //detect overflows
281  assert(nMapNum == 0
282  || std::abs(n) < std::numeric_limits<tools::Long>::max() / nMapNum / nDPI);
283  }
284  sal_Int64 n64 = n;
285  n64 *= nMapNum;
286  n64 *= nDPI;
287  if (nMapDenom == 1)
288  n = static_cast<tools::Long>(n64);
289  else
290  {
291  n64 = 2 * n64 / nMapDenom;
292  if (n64 < 0)
293  --n64;
294  else
295  ++n64;
296  n = static_cast<tools::Long>(n64 / 2);
297  }
298  return n;
299 }
300 
302  tools::Long nMapDenom)
303 {
304  assert(nDPI > 0);
305  if (nMapNum == 0)
306  return 0;
307  sal_Int64 nDenom = nDPI;
308  nDenom *= nMapNum;
309 
310  sal_Int64 n64 = n;
311  n64 *= nMapDenom;
312  if (nDenom == 1)
313  n = static_cast<tools::Long>(n64);
314  else
315  {
316  n64 = 2 * n64 / nDenom;
317  if (n64 < 0)
318  --n64;
319  else
320  ++n64;
321  n = static_cast<tools::Long>(n64 / 2);
322  }
323  return n;
324 }
325 
327 {
328  if ( !mbMap )
329  return nX+mnOutOffX;
330 
333 }
334 
336 {
337  if ( !mbMap )
338  return nY+mnOutOffY;
339 
342 }
343 
345 {
346  if ( !mbMap )
347  return nWidth;
348 
350 }
351 
353 {
354  if ( !mbMap )
355  return nHeight;
356 
358 }
359 
360 float OutputDevice::ImplFloatLogicHeightToDevicePixel( float fLogicHeight) const
361 {
362  if( !mbMap)
363  return fLogicHeight;
364  float fPixelHeight = (fLogicHeight * mnDPIY * maMapRes.mnMapScNumY) / maMapRes.mnMapScDenomY;
365  return fPixelHeight;
366 }
367 
369 {
370  if ( !mbMap )
371  return nWidth;
372 
374 }
375 
377 {
378  if ( !mbMap )
379  return nHeight;
380 
382 }
383 
384 Point OutputDevice::ImplLogicToDevicePixel( const Point& rLogicPt ) const
385 {
386  if ( !mbMap )
387  return Point( rLogicPt.X()+mnOutOffX, rLogicPt.Y()+mnOutOffY );
388 
389  return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
391  ImplLogicToPixel( rLogicPt.Y() + maMapRes.mnMapOfsY, mnDPIY,
393 }
394 
396 {
397  if ( !mbMap )
398  return rLogicSize;
399 
400  return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
402  ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
404 }
405 
407 {
408  if ( rLogicRect.IsEmpty() )
409  return rLogicRect;
410 
411  if ( !mbMap )
412  {
413  return tools::Rectangle( rLogicRect.Left()+mnOutOffX, rLogicRect.Top()+mnOutOffY,
414  rLogicRect.Right()+mnOutOffX, rLogicRect.Bottom()+mnOutOffY );
415  }
416 
425 }
426 
428 {
429  if ( !mbMap && !mnOutOffX && !mnOutOffY )
430  return rLogicPoly;
431 
432  sal_uInt16 i;
433  sal_uInt16 nPoints = rLogicPoly.GetSize();
434  tools::Polygon aPoly( rLogicPoly );
435 
436  // get pointer to Point-array (copy data)
437  const Point* pPointAry = aPoly.GetConstPointAry();
438 
439  if ( mbMap )
440  {
441  for ( i = 0; i < nPoints; i++ )
442  {
443  const Point& rPt = pPointAry[i];
448  aPoly[i] = aPt;
449  }
450  }
451  else
452  {
453  for ( i = 0; i < nPoints; i++ )
454  {
455  Point aPt = pPointAry[i];
456  aPt.AdjustX(mnOutOffX );
457  aPt.AdjustY(mnOutOffY );
458  aPoly[i] = aPt;
459  }
460  }
461 
462  return aPoly;
463 }
464 
466 {
467  if ( !mbMap && !mnOutOffX && !mnOutOffY )
468  return rLogicPolyPoly;
469 
470  tools::PolyPolygon aPolyPoly( rLogicPolyPoly );
471  sal_uInt16 nPoly = aPolyPoly.Count();
472  for( sal_uInt16 i = 0; i < nPoly; i++ )
473  {
474  tools::Polygon& rPoly = aPolyPoly[i];
475  rPoly = ImplLogicToDevicePixel( rPoly );
476  }
477  return aPolyPoly;
478 }
479 
481 {
482  LineInfo aInfo( rLineInfo );
483 
484  if( aInfo.GetStyle() == LineStyle::Dash )
485  {
486  if( aInfo.GetDotCount() && aInfo.GetDotLen() )
487  aInfo.SetDotLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), tools::Long(1) ) );
488  else
489  aInfo.SetDotCount( 0 );
490 
491  if( aInfo.GetDashCount() && aInfo.GetDashLen() )
492  aInfo.SetDashLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), tools::Long(1) ) );
493  else
494  aInfo.SetDashCount( 0 );
495 
496  aInfo.SetDistance( ImplLogicWidthToDevicePixel( aInfo.GetDistance() ) );
497 
498  if( ( !aInfo.GetDashCount() && !aInfo.GetDotCount() ) || !aInfo.GetDistance() )
499  aInfo.SetStyle( LineStyle::Solid );
500  }
501 
502  aInfo.SetWidth( ImplLogicWidthToDevicePixel( aInfo.GetWidth() ) );
503 
504  return aInfo;
505 }
506 
508 {
509  if ( rPixelRect.IsEmpty() )
510  return rPixelRect;
511 
512  if ( !mbMap )
513  {
514  return tools::Rectangle( rPixelRect.Left()-mnOutOffX, rPixelRect.Top()-mnOutOffY,
515  rPixelRect.Right()-mnOutOffX, rPixelRect.Bottom()-mnOutOffY );
516  }
517 
526 }
527 
529 {
530  if ( !mnOutOffX && !mnOutOffY )
531  return rRegion;
532 
533  vcl::Region aRegion( rRegion );
535  return aRegion;
536 }
537 
538 void OutputDevice::EnableMapMode( bool bEnable )
539 {
540  mbMap = bEnable;
541 
542  if( mpAlphaVDev )
543  mpAlphaVDev->EnableMapMode( bEnable );
544 }
545 
547 {
548 
549  if ( mpMetaFile )
550  mpMetaFile->AddAction( new MetaMapModeAction( MapMode() ) );
551 
552  if ( mbMap || !maMapMode.IsDefault() )
553  {
554  mbMap = false;
555  maMapMode = MapMode();
556 
557  // create new objects (clip region are not re-scaled)
558  mbNewFont = true;
559  mbInitFont = true;
561 
562  // #106426# Adapt logical offset when changing mapmode
563  mnOutOffLogicX = mnOutOffOrigX; // no mapping -> equal offsets
565 
566  // #i75163#
568  }
569 
570  if( mpAlphaVDev )
572 }
573 
574 void OutputDevice::SetMapMode( const MapMode& rNewMapMode )
575 {
576 
577  bool bRelMap = (rNewMapMode.GetMapUnit() == MapUnit::MapRelative);
578 
579  if ( mpMetaFile )
580  {
581  mpMetaFile->AddAction( new MetaMapModeAction( rNewMapMode ) );
582  }
583 
584  // do nothing if MapMode was not changed
585  if ( maMapMode == rNewMapMode )
586  return;
587 
588  if( mpAlphaVDev )
589  mpAlphaVDev->SetMapMode( rNewMapMode );
590 
591  // if default MapMode calculate nothing
592  bool bOldMap = mbMap;
593  mbMap = !rNewMapMode.IsDefault();
594  if ( mbMap )
595  {
596  // if only the origin is converted, do not scale new
597  if ( (rNewMapMode.GetMapUnit() == maMapMode.GetMapUnit()) &&
598  (rNewMapMode.GetScaleX() == maMapMode.GetScaleX()) &&
599  (rNewMapMode.GetScaleY() == maMapMode.GetScaleY()) &&
600  (bOldMap == mbMap) )
601  {
602  // set offset
603  Point aOrigin = rNewMapMode.GetOrigin();
604  maMapRes.mnMapOfsX = aOrigin.X();
605  maMapRes.mnMapOfsY = aOrigin.Y();
606  maMapMode = rNewMapMode;
607 
608  // #i75163#
610 
611  return;
612  }
613  if ( !bOldMap && bRelMap )
614  {
615  maMapRes.mnMapScNumX = 1;
616  maMapRes.mnMapScNumY = 1;
619  maMapRes.mnMapOfsX = 0;
620  maMapRes.mnMapOfsY = 0;
621  }
622 
623  // calculate new MapMode-resolution
625  }
626 
627  // set new MapMode
628  if ( bRelMap )
629  {
631  // aScale? = maMapMode.GetScale?() * rNewMapMode.GetScale?()
633  rNewMapMode.GetScaleX().GetNumerator(),
635  rNewMapMode.GetScaleX().GetDenominator() );
637  rNewMapMode.GetScaleY().GetNumerator(),
639  rNewMapMode.GetScaleY().GetDenominator() );
640  maMapMode.SetOrigin( aOrigin );
641  maMapMode.SetScaleX( aScaleX );
642  maMapMode.SetScaleY( aScaleY );
643  }
644  else
645  maMapMode = rNewMapMode;
646 
647  // create new objects (clip region are not re-scaled)
648  mbNewFont = true;
649  mbInitFont = true;
651 
652  // #106426# Adapt logical offset when changing mapmode
657 
658  // #i75163#
660 }
661 
662 void OutputDevice::SetMetafileMapMode(const MapMode& rNewMapMode, bool bIsRecord)
663 {
664  if (bIsRecord)
665  SetRelativeMapMode(rNewMapMode);
666  else
667  SetMapMode(rNewMapMode);
668 }
669 
671 
672 void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode )
673 {
674  // do nothing if MapMode did not change
675  if ( maMapMode == rNewMapMode )
676  return;
677 
678  MapUnit eOld = maMapMode.GetMapUnit();
679  MapUnit eNew = rNewMapMode.GetMapUnit();
680 
681  // a?F = rNewMapMode.GetScale?() / maMapMode.GetScale?()
682  Fraction aXF = ImplMakeFraction( rNewMapMode.GetScaleX().GetNumerator(),
684  rNewMapMode.GetScaleX().GetDenominator(),
686  Fraction aYF = ImplMakeFraction( rNewMapMode.GetScaleY().GetNumerator(),
688  rNewMapMode.GetScaleY().GetDenominator(),
690 
691  Point aPt( LogicToLogic( Point(), nullptr, &rNewMapMode ) );
692  if ( eNew != eOld )
693  {
694  if ( eOld > MapUnit::MapPixel )
695  {
696  SAL_WARN( "vcl.gdi", "Not implemented MapUnit" );
697  }
698  else if ( eNew > MapUnit::MapPixel )
699  {
700  SAL_WARN( "vcl.gdi", "Not implemented MapUnit" );
701  }
702  else
703  {
704  Fraction aF( aImplNumeratorAry[eNew] * aImplDenominatorAry[eOld],
705  aImplNumeratorAry[eOld] * aImplDenominatorAry[eNew] );
706 
707  // a?F = a?F * aF
708  aXF = ImplMakeFraction( aXF.GetNumerator(), aF.GetNumerator(),
709  aXF.GetDenominator(), aF.GetDenominator() );
710  aYF = ImplMakeFraction( aYF.GetNumerator(), aF.GetNumerator(),
711  aYF.GetDenominator(), aF.GetDenominator() );
712  if ( eOld == MapUnit::MapPixel )
713  {
714  aXF *= Fraction( mnDPIX, 1 );
715  aYF *= Fraction( mnDPIY, 1 );
716  }
717  else if ( eNew == MapUnit::MapPixel )
718  {
719  aXF *= Fraction( 1, mnDPIX );
720  aYF *= Fraction( 1, mnDPIY );
721  }
722  }
723  }
724 
725  MapMode aNewMapMode( MapUnit::MapRelative, Point( -aPt.X(), -aPt.Y() ), aXF, aYF );
726  SetMapMode( aNewMapMode );
727 
728  if ( eNew != eOld )
729  maMapMode = rNewMapMode;
730 
731  // #106426# Adapt logical offset when changing MapMode
736 
737  if( mpAlphaVDev )
738  mpAlphaVDev->SetRelativeMapMode( rNewMapMode );
739 }
740 
741 // #i75163#
743 {
744  if(mbMap && mpOutDevData)
745  {
746  if(!mpOutDevData->mpViewTransform)
747  {
748  mpOutDevData->mpViewTransform = new basegfx::B2DHomMatrix;
749 
750  const double fScaleFactorX(static_cast<double>(mnDPIX) * static_cast<double>(maMapRes.mnMapScNumX) / static_cast<double>(maMapRes.mnMapScDenomX));
751  const double fScaleFactorY(static_cast<double>(mnDPIY) * static_cast<double>(maMapRes.mnMapScNumY) / static_cast<double>(maMapRes.mnMapScDenomY));
752  const double fZeroPointX((static_cast<double>(maMapRes.mnMapOfsX) * fScaleFactorX) + static_cast<double>(mnOutOffOrigX));
753  const double fZeroPointY((static_cast<double>(maMapRes.mnMapOfsY) * fScaleFactorY) + static_cast<double>(mnOutOffOrigY));
754 
755  mpOutDevData->mpViewTransform->set(0, 0, fScaleFactorX);
756  mpOutDevData->mpViewTransform->set(1, 1, fScaleFactorY);
757  mpOutDevData->mpViewTransform->set(0, 2, fZeroPointX);
758  mpOutDevData->mpViewTransform->set(1, 2, fZeroPointY);
759  }
760 
761  return *mpOutDevData->mpViewTransform;
762  }
763  else
764  {
765  return basegfx::B2DHomMatrix();
766  }
767 }
768 
769 // #i75163#
771 {
772  if(mbMap && mpOutDevData)
773  {
774  if(!mpOutDevData->mpInverseViewTransform)
775  {
777  mpOutDevData->mpInverseViewTransform = new basegfx::B2DHomMatrix(*mpOutDevData->mpViewTransform);
778  mpOutDevData->mpInverseViewTransform->invert();
779  }
780 
781  return *mpOutDevData->mpInverseViewTransform;
782  }
783  else
784  {
785  return basegfx::B2DHomMatrix();
786  }
787 }
788 
789 // #i75163#
791 {
792  // #i82615#
793  ImplMapRes aMapRes;
794  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
795 
796  basegfx::B2DHomMatrix aTransform;
797 
798  const double fScaleFactorX(static_cast<double>(mnDPIX) * static_cast<double>(aMapRes.mnMapScNumX) / static_cast<double>(aMapRes.mnMapScDenomX));
799  const double fScaleFactorY(static_cast<double>(mnDPIY) * static_cast<double>(aMapRes.mnMapScNumY) / static_cast<double>(aMapRes.mnMapScDenomY));
800  const double fZeroPointX((static_cast<double>(aMapRes.mnMapOfsX) * fScaleFactorX) + static_cast<double>(mnOutOffOrigX));
801  const double fZeroPointY((static_cast<double>(aMapRes.mnMapOfsY) * fScaleFactorY) + static_cast<double>(mnOutOffOrigY));
802 
803  aTransform.set(0, 0, fScaleFactorX);
804  aTransform.set(1, 1, fScaleFactorY);
805  aTransform.set(0, 2, fZeroPointX);
806  aTransform.set(1, 2, fZeroPointY);
807 
808  return aTransform;
809 }
810 
811 // #i75163#
813 {
814  basegfx::B2DHomMatrix aMatrix( GetViewTransformation( rMapMode ) );
815  aMatrix.invert();
816  return aMatrix;
817 }
818 
820 {
821  basegfx::B2DHomMatrix aTransformation = GetViewTransformation();
822  // TODO: is it worth to cache the transformed result?
823  if( mnOutOffX || mnOutOffY )
824  aTransformation.translate( mnOutOffX, mnOutOffY );
825  return aTransformation;
826 }
827 
828 Point OutputDevice::LogicToPixel( const Point& rLogicPt ) const
829 {
830 
831  if ( !mbMap )
832  return rLogicPt;
833 
834  return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
836  ImplLogicToPixel( rLogicPt.Y() + maMapRes.mnMapOfsY, mnDPIY,
838 }
839 
840 Size OutputDevice::LogicToPixel( const Size& rLogicSize ) const
841 {
842 
843  if ( !mbMap )
844  return rLogicSize;
845 
846  return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
848  ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
850 }
851 
853 {
854 
855  if ( !mbMap || rLogicRect.IsEmpty() )
856  return rLogicRect;
857 
860  ImplLogicToPixel( rLogicRect.Top() + maMapRes.mnMapOfsY, mnDPIY,
866 }
867 
869 {
870 
871  if ( !mbMap )
872  return rLogicPoly;
873 
874  sal_uInt16 i;
875  sal_uInt16 nPoints = rLogicPoly.GetSize();
876  tools::Polygon aPoly( rLogicPoly );
877 
878  // get pointer to Point-array (copy data)
879  const Point* pPointAry = aPoly.GetConstPointAry();
880 
881  for ( i = 0; i < nPoints; i++ )
882  {
883  const Point* pPt = &(pPointAry[i]);
884  Point aPt;
885  aPt.setX( ImplLogicToPixel( pPt->X() + maMapRes.mnMapOfsX, mnDPIX,
887  aPt.setY( ImplLogicToPixel( pPt->Y() + maMapRes.mnMapOfsY, mnDPIY,
889  aPoly[i] = aPt;
890  }
891 
892  return aPoly;
893 }
894 
896 {
897 
898  if ( !mbMap )
899  return rLogicPolyPoly;
900 
901  tools::PolyPolygon aPolyPoly( rLogicPolyPoly );
902  sal_uInt16 nPoly = aPolyPoly.Count();
903  for( sal_uInt16 i = 0; i < nPoly; i++ )
904  {
905  tools::Polygon& rPoly = aPolyPoly[i];
906  rPoly = LogicToPixel( rPoly );
907  }
908  return aPolyPoly;
909 }
910 
912 {
913  basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly;
914  const basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation();
915  aTransformedPoly.transform( rTransformationMatrix );
916  return aTransformedPoly;
917 }
918 
920 {
921 
922  if(!mbMap || rLogicRegion.IsNull() || rLogicRegion.IsEmpty())
923  {
924  return rLogicRegion;
925  }
926 
927  vcl::Region aRegion;
928 
929  if(rLogicRegion.getB2DPolyPolygon())
930  {
931  aRegion = vcl::Region(LogicToPixel(*rLogicRegion.getB2DPolyPolygon()));
932  }
933  else if(rLogicRegion.getPolyPolygon())
934  {
935  aRegion = vcl::Region(LogicToPixel(*rLogicRegion.getPolyPolygon()));
936  }
937  else if(rLogicRegion.getRegionBand())
938  {
939  RectangleVector aRectangles;
940  rLogicRegion.GetRegionRectangles(aRectangles);
941  const RectangleVector& rRectangles(aRectangles); // needed to make the '!=' work
942 
943  // make reverse run to fill new region bottom-up, this will speed it up due to the used data structuring
944  for(RectangleVector::const_reverse_iterator aRectIter(rRectangles.rbegin()); aRectIter != rRectangles.rend(); ++aRectIter)
945  {
946  aRegion.Union(LogicToPixel(*aRectIter));
947  }
948  }
949 
950  return aRegion;
951 }
952 
953 Point OutputDevice::LogicToPixel( const Point& rLogicPt,
954  const MapMode& rMapMode ) const
955 {
956 
957  if ( rMapMode.IsDefault() )
958  return rLogicPt;
959 
960  // convert MapMode resolution and convert
961  ImplMapRes aMapRes;
962  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
963 
964  return Point( ImplLogicToPixel( rLogicPt.X() + aMapRes.mnMapOfsX, mnDPIX,
965  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX,
966  ImplLogicToPixel( rLogicPt.Y() + aMapRes.mnMapOfsY, mnDPIY,
967  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY );
968 }
969 
971  const MapMode& rMapMode ) const
972 {
973 
974  if ( rMapMode.IsDefault() )
975  return rLogicSize;
976 
977  // convert MapMode resolution and convert
978  ImplMapRes aMapRes;
979  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
980 
981  return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
982  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ),
983  ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
984  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) );
985 }
986 
988  const MapMode& rMapMode ) const
989 {
990 
991  if ( rMapMode.IsDefault() || rLogicRect.IsEmpty() )
992  return rLogicRect;
993 
994  // convert MapMode resolution and convert
995  ImplMapRes aMapRes;
996  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
997 
998  return tools::Rectangle( ImplLogicToPixel( rLogicRect.Left() + aMapRes.mnMapOfsX, mnDPIX,
999  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX,
1000  ImplLogicToPixel( rLogicRect.Top() + aMapRes.mnMapOfsY, mnDPIY,
1001  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY,
1002  ImplLogicToPixel( rLogicRect.Right() + aMapRes.mnMapOfsX, mnDPIX,
1003  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX,
1004  ImplLogicToPixel( rLogicRect.Bottom() + aMapRes.mnMapOfsY, mnDPIY,
1005  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY );
1006 }
1007 
1009  const MapMode& rMapMode ) const
1010 {
1011 
1012  if ( rMapMode.IsDefault() )
1013  return rLogicPoly;
1014 
1015  // convert MapMode resolution and convert
1016  ImplMapRes aMapRes;
1017  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1018 
1019  sal_uInt16 i;
1020  sal_uInt16 nPoints = rLogicPoly.GetSize();
1021  tools::Polygon aPoly( rLogicPoly );
1022 
1023  // get pointer to Point-array (copy data)
1024  const Point* pPointAry = aPoly.GetConstPointAry();
1025 
1026  for ( i = 0; i < nPoints; i++ )
1027  {
1028  const Point* pPt = &(pPointAry[i]);
1029  Point aPt;
1030  aPt.setX( ImplLogicToPixel( pPt->X() + aMapRes.mnMapOfsX, mnDPIX,
1031  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX );
1032  aPt.setY( ImplLogicToPixel( pPt->Y() + aMapRes.mnMapOfsY, mnDPIY,
1033  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY );
1034  aPoly[i] = aPt;
1035  }
1036 
1037  return aPoly;
1038 }
1039 
1041  const MapMode& rMapMode ) const
1042 {
1043  basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly;
1044  const basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation( rMapMode );
1045  aTransformedPoly.transform( rTransformationMatrix );
1046  return aTransformedPoly;
1047 }
1048 
1049 Point OutputDevice::PixelToLogic( const Point& rDevicePt ) const
1050 {
1051 
1052  if ( !mbMap )
1053  return rDevicePt;
1054 
1055  return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
1057  ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
1059 }
1060 
1061 Size OutputDevice::PixelToLogic( const Size& rDeviceSize ) const
1062 {
1063 
1064  if ( !mbMap )
1065  return rDeviceSize;
1066 
1067  return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
1069  ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
1071 }
1072 
1074 {
1075 
1076  if ( !mbMap || rDeviceRect.IsEmpty() )
1077  return rDeviceRect;
1078 
1079  return tools::Rectangle( ImplPixelToLogic( rDeviceRect.Left(), mnDPIX,
1081  ImplPixelToLogic( rDeviceRect.Top(), mnDPIY,
1083  ImplPixelToLogic( rDeviceRect.Right(), mnDPIX,
1085  ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY,
1087 }
1088 
1090 {
1091 
1092  if ( !mbMap )
1093  return rDevicePoly;
1094 
1095  sal_uInt16 i;
1096  sal_uInt16 nPoints = rDevicePoly.GetSize();
1097  tools::Polygon aPoly( rDevicePoly );
1098 
1099  // get pointer to Point-array (copy data)
1100  const Point* pPointAry = aPoly.GetConstPointAry();
1101 
1102  for ( i = 0; i < nPoints; i++ )
1103  {
1104  const Point* pPt = &(pPointAry[i]);
1105  Point aPt;
1106  aPt.setX( ImplPixelToLogic( pPt->X(), mnDPIX,
1108  aPt.setY( ImplPixelToLogic( pPt->Y(), mnDPIY,
1110  aPoly[i] = aPt;
1111  }
1112 
1113  return aPoly;
1114 }
1115 
1117 {
1118 
1119  if ( !mbMap )
1120  return rDevicePolyPoly;
1121 
1122  tools::PolyPolygon aPolyPoly( rDevicePolyPoly );
1123  sal_uInt16 nPoly = aPolyPoly.Count();
1124  for( sal_uInt16 i = 0; i < nPoly; i++ )
1125  {
1126  tools::Polygon& rPoly = aPolyPoly[i];
1127  rPoly = PixelToLogic( rPoly );
1128  }
1129  return aPolyPoly;
1130 }
1131 
1133 {
1134  basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly;
1135  const basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation();
1136  aTransformedPoly.transform( rTransformationMatrix );
1137  return aTransformedPoly;
1138 }
1139 
1141 {
1142 
1143  if(!mbMap || rDeviceRegion.IsNull() || rDeviceRegion.IsEmpty())
1144  {
1145  return rDeviceRegion;
1146  }
1147 
1148  vcl::Region aRegion;
1149 
1150  if(rDeviceRegion.getB2DPolyPolygon())
1151  {
1152  aRegion = vcl::Region(PixelToLogic(*rDeviceRegion.getB2DPolyPolygon()));
1153  }
1154  else if(rDeviceRegion.getPolyPolygon())
1155  {
1156  aRegion = vcl::Region(PixelToLogic(*rDeviceRegion.getPolyPolygon()));
1157  }
1158  else if(rDeviceRegion.getRegionBand())
1159  {
1160  RectangleVector aRectangles;
1161  rDeviceRegion.GetRegionRectangles(aRectangles);
1162  const RectangleVector& rRectangles(aRectangles); // needed to make the '!=' work
1163 
1164  // make reverse run to fill new region bottom-up, this will speed it up due to the used data structuring
1165  for(RectangleVector::const_reverse_iterator aRectIter(rRectangles.rbegin()); aRectIter != rRectangles.rend(); ++aRectIter)
1166  {
1167  aRegion.Union(PixelToLogic(*aRectIter));
1168  }
1169  }
1170 
1171  return aRegion;
1172 }
1173 
1174 Point OutputDevice::PixelToLogic( const Point& rDevicePt,
1175  const MapMode& rMapMode ) const
1176 {
1177 
1178  // calculate nothing if default-MapMode
1179  if ( rMapMode.IsDefault() )
1180  return rDevicePt;
1181 
1182  // calculate MapMode-resolution and convert
1183  ImplMapRes aMapRes;
1184  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1185 
1186  return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
1187  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1188  ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
1189  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1190 }
1191 
1193  const MapMode& rMapMode ) const
1194 {
1195 
1196  // calculate nothing if default-MapMode
1197  if ( rMapMode.IsDefault() )
1198  return rDeviceSize;
1199 
1200  // calculate MapMode-resolution and convert
1201  ImplMapRes aMapRes;
1202  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1203 
1204  return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
1205  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ),
1206  ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
1207  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) );
1208 }
1209 
1211  const MapMode& rMapMode ) const
1212 {
1213 
1214  // calculate nothing if default-MapMode
1215  if ( rMapMode.IsDefault() || rDeviceRect.IsEmpty() )
1216  return rDeviceRect;
1217 
1218  // calculate MapMode-resolution and convert
1219  ImplMapRes aMapRes;
1220  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1221 
1222  return tools::Rectangle( ImplPixelToLogic( rDeviceRect.Left(), mnDPIX,
1223  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1224  ImplPixelToLogic( rDeviceRect.Top(), mnDPIY,
1225  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY,
1226  ImplPixelToLogic( rDeviceRect.Right(), mnDPIX,
1227  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1228  ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY,
1229  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1230 }
1231 
1233  const MapMode& rMapMode ) const
1234 {
1235 
1236  // calculate nothing if default-MapMode
1237  if ( rMapMode.IsDefault() )
1238  return rDevicePoly;
1239 
1240  // calculate MapMode-resolution and convert
1241  ImplMapRes aMapRes;
1242  ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1243 
1244  sal_uInt16 i;
1245  sal_uInt16 nPoints = rDevicePoly.GetSize();
1246  tools::Polygon aPoly( rDevicePoly );
1247 
1248  // get pointer to Point-array (copy data)
1249  const Point* pPointAry = aPoly.GetConstPointAry();
1250 
1251  for ( i = 0; i < nPoints; i++ )
1252  {
1253  const Point* pPt = &(pPointAry[i]);
1254  Point aPt;
1255  aPt.setX( ImplPixelToLogic( pPt->X(), mnDPIX,
1256  aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX );
1257  aPt.setY( ImplPixelToLogic( pPt->Y(), mnDPIY,
1258  aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1259  aPoly[i] = aPt;
1260  }
1261 
1262  return aPoly;
1263 }
1264 
1266  const MapMode& rMapMode ) const
1267 {
1268  basegfx::B2DPolygon aTransformedPoly = rPixelPoly;
1269  const basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode );
1270  aTransformedPoly.transform( rTransformationMatrix );
1271  return aTransformedPoly;
1272 }
1273 
1275  const MapMode& rMapMode ) const
1276 {
1277  basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly;
1278  const basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode );
1279  aTransformedPoly.transform( rTransformationMatrix );
1280  return aTransformedPoly;
1281 }
1282 
1283 #define ENTER1( rSource, pMapModeSource, pMapModeDest ) \
1284  if ( !pMapModeSource ) \
1285  pMapModeSource = &maMapMode; \
1286  if ( !pMapModeDest ) \
1287  pMapModeDest = &maMapMode; \
1288  if ( *pMapModeSource == *pMapModeDest ) \
1289  return rSource; \
1290  \
1291  ImplMapRes aMapResSource; \
1292  ImplMapRes aMapResDest; \
1293  \
1294  if ( !mbMap || pMapModeSource != &maMapMode ) \
1295  { \
1296  if ( pMapModeSource->GetMapUnit() == MapUnit::MapRelative ) \
1297  aMapResSource = maMapRes; \
1298  ImplCalcMapResolution( *pMapModeSource, \
1299  mnDPIX, mnDPIY, aMapResSource ); \
1300  } \
1301  else \
1302  aMapResSource = maMapRes; \
1303  if ( !mbMap || pMapModeDest != &maMapMode ) \
1304  { \
1305  if ( pMapModeDest->GetMapUnit() == MapUnit::MapRelative ) \
1306  aMapResDest = maMapRes; \
1307  ImplCalcMapResolution( *pMapModeDest, \
1308  mnDPIX, mnDPIY, aMapResDest ); \
1309  } \
1310  else \
1311  aMapResDest = maMapRes
1312 
1313 static void verifyUnitSourceDest( MapUnit eUnitSource, MapUnit eUnitDest )
1314 {
1315  DBG_ASSERT( eUnitSource != MapUnit::MapSysFont
1316  && eUnitSource != MapUnit::MapAppFont
1317  && eUnitSource != MapUnit::MapRelative,
1318  "Source MapUnit is not permitted" );
1319  DBG_ASSERT( eUnitDest != MapUnit::MapSysFont
1320  && eUnitDest != MapUnit::MapAppFont
1321  && eUnitDest != MapUnit::MapRelative,
1322  "Destination MapUnit is not permitted" );
1323 }
1324 
1325 #define ENTER3( eUnitSource, eUnitDest ) \
1326  tools::Long nNumerator = 1; \
1327  tools::Long nDenominator = 1; \
1328  SAL_WARN_IF( eUnitSource > s_MaxValidUnit, "vcl.gdi", "Invalid source map unit"); \
1329  SAL_WARN_IF( eUnitDest > s_MaxValidUnit, "vcl.gdi", "Invalid destination map unit"); \
1330  if( (eUnitSource <= s_MaxValidUnit) && (eUnitDest <= s_MaxValidUnit) ) \
1331  { \
1332  nNumerator = aImplNumeratorAry[eUnitSource] * \
1333  aImplDenominatorAry[eUnitDest]; \
1334  nDenominator = aImplNumeratorAry[eUnitDest] * \
1335  aImplDenominatorAry[eUnitSource]; \
1336  } \
1337  if ( eUnitSource == MapUnit::MapPixel ) \
1338  nDenominator *= 72; \
1339  else if( eUnitDest == MapUnit::MapPixel ) \
1340  nNumerator *= 72
1341 
1342 #define ENTER4( rMapModeSource, rMapModeDest ) \
1343  ImplMapRes aMapResSource; \
1344  ImplMapRes aMapResDest; \
1345  \
1346  ImplCalcMapResolution( rMapModeSource, 72, 72, aMapResSource ); \
1347  ImplCalcMapResolution( rMapModeDest, 72, 72, aMapResDest )
1348 
1349 // return (n1 * n2 * n3) / (n4 * n5)
1350 static tools::Long fn5( const tools::Long n1,
1351  const tools::Long n2,
1352  const tools::Long n3,
1353  const tools::Long n4,
1354  const tools::Long n5 )
1355 {
1356  if ( n1 == 0 || n2 == 0 || n3 == 0 || n4 == 0 || n5 == 0 )
1357  return 0;
1358  if (std::numeric_limits<tools::Long>::max() / std::abs(n2) < std::abs(n3))
1359  {
1360  // a6 is skipped
1361  BigInt a7 = n2;
1362  a7 *= n3;
1363  a7 *= n1;
1364 
1365  if (std::numeric_limits<tools::Long>::max() / std::abs(n4) < std::abs(n5))
1366  {
1367  BigInt a8 = n4;
1368  a8 *= n5;
1369 
1370  BigInt a9 = a8;
1371  a9 /= 2;
1372  if ( a7.IsNeg() )
1373  a7 -= a9;
1374  else
1375  a7 += a9;
1376 
1377  a7 /= a8;
1378  } // of if
1379  else
1380  {
1381  tools::Long n8 = n4 * n5;
1382 
1383  if ( a7.IsNeg() )
1384  a7 -= n8 / 2;
1385  else
1386  a7 += n8 / 2;
1387 
1388  a7 /= n8;
1389  } // of else
1390  return static_cast<tools::Long>(a7);
1391  } // of if
1392  else
1393  {
1394  tools::Long n6 = n2 * n3;
1395 
1396  if (std::numeric_limits<tools::Long>::max() / std::abs(n1) < std::abs(n6))
1397  {
1398  BigInt a7 = n1;
1399  a7 *= n6;
1400 
1401  if (std::numeric_limits<tools::Long>::max() / std::abs(n4) < std::abs(n5))
1402  {
1403  BigInt a8 = n4;
1404  a8 *= n5;
1405 
1406  BigInt a9 = a8;
1407  a9 /= 2;
1408  if ( a7.IsNeg() )
1409  a7 -= a9;
1410  else
1411  a7 += a9;
1412 
1413  a7 /= a8;
1414  } // of if
1415  else
1416  {
1417  tools::Long n8 = n4 * n5;
1418 
1419  if ( a7.IsNeg() )
1420  a7 -= n8 / 2;
1421  else
1422  a7 += n8 / 2;
1423 
1424  a7 /= n8;
1425  } // of else
1426  return static_cast<tools::Long>(a7);
1427  } // of if
1428  else
1429  {
1430  tools::Long n7 = n1 * n6;
1431 
1432  if (std::numeric_limits<tools::Long>::max() / std::abs(n4) < std::abs(n5))
1433  {
1434  BigInt a7 = n7;
1435  BigInt a8 = n4;
1436  a8 *= n5;
1437 
1438  BigInt a9 = a8;
1439  a9 /= 2;
1440  if ( a7.IsNeg() )
1441  a7 -= a9;
1442  else
1443  a7 += a9;
1444 
1445  a7 /= a8;
1446  return static_cast<tools::Long>(a7);
1447  } // of if
1448  else
1449  {
1450  const tools::Long n8 = n4 * n5;
1451  const tools::Long n8_2 = n8 / 2;
1452 
1453  if( n7 < 0 )
1454  {
1455  if ((n7 - std::numeric_limits<tools::Long>::min()) >= n8_2)
1456  n7 -= n8_2;
1457  }
1458  else if ((std::numeric_limits<tools::Long>::max() - n7) >= n8_2)
1459  n7 += n8_2;
1460 
1461  return n7 / n8;
1462  } // of else
1463  } // of else
1464  } // of else
1465 }
1466 
1467 // return (n1 * n2) / n3
1468 static tools::Long fn3( const tools::Long n1, const tools::Long n2, const tools::Long n3 )
1469 {
1470  if ( n1 == 0 || n2 == 0 || n3 == 0 )
1471  return 0;
1472  if (std::numeric_limits<tools::Long>::max() / std::abs(n1) < std::abs(n2))
1473  {
1474  BigInt a4 = n1;
1475  a4 *= n2;
1476 
1477  if ( a4.IsNeg() )
1478  a4 -= n3 / 2;
1479  else
1480  a4 += n3 / 2;
1481 
1482  a4 /= n3;
1483  return static_cast<tools::Long>(a4);
1484  } // of if
1485  else
1486  {
1487  tools::Long n4 = n1 * n2;
1488  const tools::Long n3_2 = n3 / 2;
1489 
1490  if( n4 < 0 )
1491  {
1492  if ((n4 - std::numeric_limits<tools::Long>::min()) >= n3_2)
1493  n4 -= n3_2;
1494  }
1495  else if ((std::numeric_limits<tools::Long>::max() - n4) >= n3_2)
1496  n4 += n3_2;
1497 
1498  return n4 / n3;
1499  } // of else
1500 }
1501 
1502 Point OutputDevice::LogicToLogic( const Point& rPtSource,
1503  const MapMode* pMapModeSource,
1504  const MapMode* pMapModeDest ) const
1505 {
1506  ENTER1( rPtSource, pMapModeSource, pMapModeDest );
1507 
1508  return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
1509  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1510  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1511  aMapResDest.mnMapOfsX,
1512  fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
1513  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1514  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1515  aMapResDest.mnMapOfsY );
1516 }
1517 
1519  const MapMode* pMapModeSource,
1520  const MapMode* pMapModeDest ) const
1521 {
1522  ENTER1( rSzSource, pMapModeSource, pMapModeDest );
1523 
1524  return Size( fn5( rSzSource.Width(),
1525  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1526  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
1527  fn5( rSzSource.Height(),
1528  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1529  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
1530 }
1531 
1533  const MapMode* pMapModeSource,
1534  const MapMode* pMapModeDest ) const
1535 {
1536  ENTER1( rRectSource, pMapModeSource, pMapModeDest );
1537 
1538  return tools::Rectangle( fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
1539  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1540  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1541  aMapResDest.mnMapOfsX,
1542  fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
1543  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1544  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1545  aMapResDest.mnMapOfsY,
1546  fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
1547  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1548  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1549  aMapResDest.mnMapOfsX,
1550  fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
1551  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1552  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1553  aMapResDest.mnMapOfsY );
1554 }
1555 
1556 Point OutputDevice::LogicToLogic( const Point& rPtSource,
1557  const MapMode& rMapModeSource,
1558  const MapMode& rMapModeDest )
1559 {
1560  if ( rMapModeSource == rMapModeDest )
1561  return rPtSource;
1562 
1563  MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1564  MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1565  verifyUnitSourceDest( eUnitSource, eUnitDest );
1566 
1567  if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1568  {
1569  ENTER3( eUnitSource, eUnitDest );
1570 
1571  return Point( fn3( rPtSource.X(), nNumerator, nDenominator ),
1572  fn3( rPtSource.Y(), nNumerator, nDenominator ) );
1573  }
1574  else
1575  {
1576  ENTER4( rMapModeSource, rMapModeDest );
1577 
1578  return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
1579  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1580  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1581  aMapResDest.mnMapOfsX,
1582  fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
1583  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1584  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1585  aMapResDest.mnMapOfsY );
1586  }
1587 }
1588 
1590  const MapMode& rMapModeSource,
1591  const MapMode& rMapModeDest )
1592 {
1593  if ( rMapModeSource == rMapModeDest )
1594  return rSzSource;
1595 
1596  MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1597  MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1598  verifyUnitSourceDest( eUnitSource, eUnitDest );
1599 
1600  if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1601  {
1602  ENTER3( eUnitSource, eUnitDest );
1603 
1604  return Size( fn3( rSzSource.Width(), nNumerator, nDenominator ),
1605  fn3( rSzSource.Height(), nNumerator, nDenominator ) );
1606  }
1607  else
1608  {
1609  ENTER4( rMapModeSource, rMapModeDest );
1610 
1611  return Size( fn5( rSzSource.Width(),
1612  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1613  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
1614  fn5( rSzSource.Height(),
1615  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1616  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
1617  }
1618 }
1619 
1621  const MapMode& rMapModeSource,
1622  const MapMode& rMapModeDest )
1623 {
1624  if(rMapModeSource == rMapModeDest)
1625  {
1626  return rPolySource;
1627  }
1628 
1629  const basegfx::B2DHomMatrix aTransform(LogicToLogic(rMapModeSource, rMapModeDest));
1630  basegfx::B2DPolygon aPoly(rPolySource);
1631 
1632  aPoly.transform(aTransform);
1633  return aPoly;
1634 }
1635 
1636 basegfx::B2DHomMatrix OutputDevice::LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest)
1637 {
1638  basegfx::B2DHomMatrix aTransform;
1639 
1640  if(rMapModeSource == rMapModeDest)
1641  {
1642  return aTransform;
1643  }
1644 
1645  MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1646  MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1647  verifyUnitSourceDest(eUnitSource, eUnitDest);
1648 
1649  if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1650  {
1651  ENTER3(eUnitSource, eUnitDest);
1652 
1653  const double fScaleFactor(static_cast<double>(nNumerator) / static_cast<double>(nDenominator));
1654  aTransform.set(0, 0, fScaleFactor);
1655  aTransform.set(1, 1, fScaleFactor);
1656  }
1657  else
1658  {
1659  ENTER4(rMapModeSource, rMapModeDest);
1660 
1661  const double fScaleFactorX((double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX)) / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX)));
1662  const double fScaleFactorY((double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY)) / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY)));
1663  const double fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX));
1664  const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY));
1665 
1666  aTransform.set(0, 0, fScaleFactorX);
1667  aTransform.set(1, 1, fScaleFactorY);
1668  aTransform.set(0, 2, fZeroPointX);
1669  aTransform.set(1, 2, fZeroPointY);
1670  }
1671 
1672  return aTransform;
1673 }
1674 
1676  const MapMode& rMapModeSource,
1677  const MapMode& rMapModeDest )
1678 {
1679  if ( rMapModeSource == rMapModeDest )
1680  return rRectSource;
1681 
1682  MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1683  MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1684  verifyUnitSourceDest( eUnitSource, eUnitDest );
1685 
1686  if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1687  {
1688  ENTER3( eUnitSource, eUnitDest );
1689 
1690  auto left = fn3( rRectSource.Left(), nNumerator, nDenominator );
1691  auto top = fn3( rRectSource.Top(), nNumerator, nDenominator );
1692  if (rRectSource.IsEmpty())
1693  return tools::Rectangle( left, top );
1694 
1695  auto right = fn3( rRectSource.Right(), nNumerator, nDenominator );
1696  auto bottom = fn3( rRectSource.Bottom(), nNumerator, nDenominator );
1697  return tools::Rectangle(left, top, right, bottom);
1698  }
1699  else
1700  {
1701  ENTER4( rMapModeSource, rMapModeDest );
1702 
1703  auto left = fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
1704  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1705  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1706  aMapResDest.mnMapOfsX;
1707  auto top = fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
1708  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1709  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1710  aMapResDest.mnMapOfsY;
1711  if (rRectSource.IsEmpty())
1712  return tools::Rectangle(left, top);
1713 
1714  auto right = fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
1715  aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1716  aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1717  aMapResDest.mnMapOfsX;
1718  auto bottom = fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
1719  aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1720  aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1721  aMapResDest.mnMapOfsY;
1722  return tools::Rectangle(left, top, right, bottom);
1723  }
1724 }
1725 
1727  MapUnit eUnitSource, MapUnit eUnitDest )
1728 {
1729  if ( eUnitSource == eUnitDest )
1730  return nLongSource;
1731 
1732  verifyUnitSourceDest( eUnitSource, eUnitDest );
1733  ENTER3( eUnitSource, eUnitDest );
1734 
1735  return fn3( nLongSource, nNumerator, nDenominator );
1736 }
1737 
1738 void OutputDevice::SetPixelOffset( const Size& rOffset )
1739 {
1740  mnOutOffOrigX = rOffset.Width();
1741  mnOutOffOrigY = rOffset.Height();
1742 
1747 
1748  if( mpAlphaVDev )
1749  mpAlphaVDev->SetPixelOffset( rOffset );
1750 }
1751 
1752 
1754 {
1755  if ( !mbMap )
1756  return static_cast<DeviceCoordinate>(nWidth);
1757 
1758 #if VCL_FLOAT_DEVICE_PIXEL
1759  return (double)nWidth * maMapRes.mfScaleX * mnDPIX;
1760 #else
1761 
1763 #endif
1764 }
1765 
1766 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 Count() const
basegfx::B2DHomMatrix GetInverseViewTransformation() const
Definition: map.cxx:770
const Fraction & GetScaleX() const
Definition: mapmod.cxx:172
void SetPixelOffset(const Size &rOffset)
Set an offset in pixel.
Definition: map.cxx:1738
SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate(tools::Long nWidth) const
Definition: map.cxx:1753
const o3tl::enumarray< MapUnit, tools::Long > aImplDenominatorAry
Definition: map.cxx:42
void SetRelativeMapMode(const MapMode &rNewMapMode)
Definition: map.cxx:672
static void verifyUnitSourceDest(MapUnit eUnitSource, MapUnit eUnitDest)
Definition: map.cxx:1313
tools::Long mnOutOffLogicX
Additional output offset in logical coordinates, applied in PixelToLogic (used by SetPixelOffset/GetP...
Definition: outdev.hxx:335
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
tools::Long mnOutOffOrigY
Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset) ...
Definition: outdev.hxx:337
bool IsNull() const
Definition: region.hxx:102
static Fraction ImplMakeFraction(tools::Long nN1, tools::Long nN2, tools::Long nD1, tools::Long nD2)
Definition: map.cxx:50
sal_uInt64 left
void Move(tools::Long nHorzMove, tools::Long nVertMove)
Definition: region.cxx:414
const MapUnit s_MaxValidUnit
Definition: map.cxx:39
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: map.cxx:1502
static SAL_DLLPRIVATE void ImplInitAppFontData(vcl::Window const *pWindow)
Definition: window.cxx:1169
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:508
long Long
SAL_DLLPRIVATE bool IsSimple() const
Definition: mapmod.cxx:176
tools::Long mnOutOffY
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:343
sal_Int32 mnDPIY
Definition: outdev.hxx:347
sal_Int32 mnDPIX
Definition: outdev.hxx:346
void EnableMapMode(bool bEnable=true)
Definition: map.cxx:538
bool mbMap
Definition: outdev.hxx:374
tools::Long mnMapScDenomX
Definition: outdevmap.hxx:29
bool IsDefault() const
Definition: mapmod.cxx:131
const RegionBand * getRegionBand() const
Definition: region.hxx:81
void SetMapMode()
Definition: map.cxx:546
ImplSVGDIData maGDIData
Definition: svdata.hxx:392
tools::Long mnOutOffOrigX
Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset) ...
Definition: outdev.hxx:333
const basegfx::B2DPolyPolygon * getB2DPolyPolygon() const
Definition: region.hxx:79
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:37
MapMode maMapMode
Definition: outdev.hxx:369
#define ENTER1(rSource, pMapModeSource, pMapModeDest)
Definition: map.cxx:1283
bool IsEmpty() const
A construction helper for ScopedVclPtr.
Definition: vclptr.hxx:407
static void ImplCalcMapResolution(const MapMode &rMapMode, tools::Long nDPIX, tools::Long nDPIY, ImplMapRes &rMapRes)
Definition: map.cxx:85
tools::Long Left() const
SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel(tools::Long nX) const
Convert a logical X coordinate to a device pixel's X coordinate.
Definition: map.cxx:326
#define ENTER4(rMapModeSource, rMapModeDest)
Definition: map.cxx:1342
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const Fraction & GetScaleY() const
Definition: mapmod.cxx:174
tools::Long Bottom() const
tools::Long mnMapScDenomY
Definition: outdevmap.hxx:30
SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const
Get device transformation.
Definition: map.cxx:819
static tools::Long fn5(const tools::Long n1, const tools::Long n2, const tools::Long n3, const tools::Long n4, const tools::Long n5)
Definition: map.cxx:1350
static tools::Long ImplLogicToPixel(tools::Long n, tools::Long nDPI, tools::Long nMapNum, tools::Long nMapDenom)
Definition: map.cxx:272
static tools::Long ImplPixelToLogic(tools::Long n, tools::Long nDPI, tools::Long nMapNum, tools::Long nMapDenom)
Definition: map.cxx:301
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:73
SAL_DLLPRIVATE void ImplInvalidateViewTransform()
Invalidate the view transformation.
Definition: map.cxx:254
bool IsEmpty() const
Definition: region.cxx:228
void ReduceInaccurate(unsigned nSignificantBits)
def right
void SetScaleX(const Fraction &rScaleX)
Definition: mapmod.cxx:108
virtual void ImplInitMapModeObjects()
Definition: map.cxx:670
#define DBG_ASSERT(sCon, aError)
int i
SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel(float fLogicHeight) const
Convert logical height to device pixels, with exact sub-pixel value.
Definition: map.cxx:360
const Point * GetConstPointAry() const
void SetOrigin(const Point &rOrigin)
Definition: mapmod.cxx:102
bool mbNewFont
Definition: outdev.hxx:388
tools::Long Width() const
SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel(tools::Long nWidth) const
Convert a logical width to a width in units of device pixels.
Definition: map.cxx:344
tools::Long DeviceCoordinate
void transform(const basegfx::B2DHomMatrix &rMatrix)
void SetScaleY(const Fraction &rScaleY)
Definition: mapmod.cxx:115
sal_uInt16 GetSize() const
tools::Long mnMapOfsX
Definition: outdevmap.hxx:25
MapUnit GetMapUnit() const
Definition: mapmod.cxx:168
bool IsNeg() const
virtual void SetMetafileMapMode(const MapMode &rNewMapMode, bool bIsRecord)
Definition: map.cxx:662
#define ENTER3(eUnitSource, eUnitDest)
Definition: map.cxx:1325
tools::Long Top() const
tools::Long mnMapOfsY
Definition: outdevmap.hxx:26
void transform(const basegfx::B2DHomMatrix &rMatrix)
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1049
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:828
const o3tl::enumarray< MapUnit, tools::Long > aImplNumeratorAry
Definition: map.cxx:40
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:330
SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel(const vcl::Region &rRegion) const
Convert a region in pixel units to a region in device pixel units and coords.
Definition: map.cxx:528
ImplMapRes maMapRes
Definition: outdev.hxx:356
sal_Int32 GetDenominator() const
tools::Long mnMapScNumY
Definition: outdevmap.hxx:28
tools::Long mnAppFontX
Definition: svdata.hxx:227
void AddAction(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:564
const tools::PolyPolygon * getPolyPolygon() const
Definition: region.hxx:80
tools::Long mnMapScNumX
Definition: outdevmap.hxx:27
ImplSVFrameData maFrameData
Definition: svdata.hxx:393
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1659
tools::Long Height() const
sal_Int32 GetNumerator() const
bool mbInitFont
Definition: outdev.hxx:384
const Point & GetOrigin() const
Definition: mapmod.cxx:170
void translate(double fX, double fY)
SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel(const tools::Rectangle &rLogicRect) const
Convert a logical rectangle to a rectangle in physical device pixel units.
Definition: map.cxx:406
VclPtr< vcl::Window > mpFirstFrame
Definition: svdata.hxx:238
tools::Long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:341
MapUnit
#define SAL_WARN(area, stream)
std::unique_ptr< ImplOutDevData > mpOutDevData
Definition: outdev.hxx:325
SAL_DLLPRIVATE tools::Rectangle ImplDevicePixelToLogic(const tools::Rectangle &rPixelRect) const
Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords...
Definition: map.cxx:507
SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel(tools::Long nY) const
Convert a logical Y coordinate to a device pixel's Y coordinate.
Definition: map.cxx:335
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
bool IsValid() const
tools::Long mnOutOffLogicY
Additional output offset in logical coordinates, applied in PixelToLogic (used by SetPixelOffset/GetP...
Definition: outdev.hxx:339
SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicWidth(tools::Long nWidth) const
Convert device pixels to a width in logical units.
Definition: map.cxx:368
tools::Long mnAppFontY
Definition: svdata.hxx:228
basegfx::B2DHomMatrix GetViewTransformation() const
Definition: map.cxx:742
SAL_DLLPRIVATE tools::Long ImplLogicHeightToDevicePixel(tools::Long nHeight) const
Convert a logical height to a height in units of device pixels.
Definition: map.cxx:352
SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicHeight(tools::Long nHeight) const
Convert device pixels to a height in logical units.
Definition: map.cxx:376
static tools::Long fn3(const tools::Long n1, const tools::Long n2, const tools::Long n3)
Definition: map.cxx:1468
tools::Long Right() const
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:318