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>
26 #include <tools/color.hxx>
30 namespace drawinglayer::geometry
32 class ImpViewInformation2D
;
41 namespace com::sun::star::beans
46 namespace com::sun::star::drawing
51 namespace com::sun::star::uno
53 template <class interface_type
> class Reference
;
54 template <typename
> class Sequence
;
57 namespace drawinglayer::geometry
59 /** ViewInformation2D class
61 This class holds all view-relevant information for a 2d geometry.
62 The most used data is for convenience offered directly using basegfx tooling classes.
64 class DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
67 typedef o3tl::cow_wrapper
<ImpViewInformation2D
, o3tl::ThreadSafeRefCountingPolicy
> ImplType
;
70 /// pointer to private implementation class
71 ImplType mpViewInformation2D
;
74 /** Constructor: Create a ViewInformation2D
76 @param rObjectTransformation
77 The Transformation from Object to World coordinates (normally logic coordinates).
79 @param rViewTransformation
80 The Transformation from World to View coordinates (normally logic coordinates
81 to discrete units, e.g. pixels).
84 The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
85 everything is visible. The data is in World coordinates.
88 The currently displayed page. This information is needed e.g. due to existing PageNumber
89 fields which need to be interpreted.
92 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
95 @param bReducedDisplayQuality
96 Support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
97 is used e.g. to allow to lower display quality for OverlayPrimitives and
98 may lead to simpler decompositions in the local create2DDecomposition
99 implementations of the primitives
101 @param bUseAntiAliasing
102 Determine if to use AntiAliasing on target pixel device
104 @param bPixelSnapHairline
105 Determine if to use PixelSnapHairline on target pixel device
107 /// default (empty) constructor
111 ViewInformation2D(const ViewInformation2D
&);
113 ViewInformation2D(ViewInformation2D
&&);
116 ~ViewInformation2D();
118 /// assignment operator
119 ViewInformation2D
& operator=(const ViewInformation2D
&);
120 ViewInformation2D
& operator=(ViewInformation2D
&&);
122 /// compare operators
123 bool operator==(const ViewInformation2D
& rCandidate
) const;
124 bool operator!=(const ViewInformation2D
& rCandidate
) const { return !operator==(rCandidate
); }
127 const basegfx::B2DHomMatrix
& getObjectTransformation() const;
128 void setObjectTransformation(const basegfx::B2DHomMatrix
& rNew
);
130 const basegfx::B2DHomMatrix
& getViewTransformation() const;
131 void setViewTransformation(const basegfx::B2DHomMatrix
& rNew
);
133 /// Empty viewport means everything is visible.
134 const basegfx::B2DRange
& getViewport() const;
135 void setViewport(const basegfx::B2DRange
& rNew
);
137 double getViewTime() const;
138 void setViewTime(double fNew
);
140 const css::uno::Reference
<css::drawing::XDrawPage
>& getVisualizedPage() const;
141 void setVisualizedPage(const css::uno::Reference
<css::drawing::XDrawPage
>& rNew
);
143 /// On-demand prepared Object to View transformation and its inverse for convenience
144 const basegfx::B2DHomMatrix
& getObjectToViewTransformation() const;
145 const basegfx::B2DHomMatrix
& getInverseObjectToViewTransformation() const;
147 /// On-demand prepared Viewport in discrete units for convenience
148 /// Empty viewport means everything is visible.
149 const basegfx::B2DRange
& getDiscreteViewport() const;
151 /// Support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'.
152 bool getReducedDisplayQuality() const;
153 void setReducedDisplayQuality(bool bNew
);
155 /// Determine if to use AntiAliasing on target pixel device, PropertyName is 'UseAntiAliasing'
156 bool getUseAntiAliasing() const;
157 void setUseAntiAliasing(bool bNew
);
159 /// Determine if to use PixelSnapHairline on target pixel device, PropertyName is 'PixelSnapHairline'
160 bool getPixelSnapHairline() const;
161 void setPixelSnapHairline(bool bNew
);
163 Color
getAutoColor() const;
164 void setAutoColor(Color aNew
);
166 /// claim that in the view processed a TextEdit is active
167 bool getTextEditActive() const;
168 void setTextEditActive(bool bNew
);
170 /// claim that the view processed is an EditView visualization
171 bool getEditViewActive() const;
172 void setEditViewActive(bool bNew
);
174 static void setGlobalAntiAliasing(bool bAntiAliasing
, bool bTemporary
);
175 static bool getGlobalAntiAliasing();
178 DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
179 createViewInformation2D(const css::uno::Sequence
<css::beans::PropertyValue
>& rViewParameters
);
181 } // end of namespace drawinglayer::geometry
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */