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. It works
61 together with UNO API definitions and supports holding a sequence of PropertyValues.
62 The most used data is for convenience offered directly using basegfx tooling classes.
63 It is an implementation to support the sequence of PropertyValues used in a
64 css::graphic::XPrimitive2D for C++ implementations working with those
66 class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
69 typedef o3tl::cow_wrapper
<ImpViewInformation2D
, o3tl::ThreadSafeRefCountingPolicy
> ImplType
;
72 /// pointer to private implementation class
73 ImplType mpViewInformation2D
;
76 /** Constructor: Create a ViewInformation2D
78 @param rObjectTransformation
79 The Transformation from Object to World coordinates (normally logic coordinates).
81 @param rViewTransformation
82 The Transformation from World to View coordinates (normally logic coordinates
83 to discrete units, e.g. pixels).
86 The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
87 everything is visible. The data is in World coordinates.
90 The currently displayed page. This information is needed e.g. due to existing PageNumber
91 fields which need to be interpreted.
94 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
97 @param rExtendedParameters
98 A sequence of property values which allows holding various other parameters besides
99 the obvious and needed ones above. For this constructor none of the other parameters
100 should be added as data. The constructor will parse the given parameters and if
101 data for the other parameters is given, the value in rExtendedParameters will
102 be preferred and overwrite the given parameter
104 ViewInformation2D(const basegfx::B2DHomMatrix
& rObjectTransformation
,
105 const basegfx::B2DHomMatrix
& rViewTransformation
,
106 const basegfx::B2DRange
& rViewport
,
107 const css::uno::Reference
<css::drawing::XDrawPage
>& rxDrawPage
,
109 const css::uno::Sequence
<css::beans::PropertyValue
>& rExtendedParameters
);
111 /** Constructor: Create a ViewInformation2D
113 @param rViewParameters
114 A sequence of property values which allows holding any combination of local and various
115 other parameters. This constructor is fed completely with a sequence of PropertyValues
116 which will be parsed to be able to offer the most used ones in a convenient way.
118 explicit ViewInformation2D(
119 const css::uno::Sequence
<css::beans::PropertyValue
>& rViewParameters
);
121 /// default (empty) constructor
125 ViewInformation2D(const ViewInformation2D
&);
127 ViewInformation2D(ViewInformation2D
&&);
130 ~ViewInformation2D();
132 /// assignment operator
133 ViewInformation2D
& operator=(const ViewInformation2D
&);
134 ViewInformation2D
& operator=(ViewInformation2D
&&);
136 /// compare operators
137 bool operator==(const ViewInformation2D
& rCandidate
) const;
138 bool operator!=(const ViewInformation2D
& rCandidate
) const { return !operator==(rCandidate
); }
141 const basegfx::B2DHomMatrix
& getObjectTransformation() const;
142 const basegfx::B2DHomMatrix
& getViewTransformation() const;
143 const basegfx::B2DRange
& getViewport() const;
144 double getViewTime() const;
145 const css::uno::Reference
<css::drawing::XDrawPage
>& getVisualizedPage() const;
147 /// On-demand prepared Object to View transformation and its inverse for convenience
148 const basegfx::B2DHomMatrix
& getObjectToViewTransformation() const;
149 const basegfx::B2DHomMatrix
& getInverseObjectToViewTransformation() const;
151 /// On-demand prepared Viewport in discrete units for convenience
152 const basegfx::B2DRange
& getDiscreteViewport() const;
154 /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
155 is used e.g. to allow to lower display quality for OverlayPrimitives and
156 may lead to simpler decompositions in the local create2DDecomposition
157 implementations of the primitives
159 bool getReducedDisplayQuality() const;
161 /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
163 Use this call if You need to extract all contained ViewInformation. The ones
164 directly supported for convenience will be added to the ones only available
165 as PropertyValues. This set completely describes this ViewInformation2D and
166 can be used for complete information transport over UNO API.
168 const css::uno::Sequence
<css::beans::PropertyValue
>& getViewInformationSequence() const;
170 /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
173 Use this call if You only need ViewInformation which is not offered conveniently,
174 but only exists as PropertyValue. This is e.g. used to create partially updated
175 incarnations of ViewInformation2D without losing the only with PropertyValues
176 defined data. It does not contain a complete description.
178 const css::uno::Sequence
<css::beans::PropertyValue
>& getExtendedInformationSequence() const;
181 } // end of namespace drawinglayer::geometry
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */