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 <sal/config.h>
21
22#include <sal/log.hxx>
23#include <osl/diagnose.h>
24#include <tools/bigint.hxx>
25#include <tools/debug.hxx>
26
27#include <vcl/cursor.hxx>
28#include <vcl/lineinfo.hxx>
29#include <vcl/metaact.hxx>
30#include <vcl/virdev.hxx>
31#include <vcl/wrkwin.hxx>
32
33#include <ImplOutDevData.hxx>
34#include <svdata.hxx>
35#include <window.h>
36
39
40static auto setMapRes(ImplMapRes& rMapRes, const o3tl::Length eUnit)
41{
42 const auto [nNum, nDen] = o3tl::getConversionMulDiv(eUnit, o3tl::Length::in);
43 rMapRes.mnMapScNumX = rMapRes.mnMapScNumY = nNum;
44 rMapRes.mnMapScDenomX = rMapRes.mnMapScDenomY = nDen;
45};
46
47static void ImplCalcMapResolution( const MapMode& rMapMode,
48 tools::Long nDPIX, tools::Long nDPIY, ImplMapRes& rMapRes )
49{
50 switch ( rMapMode.GetMapUnit() )
51 {
52 case MapUnit::MapRelative:
53 break;
54 case MapUnit::Map100thMM:
56 break;
57 case MapUnit::Map10thMM:
59 break;
60 case MapUnit::MapMM:
62 break;
63 case MapUnit::MapCM:
65 break;
66 case MapUnit::Map1000thInch:
68 break;
69 case MapUnit::Map100thInch:
71 break;
72 case MapUnit::Map10thInch:
74 break;
75 case MapUnit::MapInch:
77 break;
78 case MapUnit::MapPoint:
80 break;
81 case MapUnit::MapTwip:
83 break;
84 case MapUnit::MapPixel:
85 rMapRes.mnMapScNumX = 1;
86 rMapRes.mnMapScDenomX = nDPIX;
87 rMapRes.mnMapScNumY = 1;
88 rMapRes.mnMapScDenomY = nDPIY;
89 break;
90 case MapUnit::MapSysFont:
91 case MapUnit::MapAppFont:
92 {
93 ImplSVData* pSVData = ImplGetSVData();
94 if ( !pSVData->maGDIData.mnAppFontX )
95 {
96 if (pSVData->maFrameData.mpFirstFrame)
98 else
99 {
100 ScopedVclPtrInstance<WorkWindow> pWin( nullptr, 0 );
102 }
103 }
104 rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
105 rMapRes.mnMapScDenomX = nDPIX * 40;
106 rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY;
107 rMapRes.mnMapScDenomY = nDPIY * 80;
108 }
109 break;
110 default:
111 OSL_FAIL( "unhandled MapUnit" );
112 break;
113 }
114
115 const Fraction& aScaleX = rMapMode.GetScaleX();
116 const Fraction& aScaleY = rMapMode.GetScaleY();
117
118 // set offset according to MapMode
119 Point aOrigin = rMapMode.GetOrigin();
120 if ( rMapMode.GetMapUnit() != MapUnit::MapRelative )
121 {
122 rMapRes.mnMapOfsX = aOrigin.X();
123 rMapRes.mnMapOfsY = aOrigin.Y();
124 }
125 else
126 {
127 auto funcCalcOffset = [](const Fraction& rScale, tools::Long& rnMapOffset, tools::Long nOrigin)
128 {
129 auto nNumerator = rScale.GetNumerator();
130 assert(nNumerator != 0);
131
132 BigInt aX( rnMapOffset );
133 aX *= BigInt( rScale.GetDenominator() );
134 if ( rnMapOffset >= 0 )
135 {
136 if (nNumerator >= 0)
137 aX += BigInt(nNumerator / 2);
138 else
139 aX -= BigInt((nNumerator + 1) / 2);
140 }
141 else
142 {
143 if (nNumerator >= 0 )
144 aX -= BigInt((nNumerator - 1) / 2);
145 else
146 aX += BigInt(nNumerator / 2);
147 }
148 aX /= BigInt(nNumerator);
149 rnMapOffset = static_cast<tools::Long>(aX) + nOrigin;
150 };
151
152 funcCalcOffset(aScaleX, rMapRes.mnMapOfsX, aOrigin.X());
153 funcCalcOffset(aScaleY, rMapRes.mnMapOfsY, aOrigin.Y());
154 }
155
156 // calculate scaling factor according to MapMode
157 // aTemp? = rMapRes.mnMapSc? * aScale?
159 aScaleX.GetNumerator(),
160 rMapRes.mnMapScDenomX,
161 aScaleX.GetDenominator() );
163 aScaleY.GetNumerator(),
164 rMapRes.mnMapScDenomY,
165 aScaleY.GetDenominator() );
166 rMapRes.mnMapScNumX = aTempX.GetNumerator();
167 rMapRes.mnMapScDenomX = aTempX.GetDenominator();
168 rMapRes.mnMapScNumY = aTempY.GetNumerator();
169 rMapRes.mnMapScDenomY = aTempY.GetDenominator();
170}
171
172// #i75163#
174{
175 if(!mpOutDevData)
176 return;
177
178 if(mpOutDevData->mpViewTransform)
179 {
180 delete mpOutDevData->mpViewTransform;
181 mpOutDevData->mpViewTransform = nullptr;
182 }
183
184 if(mpOutDevData->mpInverseViewTransform)
185 {
186 delete mpOutDevData->mpInverseViewTransform;
187 mpOutDevData->mpInverseViewTransform = nullptr;
188 }
189}
190
192 tools::Long nMapDenom)
193{
194 assert(nDPI > 0);
195 assert(nMapDenom != 0);
196 if constexpr (sizeof(tools::Long) >= 8)
197 {
198 assert(nMapNum >= 0);
199 //detect overflows
200 assert(nMapNum == 0
201 || std::abs(n) < std::numeric_limits<tools::Long>::max() / nMapNum / nDPI);
202 }
203 sal_Int64 n64 = n;
204 n64 *= nMapNum;
205 n64 *= nDPI;
206 if (nMapDenom == 1)
207 n = static_cast<tools::Long>(n64);
208 else
209 {
210 n64 = 2 * n64 / nMapDenom;
211 if (n64 < 0)
212 --n64;
213 else
214 ++n64;
215 n = static_cast<tools::Long>(n64 / 2);
216 }
217 return n;
218}
219
221 tools::Long nMapDenom)
222{
223 assert(nDPI > 0);
224 assert(nMapDenom != 0);
225 return static_cast<double>(n) * nMapNum * nDPI / nMapDenom;
226}
227
229 tools::Long nMapDenom)
230{
231 assert(nDPI > 0);
232 assert(nMapNum != 0);
233
234 return std::round(n * nMapDenom / nMapNum / nDPI);
235}
236
238 tools::Long nMapDenom)
239{
240 assert(nDPI > 0);
241 if (nMapNum == 0)
242 return 0;
243 sal_Int64 nDenom = nDPI;
244 nDenom *= nMapNum;
245
246 sal_Int64 n64 = n;
247 n64 *= nMapDenom;
248 if (nDenom == 1)
249 n = static_cast<tools::Long>(n64);
250 else
251 {
252 n64 = 2 * n64 / nDenom;
253 if (n64 < 0)
254 --n64;
255 else
256 ++n64;
257 n = static_cast<tools::Long>(n64 / 2);
258 }
259 return n;
260}
261
263{
264 if ( !mbMap )
265 return nX+mnOutOffX;
266
269}
270
272{
273 if ( !mbMap )
274 return nY+mnOutOffY;
275
278}
279
281{
282 if ( !mbMap )
283 return nWidth;
284
286}
287
289{
290 if ( !mbMap )
291 return nHeight;
292
294}
295
297{
298 if ( !mbMap )
299 return nWidth;
300
302}
303
305{
306 if ( !mbMap )
307 return nHeight;
308
310}
311
313{
314 if ( !mbMap )
315 return Point( rLogicPt.X()+mnOutOffX, rLogicPt.Y()+mnOutOffY );
316
317 return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
321}
322
324{
325 if ( !mbMap )
326 return rLogicSize;
327
328 return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
330 ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
332}
333
335{
336 // tdf#141761 IsEmpty() removed
337 // Even if rLogicRect.IsEmpty(), transform of the Position contained
338 // in the Rectangle is necessary. Due to Rectangle::Right() returning
339 // Left() when IsEmpty(), the code *could* stay unchanged (same for Bottom),
340 // but:
341 // The Rectangle constructor used with the four tools::Long values does not
342 // check for IsEmpty(), so to keep that state correct there are two possibilities:
343 // (1) Add a test to the Rectangle constructor in question
344 // (2) Do it handish here
345 // I have tried (1) first, but test Test::test_rectangle() claims that for
346 // tools::Rectangle aRect(1, 1, 1, 1);
347 // tools::Long(1) == aRect.GetWidth()
348 // tools::Long(0) == aRect.getWidth()
349 // (remember: this means Left == Right == 1 -> GetWidth => 1, getWidth == 0)
350 // so indeed the 1's have to go uncommented/unchecked into the data body
351 // of rectangle. Switching to (2) *is* needed, doing so
352 tools::Rectangle aRetval;
353
354 if ( !mbMap )
355 {
356 aRetval = tools::Rectangle(
357 rLogicRect.Left()+mnOutOffX,
358 rLogicRect.Top()+mnOutOffY,
359 rLogicRect.IsWidthEmpty() ? 0 : rLogicRect.Right()+mnOutOffX,
360 rLogicRect.IsHeightEmpty() ? 0 : rLogicRect.Bottom()+mnOutOffY );
361 }
362 else
363 {
364 aRetval = tools::Rectangle(
369 }
370
371 if(rLogicRect.IsWidthEmpty())
372 aRetval.SetWidthEmpty();
373
374 if(rLogicRect.IsHeightEmpty())
375 aRetval.SetHeightEmpty();
376
377 return aRetval;
378}
379
381{
382 if ( !mbMap && !mnOutOffX && !mnOutOffY )
383 return rLogicPoly;
384
385 sal_uInt16 i;
386 sal_uInt16 nPoints = rLogicPoly.GetSize();
387 tools::Polygon aPoly( rLogicPoly );
388
389 // get pointer to Point-array (copy data)
390 const Point* pPointAry = aPoly.GetConstPointAry();
391
392 if ( mbMap )
393 {
394 for ( i = 0; i < nPoints; i++ )
395 {
396 const Point& rPt = pPointAry[i];
401 aPoly[i] = aPt;
402 }
403 }
404 else
405 {
406 for ( i = 0; i < nPoints; i++ )
407 {
408 Point aPt = pPointAry[i];
409 aPt.AdjustX(mnOutOffX );
410 aPt.AdjustY(mnOutOffY );
411 aPoly[i] = aPt;
412 }
413 }
414
415 return aPoly;
416}
417
419{
420 if (!mbMap && !mnOutOffX && !mnOutOffY)
421 return rLogicPoly;
422
423 sal_uInt32 nPoints = rLogicPoly.count();
424 basegfx::B2DPolygon aPoly(rLogicPoly);
425
428
429 if (mbMap)
430 {
431 for (sal_uInt32 i = 0; i < nPoints; ++i)
432 {
433 const basegfx::B2DPoint& rPt = aPoly.getB2DPoint(i);
438
439 const bool bC1 = aPoly.isPrevControlPointUsed(i);
440 if (bC1)
441 {
442 const basegfx::B2DPoint aB2DC1(aPoly.getPrevControlPoint(i));
443
448 }
449
450 const bool bC2 = aPoly.isNextControlPointUsed(i);
451 if (bC2)
452 {
453 const basegfx::B2DPoint aB2DC2(aPoly.getNextControlPoint(i));
454
459 }
460
461 aPoly.setB2DPoint(i, aPt);
462
463 if (bC1)
464 aPoly.setPrevControlPoint(i, aC1);
465
466 if (bC2)
467 aPoly.setNextControlPoint(i, aC2);
468 }
469 }
470 else
471 {
472 for (sal_uInt32 i = 0; i < nPoints; ++i)
473 {
474 const basegfx::B2DPoint& rPt = aPoly.getB2DPoint(i);
475 basegfx::B2DPoint aPt(rPt.getX() + mnOutOffX, rPt.getY() + mnOutOffY);
476
477 const bool bC1 = aPoly.isPrevControlPointUsed(i);
478 if (bC1)
479 {
480 const basegfx::B2DPoint aB2DC1(aPoly.getPrevControlPoint(i));
481
482 aC1 = basegfx::B2DPoint(aB2DC1.getX() + mnOutOffX, aB2DC1.getY() + mnOutOffY);
483 }
484
485 const bool bC2 = aPoly.isNextControlPointUsed(i);
486 if (bC2)
487 {
488 const basegfx::B2DPoint aB2DC2(aPoly.getNextControlPoint(i));
489
490 aC1 = basegfx::B2DPoint(aB2DC2.getX() + mnOutOffX, aB2DC2.getY() + mnOutOffY);
491 }
492
493 aPoly.setB2DPoint(i, aPt);
494
495 if (bC1)
496 aPoly.setPrevControlPoint(i, aC1);
497
498 if (bC2)
499 aPoly.setNextControlPoint(i, aC2);
500 }
501 }
502
503 return aPoly;
504}
505
507{
508 if ( !mbMap && !mnOutOffX && !mnOutOffY )
509 return rLogicPolyPoly;
510
511 tools::PolyPolygon aPolyPoly( rLogicPolyPoly );
512 sal_uInt16 nPoly = aPolyPoly.Count();
513 for( sal_uInt16 i = 0; i < nPoly; i++ )
514 {
515 tools::Polygon& rPoly = aPolyPoly[i];
516 rPoly = ImplLogicToDevicePixel( rPoly );
517 }
518 return aPolyPoly;
519}
520
522{
523 LineInfo aInfo( rLineInfo );
524
525 if( aInfo.GetStyle() == LineStyle::Dash )
526 {
527 if( aInfo.GetDotCount() && aInfo.GetDotLen() )
528 aInfo.SetDotLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), tools::Long(1) ) );
529 else
530 aInfo.SetDotCount( 0 );
531
532 if( aInfo.GetDashCount() && aInfo.GetDashLen() )
533 aInfo.SetDashLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), tools::Long(1) ) );
534 else
535 aInfo.SetDashCount( 0 );
536
537 aInfo.SetDistance( ImplLogicWidthToDevicePixel( aInfo.GetDistance() ) );
538
539 if( ( !aInfo.GetDashCount() && !aInfo.GetDotCount() ) || !aInfo.GetDistance() )
540 aInfo.SetStyle( LineStyle::Solid );
541 }
542
543 aInfo.SetWidth( ImplLogicWidthToDevicePixel( aInfo.GetWidth() ) );
544
545 return aInfo;
546}
547
549{
550 // tdf#141761 see comments above, IsEmpty() removed
551 tools::Rectangle aRetval;
552
553 if ( !mbMap )
554 {
555 aRetval = tools::Rectangle(
556 rPixelRect.Left()-mnOutOffX,
557 rPixelRect.Top()-mnOutOffY,
558 rPixelRect.IsWidthEmpty() ? 0 : rPixelRect.Right()-mnOutOffX,
559 rPixelRect.IsHeightEmpty() ? 0 : rPixelRect.Bottom()-mnOutOffY );
560 }
561 else
562 {
563 aRetval = tools::Rectangle(
568 }
569
570 if(rPixelRect.IsWidthEmpty())
571 aRetval.SetWidthEmpty();
572
573 if(rPixelRect.IsHeightEmpty())
574 aRetval.SetHeightEmpty();
575
576 return aRetval;
577}
578
580{
581 if ( !mnOutOffX && !mnOutOffY )
582 return rRegion;
583
584 vcl::Region aRegion( rRegion );
586 return aRegion;
587}
588
589void OutputDevice::EnableMapMode( bool bEnable )
590{
591 mbMap = bEnable;
592
593 if( mpAlphaVDev )
594 mpAlphaVDev->EnableMapMode( bEnable );
595}
596
598{
599
600 if ( mpMetaFile )
602
603 if ( mbMap || !maMapMode.IsDefault() )
604 {
605 mbMap = false;
606 maMapMode = MapMode();
607
608 // create new objects (clip region are not re-scaled)
609 mbNewFont = true;
610 mbInitFont = true;
612
613 // #106426# Adapt logical offset when changing mapmode
614 mnOutOffLogicX = mnOutOffOrigX; // no mapping -> equal offsets
616
617 // #i75163#
619 }
620
621 if( mpAlphaVDev )
623}
624
625void OutputDevice::SetMapMode( const MapMode& rNewMapMode )
626{
627
628 bool bRelMap = (rNewMapMode.GetMapUnit() == MapUnit::MapRelative);
629
630 if ( mpMetaFile )
631 {
632 mpMetaFile->AddAction( new MetaMapModeAction( rNewMapMode ) );
633 }
634
635 // do nothing if MapMode was not changed
636 if ( maMapMode == rNewMapMode )
637 return;
638
639 if( mpAlphaVDev )
640 mpAlphaVDev->SetMapMode( rNewMapMode );
641
642 // if default MapMode calculate nothing
643 bool bOldMap = mbMap;
644 mbMap = !rNewMapMode.IsDefault();
645 if ( mbMap )
646 {
647 // if only the origin is converted, do not scale new
648 if ( (rNewMapMode.GetMapUnit() == maMapMode.GetMapUnit()) &&
649 (rNewMapMode.GetScaleX() == maMapMode.GetScaleX()) &&
650 (rNewMapMode.GetScaleY() == maMapMode.GetScaleY()) &&
651 (bOldMap == mbMap) )
652 {
653 // set offset
654 Point aOrigin = rNewMapMode.GetOrigin();
655 maMapRes.mnMapOfsX = aOrigin.X();
656 maMapRes.mnMapOfsY = aOrigin.Y();
657 maMapMode = rNewMapMode;
658
659 // #i75163#
661
662 return;
663 }
664 if ( !bOldMap && bRelMap )
665 {
672 }
673
674 // calculate new MapMode-resolution
676 }
677
678 // set new MapMode
679 if (bRelMap)
680 {
684
688
690 }
691 else
692 {
693 maMapMode = rNewMapMode;
694 }
695
696 // create new objects (clip region are not re-scaled)
697 mbNewFont = true;
698 mbInitFont = true;
700
701 // #106426# Adapt logical offset when changing mapmode
706
707 // #i75163#
709}
710
711void OutputDevice::SetMetafileMapMode(const MapMode& rNewMapMode, bool bIsRecord)
712{
713 if (bIsRecord)
714 SetRelativeMapMode(rNewMapMode);
715 else
716 SetMapMode(rNewMapMode);
717}
718
720
722{
723 // do nothing if MapMode did not change
724 if ( maMapMode == rNewMapMode )
725 return;
726
728 MapUnit eNew = rNewMapMode.GetMapUnit();
729
730 // a?F = rNewMapMode.GetScale?() / maMapMode.GetScale?()
733 rNewMapMode.GetScaleX().GetDenominator(),
737 rNewMapMode.GetScaleY().GetDenominator(),
739
740 Point aPt( LogicToLogic( Point(), nullptr, &rNewMapMode ) );
741 if ( eNew != eOld )
742 {
743 if ( eOld > MapUnit::MapPixel )
744 {
745 SAL_WARN( "vcl.gdi", "Not implemented MapUnit" );
746 }
747 else if ( eNew > MapUnit::MapPixel )
748 {
749 SAL_WARN( "vcl.gdi", "Not implemented MapUnit" );
750 }
751 else
752 {
753 const auto eFrom = MapToO3tlLength(eOld, o3tl::Length::in);
754 const auto eTo = MapToO3tlLength(eNew, o3tl::Length::in);
755 const auto& [mul, div] = o3tl::getConversionMulDiv(eFrom, eTo);
756 Fraction aF(div, mul);
757
758 // a?F = a?F * aF
760 aXF.GetDenominator(), aF.GetDenominator() );
762 aYF.GetDenominator(), aF.GetDenominator() );
763 if ( eOld == MapUnit::MapPixel )
764 {
765 aXF *= Fraction( mnDPIX, 1 );
766 aYF *= Fraction( mnDPIY, 1 );
767 }
768 else if ( eNew == MapUnit::MapPixel )
769 {
770 aXF *= Fraction( 1, mnDPIX );
771 aYF *= Fraction( 1, mnDPIY );
772 }
773 }
774 }
775
776 MapMode aNewMapMode( MapUnit::MapRelative, Point( -aPt.X(), -aPt.Y() ), aXF, aYF );
777 SetMapMode( aNewMapMode );
778
779 if ( eNew != eOld )
780 maMapMode = rNewMapMode;
781
782 // #106426# Adapt logical offset when changing MapMode
787
788 if( mpAlphaVDev )
789 mpAlphaVDev->SetRelativeMapMode( rNewMapMode );
790}
791
792// #i75163#
794{
795 if(mbMap && mpOutDevData)
796 {
797 if(!mpOutDevData->mpViewTransform)
798 {
799 mpOutDevData->mpViewTransform = new basegfx::B2DHomMatrix;
800
801 const double fScaleFactorX(static_cast<double>(mnDPIX) * static_cast<double>(maMapRes.mnMapScNumX) / static_cast<double>(maMapRes.mnMapScDenomX));
802 const double fScaleFactorY(static_cast<double>(mnDPIY) * static_cast<double>(maMapRes.mnMapScNumY) / static_cast<double>(maMapRes.mnMapScDenomY));
803 const double fZeroPointX((static_cast<double>(maMapRes.mnMapOfsX) * fScaleFactorX) + static_cast<double>(mnOutOffOrigX));
804 const double fZeroPointY((static_cast<double>(maMapRes.mnMapOfsY) * fScaleFactorY) + static_cast<double>(mnOutOffOrigY));
805
806 mpOutDevData->mpViewTransform->set(0, 0, fScaleFactorX);
807 mpOutDevData->mpViewTransform->set(1, 1, fScaleFactorY);
808 mpOutDevData->mpViewTransform->set(0, 2, fZeroPointX);
809 mpOutDevData->mpViewTransform->set(1, 2, fZeroPointY);
810 }
811
812 return *mpOutDevData->mpViewTransform;
813 }
814 else
815 {
816 return basegfx::B2DHomMatrix();
817 }
818}
819
820// #i75163#
822{
823 if(mbMap && mpOutDevData)
824 {
825 if(!mpOutDevData->mpInverseViewTransform)
826 {
828 mpOutDevData->mpInverseViewTransform = new basegfx::B2DHomMatrix(*mpOutDevData->mpViewTransform);
829 mpOutDevData->mpInverseViewTransform->invert();
830 }
831
832 return *mpOutDevData->mpInverseViewTransform;
833 }
834 else
835 {
836 return basegfx::B2DHomMatrix();
837 }
838}
839
840// #i75163#
842{
843 // #i82615#
844 ImplMapRes aMapRes;
845 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
846
847 basegfx::B2DHomMatrix aTransform;
848
849 const double fScaleFactorX(static_cast<double>(mnDPIX) * static_cast<double>(aMapRes.mnMapScNumX) / static_cast<double>(aMapRes.mnMapScDenomX));
850 const double fScaleFactorY(static_cast<double>(mnDPIY) * static_cast<double>(aMapRes.mnMapScNumY) / static_cast<double>(aMapRes.mnMapScDenomY));
851 const double fZeroPointX((static_cast<double>(aMapRes.mnMapOfsX) * fScaleFactorX) + static_cast<double>(mnOutOffOrigX));
852 const double fZeroPointY((static_cast<double>(aMapRes.mnMapOfsY) * fScaleFactorY) + static_cast<double>(mnOutOffOrigY));
853
854 aTransform.set(0, 0, fScaleFactorX);
855 aTransform.set(1, 1, fScaleFactorY);
856 aTransform.set(0, 2, fZeroPointX);
857 aTransform.set(1, 2, fZeroPointY);
858
859 return aTransform;
860}
861
862// #i75163#
864{
865 basegfx::B2DHomMatrix aMatrix( GetViewTransformation( rMapMode ) );
866 aMatrix.invert();
867 return aMatrix;
868}
869
871{
873 // TODO: is it worth to cache the transformed result?
874 if( mnOutOffX || mnOutOffY )
875 aTransformation.translate( mnOutOffX, mnOutOffY );
876 return aTransformation;
877}
878
879Point OutputDevice::LogicToPixel( const Point& rLogicPt ) const
880{
881
882 if ( !mbMap )
883 return rLogicPt;
884
885 return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
889}
890
891Size OutputDevice::LogicToPixel( const Size& rLogicSize ) const
892{
893
894 if ( !mbMap )
895 return rLogicSize;
896
897 return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
899 ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
901}
902
904{
905 // tdf#141761 see comments above, IsEmpty() removed
906 if ( !mbMap )
907 return rLogicRect;
908
909 tools::Rectangle aRetval(
914
915 if(rLogicRect.IsWidthEmpty())
916 aRetval.SetWidthEmpty();
917
918 if(rLogicRect.IsHeightEmpty())
919 aRetval.SetHeightEmpty();
920
921 return aRetval;
922}
923
925{
926
927 if ( !mbMap )
928 return rLogicPoly;
929
930 sal_uInt16 i;
931 sal_uInt16 nPoints = rLogicPoly.GetSize();
932 tools::Polygon aPoly( rLogicPoly );
933
934 // get pointer to Point-array (copy data)
935 const Point* pPointAry = aPoly.GetConstPointAry();
936
937 for ( i = 0; i < nPoints; i++ )
938 {
939 const Point* pPt = &(pPointAry[i]);
940 Point aPt;
945 aPoly[i] = aPt;
946 }
947
948 return aPoly;
949}
950
952{
953
954 if ( !mbMap )
955 return rLogicPolyPoly;
956
957 tools::PolyPolygon aPolyPoly( rLogicPolyPoly );
958 sal_uInt16 nPoly = aPolyPoly.Count();
959 for( sal_uInt16 i = 0; i < nPoly; i++ )
960 {
961 tools::Polygon& rPoly = aPolyPoly[i];
962 rPoly = LogicToPixel( rPoly );
963 }
964 return aPolyPoly;
965}
966
968{
969 basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly;
970 const basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation();
971 aTransformedPoly.transform( rTransformationMatrix );
972 return aTransformedPoly;
973}
974
976{
977
978 if(!mbMap || rLogicRegion.IsNull() || rLogicRegion.IsEmpty())
979 {
980 return rLogicRegion;
981 }
982
983 vcl::Region aRegion;
984
985 if(rLogicRegion.getB2DPolyPolygon())
986 {
987 aRegion = vcl::Region(LogicToPixel(*rLogicRegion.getB2DPolyPolygon()));
988 }
989 else if(rLogicRegion.getPolyPolygon())
990 {
991 aRegion = vcl::Region(LogicToPixel(*rLogicRegion.getPolyPolygon()));
992 }
993 else if(rLogicRegion.getRegionBand())
994 {
995 RectangleVector aRectangles;
996 rLogicRegion.GetRegionRectangles(aRectangles);
997 const RectangleVector& rRectangles(aRectangles); // needed to make the '!=' work
998
999 // make reverse run to fill new region bottom-up, this will speed it up due to the used data structuring
1000 for(RectangleVector::const_reverse_iterator aRectIter(rRectangles.rbegin()); aRectIter != rRectangles.rend(); ++aRectIter)
1001 {
1002 aRegion.Union(LogicToPixel(*aRectIter));
1003 }
1004 }
1005
1006 return aRegion;
1007}
1008
1010 const MapMode& rMapMode ) const
1011{
1012
1013 if ( rMapMode.IsDefault() )
1014 return rLogicPt;
1015
1016 // convert MapMode resolution and convert
1017 ImplMapRes aMapRes;
1018 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1019
1020 return Point( ImplLogicToPixel( rLogicPt.X() + aMapRes.mnMapOfsX, mnDPIX,
1021 aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX,
1022 ImplLogicToPixel( rLogicPt.Y() + aMapRes.mnMapOfsY, mnDPIY,
1023 aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY );
1024}
1025
1027 const MapMode& rMapMode ) const
1028{
1029
1030 if ( rMapMode.IsDefault() )
1031 return rLogicSize;
1032
1033 // convert MapMode resolution and convert
1034 ImplMapRes aMapRes;
1035 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1036
1037 return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
1038 aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ),
1039 ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
1040 aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) );
1041}
1042
1044 const MapMode& rMapMode ) const
1045{
1046 // tdf#141761 see comments above, IsEmpty() removed
1047 if ( rMapMode.IsDefault() )
1048 return rLogicRect;
1049
1050 // convert MapMode resolution and convert
1051 ImplMapRes aMapRes;
1052 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1053
1054 tools::Rectangle aRetval(
1055 ImplLogicToPixel( rLogicRect.Left() + aMapRes.mnMapOfsX, mnDPIX, aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX,
1056 ImplLogicToPixel( rLogicRect.Top() + aMapRes.mnMapOfsY, mnDPIY, aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY,
1057 rLogicRect.IsWidthEmpty() ? 0 : ImplLogicToPixel( rLogicRect.Right() + aMapRes.mnMapOfsX, mnDPIX, aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX,
1058 rLogicRect.IsHeightEmpty() ? 0 : ImplLogicToPixel( rLogicRect.Bottom() + aMapRes.mnMapOfsY, mnDPIY, aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY );
1059
1060 if(rLogicRect.IsWidthEmpty())
1061 aRetval.SetWidthEmpty();
1062
1063 if(rLogicRect.IsHeightEmpty())
1064 aRetval.SetHeightEmpty();
1065
1066 return aRetval;
1067}
1068
1070 const MapMode& rMapMode ) const
1071{
1072
1073 if ( rMapMode.IsDefault() )
1074 return rLogicPoly;
1075
1076 // convert MapMode resolution and convert
1077 ImplMapRes aMapRes;
1078 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1079
1080 sal_uInt16 i;
1081 sal_uInt16 nPoints = rLogicPoly.GetSize();
1082 tools::Polygon aPoly( rLogicPoly );
1083
1084 // get pointer to Point-array (copy data)
1085 const Point* pPointAry = aPoly.GetConstPointAry();
1086
1087 for ( i = 0; i < nPoints; i++ )
1088 {
1089 const Point* pPt = &(pPointAry[i]);
1090 Point aPt;
1091 aPt.setX( ImplLogicToPixel( pPt->X() + aMapRes.mnMapOfsX, mnDPIX,
1092 aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX )+mnOutOffOrigX );
1093 aPt.setY( ImplLogicToPixel( pPt->Y() + aMapRes.mnMapOfsY, mnDPIY,
1094 aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY )+mnOutOffOrigY );
1095 aPoly[i] = aPt;
1096 }
1097
1098 return aPoly;
1099}
1100
1102 const MapMode& rMapMode ) const
1103{
1104 basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly;
1105 const basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation( rMapMode );
1106 aTransformedPoly.transform( rTransformationMatrix );
1107 return aTransformedPoly;
1108}
1109
1110Point OutputDevice::PixelToLogic( const Point& rDevicePt ) const
1111{
1112
1113 if ( !mbMap )
1114 return rDevicePt;
1115
1116 return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
1118 ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
1120}
1121
1123{
1124 if (!mbMap)
1125 {
1126 assert(floor(rDevicePt.getX() == rDevicePt.getX()) && floor(rDevicePt.getY() == rDevicePt.getY()));
1127 return Point(rDevicePt.getX(), rDevicePt.getY());
1128 }
1129
1130 return Point(ImplSubPixelToLogic(rDevicePt.getX(), mnDPIX,
1132 ImplSubPixelToLogic(rDevicePt.getY(), mnDPIY,
1134}
1135
1136Size OutputDevice::PixelToLogic( const Size& rDeviceSize ) const
1137{
1138
1139 if ( !mbMap )
1140 return rDeviceSize;
1141
1142 return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
1144 ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
1146}
1147
1149{
1150 // tdf#141761 see comments above, IsEmpty() removed
1151 if ( !mbMap )
1152 return rDeviceRect;
1153
1154 tools::Rectangle aRetval(
1159
1160 if(rDeviceRect.IsWidthEmpty())
1161 aRetval.SetWidthEmpty();
1162
1163 if(rDeviceRect.IsHeightEmpty())
1164 aRetval.SetHeightEmpty();
1165
1166 return aRetval;
1167}
1168
1170{
1171
1172 if ( !mbMap )
1173 return rDevicePoly;
1174
1175 sal_uInt16 i;
1176 sal_uInt16 nPoints = rDevicePoly.GetSize();
1177 tools::Polygon aPoly( rDevicePoly );
1178
1179 // get pointer to Point-array (copy data)
1180 const Point* pPointAry = aPoly.GetConstPointAry();
1181
1182 for ( i = 0; i < nPoints; i++ )
1183 {
1184 const Point* pPt = &(pPointAry[i]);
1185 Point aPt;
1186 aPt.setX( ImplPixelToLogic( pPt->X(), mnDPIX,
1188 aPt.setY( ImplPixelToLogic( pPt->Y(), mnDPIY,
1190 aPoly[i] = aPt;
1191 }
1192
1193 return aPoly;
1194}
1195
1197{
1198
1199 if ( !mbMap )
1200 return rDevicePolyPoly;
1201
1202 tools::PolyPolygon aPolyPoly( rDevicePolyPoly );
1203 sal_uInt16 nPoly = aPolyPoly.Count();
1204 for( sal_uInt16 i = 0; i < nPoly; i++ )
1205 {
1206 tools::Polygon& rPoly = aPolyPoly[i];
1207 rPoly = PixelToLogic( rPoly );
1208 }
1209 return aPolyPoly;
1210}
1211
1213{
1214 basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly;
1215 const basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation();
1216 aTransformedPoly.transform( rTransformationMatrix );
1217 return aTransformedPoly;
1218}
1219
1221{
1222
1223 if(!mbMap || rDeviceRegion.IsNull() || rDeviceRegion.IsEmpty())
1224 {
1225 return rDeviceRegion;
1226 }
1227
1228 vcl::Region aRegion;
1229
1230 if(rDeviceRegion.getB2DPolyPolygon())
1231 {
1232 aRegion = vcl::Region(PixelToLogic(*rDeviceRegion.getB2DPolyPolygon()));
1233 }
1234 else if(rDeviceRegion.getPolyPolygon())
1235 {
1236 aRegion = vcl::Region(PixelToLogic(*rDeviceRegion.getPolyPolygon()));
1237 }
1238 else if(rDeviceRegion.getRegionBand())
1239 {
1240 RectangleVector aRectangles;
1241 rDeviceRegion.GetRegionRectangles(aRectangles);
1242 const RectangleVector& rRectangles(aRectangles); // needed to make the '!=' work
1243
1244 // make reverse run to fill new region bottom-up, this will speed it up due to the used data structuring
1245 for(RectangleVector::const_reverse_iterator aRectIter(rRectangles.rbegin()); aRectIter != rRectangles.rend(); ++aRectIter)
1246 {
1247 aRegion.Union(PixelToLogic(*aRectIter));
1248 }
1249 }
1250
1251 return aRegion;
1252}
1253
1255 const MapMode& rMapMode ) const
1256{
1257
1258 // calculate nothing if default-MapMode
1259 if ( rMapMode.IsDefault() )
1260 return rDevicePt;
1261
1262 // calculate MapMode-resolution and convert
1263 ImplMapRes aMapRes;
1264 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1265
1266 return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
1267 aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1268 ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
1269 aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1270}
1271
1273 const MapMode& rMapMode ) const
1274{
1275
1276 // calculate nothing if default-MapMode
1277 if ( rMapMode.IsDefault() )
1278 return rDeviceSize;
1279
1280 // calculate MapMode-resolution and convert
1281 ImplMapRes aMapRes;
1282 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1283
1284 return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
1285 aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ),
1286 ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
1287 aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) );
1288}
1289
1291 const MapMode& rMapMode ) const
1292{
1293 // calculate nothing if default-MapMode
1294 // tdf#141761 see comments above, IsEmpty() removed
1295 if ( rMapMode.IsDefault() )
1296 return rDeviceRect;
1297
1298 // calculate MapMode-resolution and convert
1299 ImplMapRes aMapRes;
1300 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1301
1302 tools::Rectangle aRetval(
1303 ImplPixelToLogic( rDeviceRect.Left(), mnDPIX, aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1304 ImplPixelToLogic( rDeviceRect.Top(), mnDPIY, aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY,
1305 rDeviceRect.IsWidthEmpty() ? 0 : ImplPixelToLogic( rDeviceRect.Right(), mnDPIX, aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX,
1306 rDeviceRect.IsHeightEmpty() ? 0 : ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY, aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1307
1308 if(rDeviceRect.IsWidthEmpty())
1309 aRetval.SetWidthEmpty();
1310
1311 if(rDeviceRect.IsHeightEmpty())
1312 aRetval.SetHeightEmpty();
1313
1314 return aRetval;
1315}
1316
1318 const MapMode& rMapMode ) const
1319{
1320
1321 // calculate nothing if default-MapMode
1322 if ( rMapMode.IsDefault() )
1323 return rDevicePoly;
1324
1325 // calculate MapMode-resolution and convert
1326 ImplMapRes aMapRes;
1327 ImplCalcMapResolution(rMapMode, mnDPIX, mnDPIY, aMapRes);
1328
1329 sal_uInt16 i;
1330 sal_uInt16 nPoints = rDevicePoly.GetSize();
1331 tools::Polygon aPoly( rDevicePoly );
1332
1333 // get pointer to Point-array (copy data)
1334 const Point* pPointAry = aPoly.GetConstPointAry();
1335
1336 for ( i = 0; i < nPoints; i++ )
1337 {
1338 const Point* pPt = &(pPointAry[i]);
1339 Point aPt;
1340 aPt.setX( ImplPixelToLogic( pPt->X(), mnDPIX,
1341 aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX ) - aMapRes.mnMapOfsX - mnOutOffLogicX );
1342 aPt.setY( ImplPixelToLogic( pPt->Y(), mnDPIY,
1343 aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY ) - aMapRes.mnMapOfsY - mnOutOffLogicY );
1344 aPoly[i] = aPt;
1345 }
1346
1347 return aPoly;
1348}
1349
1351 const MapMode& rMapMode ) const
1352{
1353 basegfx::B2DPolygon aTransformedPoly = rPixelPoly;
1354 const basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode );
1355 aTransformedPoly.transform( rTransformationMatrix );
1356 return aTransformedPoly;
1357}
1358
1360 const MapMode& rMapMode ) const
1361{
1362 basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly;
1363 const basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode );
1364 aTransformedPoly.transform( rTransformationMatrix );
1365 return aTransformedPoly;
1366}
1367
1368#define ENTER1( rSource, pMapModeSource, pMapModeDest ) \
1369 if ( !pMapModeSource ) \
1370 pMapModeSource = &maMapMode; \
1371 if ( !pMapModeDest ) \
1372 pMapModeDest = &maMapMode; \
1373 if ( *pMapModeSource == *pMapModeDest ) \
1374 return rSource; \
1375 \
1376 ImplMapRes aMapResSource; \
1377 ImplMapRes aMapResDest; \
1378 \
1379 if ( !mbMap || pMapModeSource != &maMapMode ) \
1380 { \
1381 if ( pMapModeSource->GetMapUnit() == MapUnit::MapRelative ) \
1382 aMapResSource = maMapRes; \
1383 ImplCalcMapResolution( *pMapModeSource, \
1384 mnDPIX, mnDPIY, aMapResSource ); \
1385 } \
1386 else \
1387 aMapResSource = maMapRes; \
1388 if ( !mbMap || pMapModeDest != &maMapMode ) \
1389 { \
1390 if ( pMapModeDest->GetMapUnit() == MapUnit::MapRelative ) \
1391 aMapResDest = maMapRes; \
1392 ImplCalcMapResolution( *pMapModeDest, \
1393 mnDPIX, mnDPIY, aMapResDest ); \
1394 } \
1395 else \
1396 aMapResDest = maMapRes
1397
1398static void verifyUnitSourceDest( MapUnit eUnitSource, MapUnit eUnitDest )
1399{
1400 DBG_ASSERT( eUnitSource != MapUnit::MapSysFont
1401 && eUnitSource != MapUnit::MapAppFont
1402 && eUnitSource != MapUnit::MapRelative,
1403 "Source MapUnit is not permitted" );
1404 DBG_ASSERT( eUnitDest != MapUnit::MapSysFont
1405 && eUnitDest != MapUnit::MapAppFont
1406 && eUnitDest != MapUnit::MapRelative,
1407 "Destination MapUnit is not permitted" );
1408}
1409
1410namespace
1411{
1412auto getCorrectedUnit(MapUnit eMapSrc, MapUnit eMapDst)
1413{
1416 if (eMapSrc > MapUnit::MapPixel)
1417 SAL_WARN("vcl.gdi", "Invalid source map unit");
1418 else if (eMapDst > MapUnit::MapPixel)
1419 SAL_WARN("vcl.gdi", "Invalid destination map unit");
1420 else if (eMapSrc != eMapDst)
1421 {
1422 // Here 72 PPI is assumed for MapPixel
1423 eSrc = MapToO3tlLength(eMapSrc, o3tl::Length::pt);
1424 eDst = MapToO3tlLength(eMapDst, o3tl::Length::pt);
1425 }
1426 return std::make_pair(eSrc, eDst);
1427}
1428
1429std::pair<ImplMapRes, ImplMapRes> ENTER4(const MapMode& rMMSource, const MapMode& rMMDest)
1430{
1431 std::pair<ImplMapRes, ImplMapRes> result;
1432 ImplCalcMapResolution(rMMSource, 72, 72, result.first);
1433 ImplCalcMapResolution(rMMDest, 72, 72, result.second);
1434 return result;
1435}
1436}
1437
1438// return (n1 * n2 * n3) / (n4 * n5)
1439static tools::Long fn5( const tools::Long n1,
1440 const tools::Long n2,
1441 const tools::Long n3,
1442 const tools::Long n4,
1443 const tools::Long n5 )
1444{
1445 if ( n1 == 0 || n2 == 0 || n3 == 0 || n4 == 0 || n5 == 0 )
1446 return 0;
1447 if (std::numeric_limits<tools::Long>::max() / std::abs(n2) < std::abs(n3))
1448 {
1449 // a6 is skipped
1450 BigInt a7 = n2;
1451 a7 *= n3;
1452 a7 *= n1;
1453
1454 if (std::numeric_limits<tools::Long>::max() / std::abs(n4) < std::abs(n5))
1455 {
1456 BigInt a8 = n4;
1457 a8 *= n5;
1458
1459 BigInt a9 = a8;
1460 a9 /= 2;
1461 if ( a7.IsNeg() )
1462 a7 -= a9;
1463 else
1464 a7 += a9;
1465
1466 a7 /= a8;
1467 } // of if
1468 else
1469 {
1470 tools::Long n8 = n4 * n5;
1471
1472 if ( a7.IsNeg() )
1473 a7 -= n8 / 2;
1474 else
1475 a7 += n8 / 2;
1476
1477 a7 /= n8;
1478 } // of else
1479 return static_cast<tools::Long>(a7);
1480 } // of if
1481 else
1482 {
1483 tools::Long n6 = n2 * n3;
1484
1485 if (std::numeric_limits<tools::Long>::max() / std::abs(n1) < std::abs(n6))
1486 {
1487 BigInt a7 = n1;
1488 a7 *= n6;
1489
1490 if (std::numeric_limits<tools::Long>::max() / std::abs(n4) < std::abs(n5))
1491 {
1492 BigInt a8 = n4;
1493 a8 *= n5;
1494
1495 BigInt a9 = a8;
1496 a9 /= 2;
1497 if ( a7.IsNeg() )
1498 a7 -= a9;
1499 else
1500 a7 += a9;
1501
1502 a7 /= a8;
1503 } // of if
1504 else
1505 {
1506 tools::Long n8 = n4 * n5;
1507
1508 if ( a7.IsNeg() )
1509 a7 -= n8 / 2;
1510 else
1511 a7 += n8 / 2;
1512
1513 a7 /= n8;
1514 } // of else
1515 return static_cast<tools::Long>(a7);
1516 } // of if
1517 else
1518 {
1519 tools::Long n7 = n1 * n6;
1520
1521 if (std::numeric_limits<tools::Long>::max() / std::abs(n4) < std::abs(n5))
1522 {
1523 BigInt a7 = n7;
1524 BigInt a8 = n4;
1525 a8 *= n5;
1526
1527 BigInt a9 = a8;
1528 a9 /= 2;
1529 if ( a7.IsNeg() )
1530 a7 -= a9;
1531 else
1532 a7 += a9;
1533
1534 a7 /= a8;
1535 return static_cast<tools::Long>(a7);
1536 } // of if
1537 else
1538 {
1539 const tools::Long n8 = n4 * n5;
1540 const tools::Long n8_2 = n8 / 2;
1541
1542 if( n7 < 0 )
1543 {
1544 if ((n7 - std::numeric_limits<tools::Long>::min()) >= n8_2)
1545 n7 -= n8_2;
1546 }
1547 else if ((std::numeric_limits<tools::Long>::max() - n7) >= n8_2)
1548 n7 += n8_2;
1549
1550 return n7 / n8;
1551 } // of else
1552 } // of else
1553 } // of else
1554}
1555
1556static tools::Long fn3(const tools::Long n1, const o3tl::Length eFrom, const o3tl::Length eTo)
1557{
1558 if (n1 == 0 || eFrom == o3tl::Length::invalid || eTo == o3tl::Length::invalid)
1559 return 0;
1560 bool bOverflow;
1561 const auto nResult = o3tl::convert(n1, eFrom, eTo, bOverflow);
1562 if (bOverflow)
1563 {
1564 const auto& [n2, n3] = o3tl::getConversionMulDiv(eFrom, eTo);
1565 BigInt a4 = n1;
1566 a4 *= n2;
1567
1568 if ( a4.IsNeg() )
1569 a4 -= n3 / 2;
1570 else
1571 a4 += n3 / 2;
1572
1573 a4 /= n3;
1574 return static_cast<tools::Long>(a4);
1575 } // of if
1576 else
1577 return nResult;
1578}
1579
1581 const MapMode* pMapModeSource,
1582 const MapMode* pMapModeDest ) const
1583{
1584 ENTER1( rPtSource, pMapModeSource, pMapModeDest );
1585
1586 return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
1587 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1588 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1589 aMapResDest.mnMapOfsX,
1590 fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
1591 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1592 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1593 aMapResDest.mnMapOfsY );
1594}
1595
1597 const MapMode* pMapModeSource,
1598 const MapMode* pMapModeDest ) const
1599{
1600 ENTER1( rSzSource, pMapModeSource, pMapModeDest );
1601
1602 return Size( fn5( rSzSource.Width(),
1603 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1604 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
1605 fn5( rSzSource.Height(),
1606 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1607 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
1608}
1609
1611 const MapMode* pMapModeSource,
1612 const MapMode* pMapModeDest ) const
1613{
1614 ENTER1( rRectSource, pMapModeSource, pMapModeDest );
1615
1616 return tools::Rectangle( fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
1617 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1618 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1619 aMapResDest.mnMapOfsX,
1620 fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
1621 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1622 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1623 aMapResDest.mnMapOfsY,
1624 fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
1625 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1626 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1627 aMapResDest.mnMapOfsX,
1628 fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
1629 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1630 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1631 aMapResDest.mnMapOfsY );
1632}
1633
1635 const MapMode& rMapModeSource,
1636 const MapMode& rMapModeDest )
1637{
1638 if ( rMapModeSource == rMapModeDest )
1639 return rPtSource;
1640
1641 MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1642 MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1643 verifyUnitSourceDest( eUnitSource, eUnitDest );
1644
1645 if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1646 {
1647 const auto& [eFrom, eTo] = getCorrectedUnit(eUnitSource, eUnitDest);
1648 return Point(fn3(rPtSource.X(), eFrom, eTo), fn3(rPtSource.Y(), eFrom, eTo));
1649 }
1650 else
1651 {
1652 const auto& [aMapResSource, aMapResDest] = ENTER4( rMapModeSource, rMapModeDest );
1653
1654 return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
1655 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1656 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1657 aMapResDest.mnMapOfsX,
1658 fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
1659 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1660 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1661 aMapResDest.mnMapOfsY );
1662 }
1663}
1664
1666 const MapMode& rMapModeSource,
1667 const MapMode& rMapModeDest )
1668{
1669 if ( rMapModeSource == rMapModeDest )
1670 return rSzSource;
1671
1672 MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1673 MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1674 verifyUnitSourceDest( eUnitSource, eUnitDest );
1675
1676 if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1677 {
1678 const auto& [eFrom, eTo] = getCorrectedUnit(eUnitSource, eUnitDest);
1679 return Size(fn3(rSzSource.Width(), eFrom, eTo), fn3(rSzSource.Height(), eFrom, eTo));
1680 }
1681 else
1682 {
1683 const auto& [aMapResSource, aMapResDest] = ENTER4( rMapModeSource, rMapModeDest );
1684
1685 return Size( fn5( rSzSource.Width(),
1686 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1687 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
1688 fn5( rSzSource.Height(),
1689 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1690 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
1691 }
1692}
1693
1695 const MapMode& rMapModeSource,
1696 const MapMode& rMapModeDest )
1697{
1698 if(rMapModeSource == rMapModeDest)
1699 {
1700 return rPolySource;
1701 }
1702
1703 const basegfx::B2DHomMatrix aTransform(LogicToLogic(rMapModeSource, rMapModeDest));
1704 basegfx::B2DPolygon aPoly(rPolySource);
1705
1706 aPoly.transform(aTransform);
1707 return aPoly;
1708}
1709
1710basegfx::B2DHomMatrix OutputDevice::LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest)
1711{
1712 basegfx::B2DHomMatrix aTransform;
1713
1714 if(rMapModeSource == rMapModeDest)
1715 {
1716 return aTransform;
1717 }
1718
1719 MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1720 MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1721 verifyUnitSourceDest(eUnitSource, eUnitDest);
1722
1723 if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1724 {
1725 const auto& [eFrom, eTo] = getCorrectedUnit(eUnitSource, eUnitDest);
1726 const double fScaleFactor(eFrom == o3tl::Length::invalid || eTo == o3tl::Length::invalid
1727 ? std::numeric_limits<double>::quiet_NaN()
1728 : o3tl::convert(1.0, eFrom, eTo));
1729 aTransform.set(0, 0, fScaleFactor);
1730 aTransform.set(1, 1, fScaleFactor);
1731 }
1732 else
1733 {
1734 const auto& [aMapResSource, aMapResDest] = ENTER4(rMapModeSource, rMapModeDest);
1735
1736 const double fScaleFactorX((double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX)) / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX)));
1737 const double fScaleFactorY((double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY)) / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY)));
1738 const double fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX));
1739 const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY));
1740
1741 aTransform.set(0, 0, fScaleFactorX);
1742 aTransform.set(1, 1, fScaleFactorY);
1743 aTransform.set(0, 2, fZeroPointX);
1744 aTransform.set(1, 2, fZeroPointY);
1745 }
1746
1747 return aTransform;
1748}
1749
1751 const MapMode& rMapModeSource,
1752 const MapMode& rMapModeDest )
1753{
1754 if ( rMapModeSource == rMapModeDest )
1755 return rRectSource;
1756
1757 MapUnit eUnitSource = rMapModeSource.GetMapUnit();
1758 MapUnit eUnitDest = rMapModeDest.GetMapUnit();
1759 verifyUnitSourceDest( eUnitSource, eUnitDest );
1760
1761 tools::Rectangle aRetval;
1762
1763 if (rMapModeSource.IsSimple() && rMapModeDest.IsSimple())
1764 {
1765 const auto& [eFrom, eTo] = getCorrectedUnit(eUnitSource, eUnitDest);
1766
1767 auto left = fn3(rRectSource.Left(), eFrom, eTo);
1768 auto top = fn3(rRectSource.Top(), eFrom, eTo);
1769
1770 // tdf#141761 see comments above, IsEmpty() removed
1771 auto right = rRectSource.IsWidthEmpty() ? 0 : fn3(rRectSource.Right(), eFrom, eTo);
1772 auto bottom = rRectSource.IsHeightEmpty() ? 0 : fn3(rRectSource.Bottom(), eFrom, eTo);
1773
1774 aRetval = tools::Rectangle(left, top, right, bottom);
1775 }
1776 else
1777 {
1778 const auto& [aMapResSource, aMapResDest] = ENTER4( rMapModeSource, rMapModeDest );
1779
1780 auto left = fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
1781 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1782 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1783 aMapResDest.mnMapOfsX;
1784 auto top = fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
1785 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1786 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1787 aMapResDest.mnMapOfsY;
1788
1789 // tdf#141761 see comments above, IsEmpty() removed
1790 auto right = rRectSource.IsWidthEmpty() ? 0 : fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
1791 aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
1792 aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
1793 aMapResDest.mnMapOfsX;
1794 auto bottom = rRectSource.IsHeightEmpty() ? 0 : fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
1795 aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
1796 aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
1797 aMapResDest.mnMapOfsY;
1798
1799 aRetval = tools::Rectangle(left, top, right, bottom);
1800 }
1801
1802 if(rRectSource.IsWidthEmpty())
1803 aRetval.SetWidthEmpty();
1804
1805 if(rRectSource.IsHeightEmpty())
1806 aRetval.SetHeightEmpty();
1807
1808 return aRetval;
1809}
1810
1812 MapUnit eUnitSource, MapUnit eUnitDest )
1813{
1814 if ( eUnitSource == eUnitDest )
1815 return nLongSource;
1816
1817 verifyUnitSourceDest( eUnitSource, eUnitDest );
1818 const auto& [eFrom, eTo] = getCorrectedUnit(eUnitSource, eUnitDest);
1819 return fn3(nLongSource, eFrom, eTo);
1820}
1821
1823{
1824 mnOutOffOrigX = rOffset.Width();
1825 mnOutOffOrigY = rOffset.Height();
1826
1831
1832 if( mpAlphaVDev )
1833 mpAlphaVDev->SetPixelOffset( rOffset );
1834}
1835
1836
1838{
1839 if (!mbMap)
1840 return nWidth;
1841
1842 return ImplLogicToSubPixel(nWidth, mnDPIX,
1844}
1845
1847{
1848 if (!mbMap)
1849 return nHeight;
1850
1851 return ImplLogicToSubPixel(nHeight, mnDPIY,
1853}
1854
1856{
1857 if (!mbMap)
1858 return basegfx::B2DPoint(rPoint.X() + mnOutOffX, rPoint.Y() + mnOutOffY);
1859
1866}
1867
1868/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr o3tl::Length MapToO3tlLength(MapUnit eU, o3tl::Length ePixelValue=o3tl::Length::px)
bool IsNeg() const
sal_Int32 GetNumerator() const
static Fraction MakeFraction(tools::Long nN1, tools::Long nN2, tools::Long nD1, tools::Long nD2)
sal_Int32 GetDenominator() const
void AddAction(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:585
void SetOrigin(const Point &rOrigin)
Definition: mapmod.cxx:138
void SetScaleY(const Fraction &rScaleY)
Definition: mapmod.cxx:150
const Fraction & GetScaleX() const
Definition: mapmod.cxx:185
MapUnit GetMapUnit() const
Definition: mapmod.cxx:181
bool IsSimple() const
Definition: mapmod.cxx:189
const Point & GetOrigin() const
Definition: mapmod.cxx:183
const Fraction & GetScaleY() const
Definition: mapmod.cxx:187
bool IsDefault() const
Definition: mapmod.cxx:165
void SetScaleX(const Fraction &rScaleX)
Definition: mapmod.cxx:144
ImplMapRes maMapRes
Definition: outdev.hxx:222
SAL_DLLPRIVATE basegfx::B2DPoint ImplLogicToDeviceSubPixel(const Point &rLogicPt) const
Definition: map.cxx:1855
SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel(tools::Long nY) const
Convert a logical Y coordinate to a device pixel's Y coordinate.
Definition: map.cxx:271
void EnableMapMode(bool bEnable=true)
Definition: map.cxx:589
basegfx::B2DHomMatrix GetViewTransformation() const
Definition: map.cxx:793
sal_Int32 mnDPIY
Definition: outdev.hxx:213
tools::Long mnOutOffY
Output offset for device output in pixel (pseudo window offset within window system's frames)
Definition: outdev.hxx:209
SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicHeight(tools::Long nHeight) const
Convert device pixels to a height in logical units.
Definition: map.cxx:304
virtual void SetMetafileMapMode(const MapMode &rNewMapMode, bool bIsRecord)
Definition: map.cxx:711
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:334
basegfx::B2DHomMatrix GetInverseViewTransformation() const
Definition: map.cxx:821
SAL_DLLPRIVATE double ImplLogicHeightToDeviceSubPixel(tools::Long nHeight) const
Definition: map.cxx:1846
tools::Long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames)
Definition: outdev.hxx:207
tools::Long mnOutOffLogicX
Additional output offset in logical coordinates, applied in PixelToLogic (used by SetPixelOffset/GetP...
Definition: outdev.hxx:201
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1110
std::unique_ptr< ImplOutDevData > mpOutDevData
Definition: outdev.hxx:189
MapMode maMapMode
Definition: outdev.hxx:235
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:185
bool mbMap
Definition: outdev.hxx:240
SAL_DLLPRIVATE tools::Long ImplLogicHeightToDevicePixel(tools::Long nHeight) const
Convert a logical height to a height in units of device pixels.
Definition: map.cxx:288
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: map.cxx:1580
void SetMapMode()
Definition: map.cxx:597
virtual void ImplInitMapModeObjects()
Definition: map.cxx:719
SAL_DLLPRIVATE Point SubPixelToLogic(const basegfx::B2DPoint &rDevicePt) const
Definition: map.cxx:1122
bool mbNewFont
Definition: outdev.hxx:254
SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel(tools::Long nWidth) const
Convert a logical width to a width in units of device pixels.
Definition: map.cxx:280
bool mbInitFont
Definition: outdev.hxx:250
void SetPixelOffset(const Size &rOffset)
Set an offset in pixel.
Definition: map.cxx:1822
SAL_DLLPRIVATE double ImplLogicWidthToDeviceSubPixel(tools::Long nWidth) const
Definition: map.cxx:1837
void SetRelativeMapMode(const MapMode &rNewMapMode)
Definition: map.cxx:721
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
SAL_DLLPRIVATE void ImplInvalidateViewTransform()
Invalidate the view transformation.
Definition: map.cxx:173
SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicWidth(tools::Long nWidth) const
Convert device pixels to a width in logical units.
Definition: map.cxx:296
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:548
tools::Long mnOutOffOrigX
Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
Definition: outdev.hxx:199
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:196
tools::Long mnOutOffOrigY
Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
Definition: outdev.hxx:203
SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const
Get device transformation.
Definition: map.cxx:870
tools::Long mnOutOffLogicY
Additional output offset in logical coordinates, applied in PixelToLogic (used by SetPixelOffset/GetP...
Definition: outdev.hxx:205
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:579
SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel(tools::Long nX) const
Convert a logical X coordinate to a device pixel's X coordinate.
Definition: map.cxx:262
sal_Int32 mnDPIX
Definition: outdev.hxx:212
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
A construction helper for ScopedVclPtr.
Definition: vclptr.hxx:409
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
void translate(double fX, double fY)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 count() const
TYPE getX() const
TYPE getY() const
sal_uInt16 Count() const
const Point * GetConstPointAry() const
sal_uInt16 GetSize() const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr bool IsWidthEmpty() const
constexpr bool IsHeightEmpty() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
Definition: region.cxx:401
bool IsNull() const
Definition: region.hxx:99
const RegionBand * getRegionBand() const
Definition: region.hxx:78
const std::optional< basegfx::B2DPolyPolygon > & getB2DPolyPolygon() const
Definition: region.hxx:76
bool IsEmpty() const
Definition: region.cxx:229
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:507
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1674
const std::optional< tools::PolyPolygon > & getPolyPolygon() const
Definition: region.hxx:77
static SAL_DLLPRIVATE void ImplInitAppFontData(vcl::Window const *pWindow)
Definition: window.cxx:1184
#define DBG_ASSERT(sCon, aError)
OString right
OString top
OString bottom
sal_Int64 n
#define SAL_WARN(area, stream)
#define ENTER1(rSource, pMapModeSource, pMapModeDest)
Definition: map.cxx:1368
static tools::Long ImplSubPixelToLogic(double n, tools::Long nDPI, tools::Long nMapNum, tools::Long nMapDenom)
Definition: map.cxx:228
static tools::Long ImplLogicToPixel(tools::Long n, tools::Long nDPI, tools::Long nMapNum, tools::Long nMapDenom)
Definition: map.cxx:191
static void verifyUnitSourceDest(MapUnit eUnitSource, MapUnit eUnitDest)
Definition: map.cxx:1398
static double ImplLogicToSubPixel(tools::Long n, tools::Long nDPI, tools::Long nMapNum, tools::Long nMapDenom)
Definition: map.cxx:220
static tools::Long fn3(const tools::Long n1, const o3tl::Length eFrom, const o3tl::Length eTo)
Definition: map.cxx:1556
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:1439
static tools::Long ImplPixelToLogic(tools::Long n, tools::Long nDPI, tools::Long nMapNum, tools::Long nMapDenom)
Definition: map.cxx:237
static void ImplCalcMapResolution(const MapMode &rMapMode, tools::Long nDPIX, tools::Long nDPIY, ImplMapRes &rMapRes)
Definition: map.cxx:47
static auto setMapRes(ImplMapRes &rMapRes, const o3tl::Length eUnit)
Definition: map.cxx:40
MapUnit
int n2
int n1
sal_uInt32 n4
sal_uInt32 n5
sal_uInt32 n6
sal_uInt32 n3
int i
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
double div(const double &fNumerator, const double &fDenominator)
long Long
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:34
tools::Long mnMapScDenomX
Scaling factor - denominator in X direction.
Definition: ImplMapRes.hxx:32
tools::Long mnMapScDenomY
Scaling factor - denominator in Y direction.
Definition: ImplMapRes.hxx:33
tools::Long mnMapScNumY
Scaling factor - numerator in Y direction.
Definition: ImplMapRes.hxx:31
tools::Long mnMapOfsY
Offset in Y direction.
Definition: ImplMapRes.hxx:29
tools::Long mnMapScNumX
Scaling factor - numerator in X direction.
Definition: ImplMapRes.hxx:30
tools::Long mnMapOfsX
Offset in X direction.
Definition: ImplMapRes.hxx:28
ImplSVFrameData maFrameData
Definition: svdata.hxx:399
ImplSVGDIData maGDIData
Definition: svdata.hxx:398
VclPtr< vcl::Window > mpFirstFrame
Definition: svdata.hxx:241
tools::Long mnAppFontY
Definition: svdata.hxx:231
tools::Long mnAppFontX
Definition: svdata.hxx:230
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:77
Any result
sal_uInt64 left