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 .
20 #ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
21 #define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <sal/config.h>
26 #include <o3tl/cow_wrapper.hxx>
31 namespace drawinglayer
{ namespace geometry
{
32 class ImpViewInformation2D
;
40 namespace com::sun::star::beans
{ struct PropertyValue
; }
41 namespace com::sun::star::drawing
{ class XDrawPage
; }
42 namespace com::sun::star::uno
{ template <class interface_type
> class Reference
; }
43 namespace com::sun::star::uno
{ template <typename
> class Sequence
; }
45 namespace drawinglayer
49 /** ViewInformation2D class
51 This class holds all view-relevant information for a 2d geometry. It works
52 together with UNO API definitions and supports holding a sequence of PropertyValues.
53 The most used data is for convenience offered directly using basegfx tooling classes.
54 It is an implementation to support the sequence of PropertyValues used in a
55 css::graphic::XPrimitive2D for C++ implementations working with those
57 class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
60 typedef o3tl::cow_wrapper
< ImpViewInformation2D
, o3tl::ThreadSafeRefCountingPolicy
> ImplType
;
63 /// pointer to private implementation class
64 ImplType mpViewInformation2D
;
67 /** Constructor: Create a ViewInformation2D
69 @param rObjectTransformation
70 The Transformation from Object to World coordinates (normally logic coordinates).
72 @param rViewTransformation
73 The Transformation from World to View coordinates (normally logic coordinates
74 to discrete units, e.g. pixels).
77 The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
78 everything is visible. The data is in World coordinates.
81 The currently displayed page. This information is needed e.g. due to existing PageNumber
82 fields which need to be interpreted.
85 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
88 @param rExtendedParameters
89 A sequence of property values which allows holding various other parameters besides
90 the obvious and needed ones above. For this constructor none of the other parameters
91 should be added as data. The constructor will parse the given parameters and if
92 data for the other parameters is given, the value in rExtendedParameters will
93 be preferred and overwrite the given parameter
96 const basegfx::B2DHomMatrix
& rObjectTransformation
,
97 const basegfx::B2DHomMatrix
& rViewTransformation
,
98 const basegfx::B2DRange
& rViewport
,
99 const css::uno::Reference
< css::drawing::XDrawPage
>& rxDrawPage
,
101 const css::uno::Sequence
< css::beans::PropertyValue
>& rExtendedParameters
);
103 /** Constructor: Create a ViewInformation2D
105 @param rViewParameters
106 A sequence of property values which allows holding any combination of local and various
107 other parameters. This constructor is feeded completely with a sequence of PropertyValues
108 which will be parsed to be able to offer the most used ones in a convenient way.
110 explicit ViewInformation2D(const css::uno::Sequence
< css::beans::PropertyValue
>& rViewParameters
);
112 /// default (empty) constructor
116 ViewInformation2D(const ViewInformation2D
&);
118 ViewInformation2D(ViewInformation2D
&&);
121 ~ViewInformation2D();
123 /// assignment operator
124 ViewInformation2D
& operator=(const ViewInformation2D
&);
125 ViewInformation2D
& operator=(ViewInformation2D
&&);
127 /// compare operators
128 bool operator==(const ViewInformation2D
& rCandidate
) const;
129 bool operator!=(const ViewInformation2D
& rCandidate
) const { return !operator==(rCandidate
); }
132 const basegfx::B2DHomMatrix
& getObjectTransformation() const;
133 const basegfx::B2DHomMatrix
& getViewTransformation() const;
134 const basegfx::B2DRange
& getViewport() const;
135 double getViewTime() const;
136 const css::uno::Reference
< css::drawing::XDrawPage
>& getVisualizedPage() const;
138 /// On-demand prepared Object to View transformation and its inverse for convenience
139 const basegfx::B2DHomMatrix
& getObjectToViewTransformation() const;
140 const basegfx::B2DHomMatrix
& getInverseObjectToViewTransformation() const;
142 /// On-demand prepared Viewport in discrete units for convenience
143 const basegfx::B2DRange
& getDiscreteViewport() const;
145 /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
146 is used e.g. to allow to lower display quality for OverlayPrimitives and
147 may lead to simpler decompositions in the local create2DDecomposition
148 implementations of the primitives
150 bool getReducedDisplayQuality() const;
152 /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
154 Use this call if You need to extract all contained ViewInformation. The ones
155 directly supported for convenience will be added to the ones only available
156 as PropertyValues. This set completely describes this ViewInformation2D and
157 can be used for complete information transport over UNO API.
159 const css::uno::Sequence
< css::beans::PropertyValue
>& getViewInformationSequence() const;
161 /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
164 Use this call if You only need ViewInformation which is not offered conveniently,
165 but only exists as PropertyValue. This is e.g. used to create partially updated
166 incarnations of ViewInformation2D without losing the only with PropertyValues
167 defined data. It does not contain a complete description.
169 const css::uno::Sequence
< css::beans::PropertyValue
>& getExtendedInformationSequence() const;
171 } // end of namespace geometry
172 } // end of namespace drawinglayer
175 #endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */