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 <com/sun/star/uno/Sequence.h>
27 #include <com/sun/star/beans/PropertyValue.hpp>
28 #include <com/sun/star/drawing/XDrawPage.hpp>
29 #include <o3tl/cow_wrapper.hxx>
34 namespace drawinglayer
{ namespace geometry
{
35 class ImpViewInformation2D
;
44 namespace drawinglayer
48 /** ViewInformation2D class
50 This class holds all view-relevant information for a 2d geometry. It works
51 together with UNO API definitions and supports holding a sequence of PropertyValues.
52 The most used data is for convenience offered directly using basegfx tooling classes.
53 It is an implementation to support the sequence of PropertyValues used in a
54 css::graphic::XPrimitive2D for C++ implementations working with those
56 class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
59 typedef o3tl::cow_wrapper
< ImpViewInformation2D
, o3tl::ThreadSafeRefCountingPolicy
> ImplType
;
62 /// pointer to private implementation class
63 ImplType mpViewInformation2D
;
66 /** Constructor: Create a ViewInformation2D
68 @param rObjectTransformation
69 The Transformation from Object to World coordinates (normally logic coordinates).
71 @param rViewTransformation
72 The Transformation from World to View coordinates (normally logic coordinates
73 to discrete units, e.g. pixels).
76 The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
77 everything is visible. The data is in World coordinates.
80 The currently displayed page. This information is needed e.g. due to existing PageNumber
81 fields which need to be interpreted.
84 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
87 @param rExtendedParameters
88 A sequence of property values which allows holding various other parameters besides
89 the obvious and needed ones above. For this constructor none of the other parameters
90 should be added as data. The constructor will parse the given parameters and if
91 data for the other parameters is given, the value in rExtendedParameters will
92 be preferred and overwrite the given parameter
95 const basegfx::B2DHomMatrix
& rObjectTransformation
,
96 const basegfx::B2DHomMatrix
& rViewTransformation
,
97 const basegfx::B2DRange
& rViewport
,
98 const css::uno::Reference
< css::drawing::XDrawPage
>& rxDrawPage
,
100 const css::uno::Sequence
< css::beans::PropertyValue
>& rExtendedParameters
);
102 /** Constructor: Create a ViewInformation2D
104 @param rViewParameters
105 A sequence of property values which allows holding any combination of local and various
106 other parameters. This constructor is feeded completely with a sequence of PropertyValues
107 which will be parsed to be able to offer the most used ones in a convenient way.
109 explicit ViewInformation2D(const css::uno::Sequence
< css::beans::PropertyValue
>& rViewParameters
);
111 /// default (empty) constructor
115 ViewInformation2D(const ViewInformation2D
& rCandidate
);
117 ViewInformation2D(ViewInformation2D
&& rCandidate
);
120 ~ViewInformation2D();
122 /// assignment operator
123 ViewInformation2D
& operator=(const ViewInformation2D
& rCandidate
);
124 ViewInformation2D
& operator=(ViewInformation2D
&& rCandidate
);
126 /// compare operators
127 bool operator==(const ViewInformation2D
& rCandidate
) const;
128 bool operator!=(const ViewInformation2D
& rCandidate
) const { return !operator==(rCandidate
); }
131 const basegfx::B2DHomMatrix
& getObjectTransformation() const;
132 const basegfx::B2DHomMatrix
& getViewTransformation() const;
133 const basegfx::B2DRange
& getViewport() const;
134 double getViewTime() const;
135 const css::uno::Reference
< css::drawing::XDrawPage
>& getVisualizedPage() const;
137 /// On-demand prepared Object to View transformation and its inverse for convenience
138 const basegfx::B2DHomMatrix
& getObjectToViewTransformation() const;
139 const basegfx::B2DHomMatrix
& getInverseObjectToViewTransformation() const;
141 /// On-demand prepared Viewport in discrete units for convenience
142 const basegfx::B2DRange
& getDiscreteViewport() const;
144 /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
145 is used e.g. to allow to lower display quality for OverlayPrimitives and
146 may lead to simpler decompositions in the local create2DDecomposition
147 implementations of the primitives
149 bool getReducedDisplayQuality() const;
151 /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
153 Use this call if You need to extract all contained ViewInformation. The ones
154 directly supported for convenience will be added to the ones only available
155 as PropertyValues. This set completely describes this ViewInformation2D and
156 can be used for complete information transport over UNO API.
158 const css::uno::Sequence
< css::beans::PropertyValue
>& getViewInformationSequence() const;
160 /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
163 Use this call if You only need ViewInformation which is not offered conveniently,
164 but only exists as PropertyValue. This is e.g. used to create partially updated
165 incarnations of ViewInformation2D without losing the only with PropertyValues
166 defined data. It does not contain a complete description.
168 const css::uno::Sequence
< css::beans::PropertyValue
>& getExtendedInformationSequence() const;
170 } // end of namespace geometry
171 } // end of namespace drawinglayer
174 #endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */