1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <sal/config.h>
25 #include <o3tl/cow_wrapper.hxx>
29 namespace drawinglayer::geometry
31 class ImpViewInformation2D
;
40 namespace com::sun::star::beans
45 namespace com::sun::star::drawing
50 namespace com::sun::star::uno
52 template <class interface_type
> class Reference
;
53 template <typename
> class Sequence
;
56 namespace drawinglayer::geometry
58 /** ViewInformation2D class
60 This class holds all view-relevant information for a 2d geometry.
61 The most used data is for convenience offered directly using basegfx tooling classes.
63 class DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
66 typedef o3tl::cow_wrapper
<ImpViewInformation2D
, o3tl::ThreadSafeRefCountingPolicy
> ImplType
;
69 /// pointer to private implementation class
70 ImplType mpViewInformation2D
;
73 /** Constructor: Create a ViewInformation2D
75 @param rObjectTransformation
76 The Transformation from Object to World coordinates (normally logic coordinates).
78 @param rViewTransformation
79 The Transformation from World to View coordinates (normally logic coordinates
80 to discrete units, e.g. pixels).
83 The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
84 everything is visible. The data is in World coordinates.
87 The currently displayed page. This information is needed e.g. due to existing PageNumber
88 fields which need to be interpreted.
91 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
94 @param bReducedDisplayQuality
95 Support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
96 is used e.g. to allow to lower display quality for OverlayPrimitives and
97 may lead to simpler decompositions in the local create2DDecomposition
98 implementations of the primitives
100 @param bUseAntiAliasing
101 Determine if to use AntiAliasing on target pixel device
103 @param bPixelSnapHairline
104 Determine if to use PixelSnapHairline on target pixel device
106 /// default (empty) constructor
110 ViewInformation2D(const ViewInformation2D
&);
112 ViewInformation2D(ViewInformation2D
&&);
115 ~ViewInformation2D();
117 /// assignment operator
118 ViewInformation2D
& operator=(const ViewInformation2D
&);
119 ViewInformation2D
& operator=(ViewInformation2D
&&);
121 /// compare operators
122 bool operator==(const ViewInformation2D
& rCandidate
) const;
123 bool operator!=(const ViewInformation2D
& rCandidate
) const { return !operator==(rCandidate
); }
126 const basegfx::B2DHomMatrix
& getObjectTransformation() const;
127 void setObjectTransformation(const basegfx::B2DHomMatrix
& rNew
);
129 const basegfx::B2DHomMatrix
& getViewTransformation() const;
130 void setViewTransformation(const basegfx::B2DHomMatrix
& rNew
);
132 /// Empty viewport means everything is visible.
133 const basegfx::B2DRange
& getViewport() const;
134 void setViewport(const basegfx::B2DRange
& rNew
);
136 double getViewTime() const;
137 void setViewTime(double fNew
);
139 const css::uno::Reference
<css::drawing::XDrawPage
>& getVisualizedPage() const;
140 void setVisualizedPage(const css::uno::Reference
<css::drawing::XDrawPage
>& rNew
);
142 /// On-demand prepared Object to View transformation and its inverse for convenience
143 const basegfx::B2DHomMatrix
& getObjectToViewTransformation() const;
144 const basegfx::B2DHomMatrix
& getInverseObjectToViewTransformation() const;
146 /// On-demand prepared Viewport in discrete units for convenience
147 /// Empty viewport means everything is visible.
148 const basegfx::B2DRange
& getDiscreteViewport() const;
150 /// Support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'.
151 bool getReducedDisplayQuality() const;
152 void setReducedDisplayQuality(bool bNew
);
154 /// Determine if to use AntiAliasing on target pixel device, PropertyName is 'UseAntiAliasing'
155 bool getUseAntiAliasing() const;
156 void setUseAntiAliasing(bool bNew
);
158 /// Determine if to use PixelSnapHairline on target pixel device, PropertyName is 'PixelSnapHairline'
159 bool getPixelSnapHairline() const;
160 void setPixelSnapHairline(bool bNew
);
162 static void setGlobalAntiAliasing(bool bAntiAliasing
, bool bTemporary
);
163 static bool getGlobalAntiAliasing();
164 static void forwardPixelSnapHairline(bool bPixelSnapHairline
);
167 DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
168 createViewInformation2D(const css::uno::Sequence
<css::beans::PropertyValue
>& rViewParameters
);
170 } // end of namespace drawinglayer::geometry
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */