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