1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
25 #define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
26 
27 // the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
28 // pre-declarations of com/sun/star namespace), include sal/config.h here
29 // where sun is redefined as 'sun' (so i guess the problem is known).
30 #include <drawinglayer/drawinglayerdllapi.h>
31 #include <sal/config.h>
32 #include <com/sun/star/uno/Sequence.h>
33 #include <com/sun/star/beans/PropertyValue.hpp>
34 #include <com/sun/star/drawing/XDrawPage.hpp>
35 
36 //////////////////////////////////////////////////////////////////////////////
37 // predefines
38 
39 namespace drawinglayer { namespace geometry {
40 	class ImpViewInformation2D;
41 }}
42 
43 namespace basegfx {
44 	class B2DHomMatrix;
45 	class B2DRange;
46 }
47 
48 //////////////////////////////////////////////////////////////////////////////
49 
50 namespace drawinglayer
51 {
52 	namespace geometry
53 	{
54         /** ViewInformation2D class
55 
56             This class holds all view-relevant information for a 2d geometry. It works
57             together with UNO API definitions and supports holding a sequence of PropertyValues.
58             The most used data is for convenience offered directly using basegfx tooling classes.
59             It is an implementation to support the sequence of PropertyValues used in a
60             ::com::sun::star::graphic::XPrimitive2D for C++ implementations working with those
61         */
62 		class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
63 		{
64 		private:
65 			/// pointer to private implementation class
66 			ImpViewInformation2D*					mpViewInformation2D;
67 
68 		public:
69 			/** Constructor: Create a ViewInformation2D
70 
71                 @param rObjectTransformation
72                 The Transformation from Object to World coordinates (normally logic coordinates).
73 
74                 @param rViewTransformation
75                 The Transformation from World to View coordinates (normally logic coordinates
76                 to discrete units, e.g. pixels).
77 
78                 @param rViewport
79                 The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
80                 everything is visible. The data is in World coordinates.
81 
82                 @param rxDrawPage
83                 The currently displaqyed page. This information is needed e.g. due to existing PageNumber
84                 fields which need to be interpreted.
85 
86                 @param fViewTime
87                 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
88                 animated objects
89 
90                 @param rExtendedParameters
91                 A sequence of property values which allows holding various other parameters besides
92                 the obvious and needed ones above. For this constructor none of the other parameters
93                 should be added as data. The constructor will parse the given parameters and if
94                 data for the other parameters is given, the value in rExtendedParameters will
95                 be preferred and overwrite the given parameter
96             */
97 			ViewInformation2D(
98 				const basegfx::B2DHomMatrix& rObjectTransformation,
99 				const basegfx::B2DHomMatrix& rViewTransformation,
100 				const basegfx::B2DRange& rViewport,
101 				const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
102 				double fViewTime,
103 				const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
104 
105 			/** Constructor: Create a ViewInformation2D
106 
107                 @param rViewParameters
108                 A sequence of property values which allows holding any combination of local and various
109                 other parameters. This constructor is feeded completely with a sequence of PropertyValues
110                 which will be parsed to be able to offer the most used ones in a convenient way.
111             */
112 			ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
113 
114 			/// default (empty) constructor
115 			ViewInformation2D();
116 
117 			/// copy constructor
118 			ViewInformation2D(const ViewInformation2D& rCandidate);
119 
120 			/// destructor
121 			~ViewInformation2D();
122 
123             // checks if the incarnation is default constructed
124             bool isDefault() const;
125 
126 			/// assignment operator
127 			ViewInformation2D& operator=(const ViewInformation2D& rCandidate);
128 
129 			/// compare operators
130 			bool operator==(const ViewInformation2D& rCandidate) const;
operator !=(const ViewInformation2D & rCandidate) const131             bool operator!=(const ViewInformation2D& rCandidate) const { return !operator==(rCandidate); }
132 
133 			/// data access
134 			const basegfx::B2DHomMatrix& getObjectTransformation() const;
135 			const basegfx::B2DHomMatrix& getViewTransformation() const;
136 			const basegfx::B2DRange& getViewport() const;
137 			double getViewTime() const;
138 			const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getVisualizedPage() const;
139 
140             /// On-demand prepared Object to View transformation and it's inerse for convenience
141 			const basegfx::B2DHomMatrix& getObjectToViewTransformation() const;
142 			const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const;
143 
144             /// On-demand prepared Viewport in discrete units for convenience
145             const basegfx::B2DRange& getDiscreteViewport() const;
146 
147             /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
148                 is used e.g. to allow to lower display quality for OverlayPrimitives and
149                 may lead to simpler decompositions in the local create2DDecomposition
150                 implementations of the primitives
151              */
152             bool getReducedDisplayQuality() const;
153 
154             /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
155 
156                 Use this call if You need to extract all contained ViewInformation. The ones
157                 directly supported for convenience will be added to the ones only available
158                 as PropertyValues. This set completely describes this ViewInformation2D and
159                 can be used for complete information transport over UNO API.
160             */
161 			const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
162 
163             /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
164                 not offered directly
165 
166                 Use this call if You only need ViewInformation which is not offered conveniently,
167                 but only exists as PropertyValue. This is e.g. used to create partially updated
168                 incarnations of ViewInformation2D without losing the only with PropertyValues
169                 defined data. It does not contain a complete description.
170             */
171 			const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
172 		};
173 	} // end of namespace geometry
174 } // end of namespace drawinglayer
175 
176 //////////////////////////////////////////////////////////////////////////////
177 
178 #endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
179 
180 // eof
181