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