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 _SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
25 #define _SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
26 
27 #include <sal/types.h>
28 #include <svx/sdr/contact/viewcontact.hxx>
29 
30 //////////////////////////////////////////////////////////////////////////////
31 // predeclarations
32 class SdrPage;
33 
34 namespace sdr { namespace contact {
35 	class ViewContactOfSdrPage;
36 }}
37 
38 //////////////////////////////////////////////////////////////////////////////
39 
40 namespace sdr
41 {
42 	namespace contact
43 	{
44 		class ViewContactOfPageSubObject : public ViewContact
45 		{
46 		protected:
47 			ViewContactOfSdrPage&						mrParentViewContactOfSdrPage;
48 
49 		public:
50 			ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
51 			virtual ~ViewContactOfPageSubObject();
52 
53 			virtual ViewContact* GetParentContact() const;
54 			const SdrPage& getPage() const;
55 		};
56 	} // end of namespace contact
57 } // end of namespace sdr
58 
59 //////////////////////////////////////////////////////////////////////////////
60 
61 namespace sdr
62 {
63 	namespace contact
64 	{
65 		class ViewContactOfPageBackground : public ViewContactOfPageSubObject
66 		{
67 		protected:
68 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
69 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
70 
71 		public:
72 			ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
73 			virtual ~ViewContactOfPageBackground();
74 		};
75 	} // end of namespace contact
76 } // end of namespace sdr
77 
78 //////////////////////////////////////////////////////////////////////////////
79 
80 namespace sdr
81 {
82 	namespace contact
83 	{
84 		class ViewContactOfPageShadow : public ViewContactOfPageSubObject
85 		{
86 		protected:
87 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
88 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
89 
90 		public:
91 			ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
92 			virtual ~ViewContactOfPageShadow();
93 		};
94 	} // end of namespace contact
95 } // end of namespace sdr
96 
97 //////////////////////////////////////////////////////////////////////////////
98 
99 namespace sdr
100 {
101 	namespace contact
102 	{
103 		class ViewContactOfPageFill : public ViewContactOfPageSubObject
104 		{
105 		protected:
106 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
107 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
108 
109 		public:
110 			ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
111 			virtual ~ViewContactOfPageFill();
112 		};
113 	} // end of namespace contact
114 } // end of namespace sdr
115 
116 //////////////////////////////////////////////////////////////////////////////
117 
118 namespace sdr
119 {
120 	namespace contact
121 	{
122 		class ViewContactOfMasterPage : public ViewContactOfPageSubObject
123 		{
124 		protected:
125 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
126 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
127 
128 		public:
129 			ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
130 			virtual ~ViewContactOfMasterPage();
131 		};
132 	} // end of namespace contact
133 } // end of namespace sdr
134 
135 //////////////////////////////////////////////////////////////////////////////
136 
137 namespace sdr
138 {
139 	namespace contact
140 	{
141 		class ViewContactOfOuterPageBorder : public ViewContactOfPageSubObject
142 		{
143 		protected:
144 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
145 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
146 
147 		public:
148 			ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
149 			virtual ~ViewContactOfOuterPageBorder();
150 		};
151 	} // end of namespace contact
152 } // end of namespace sdr
153 
154 //////////////////////////////////////////////////////////////////////////////
155 
156 namespace sdr
157 {
158 	namespace contact
159 	{
160 		class ViewContactOfInnerPageBorder : public ViewContactOfPageSubObject
161 		{
162 		protected:
163 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
164 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
165 
166 		public:
167 			ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
168 			virtual ~ViewContactOfInnerPageBorder();
169 		};
170 	} // end of namespace contact
171 } // end of namespace sdr
172 
173 //////////////////////////////////////////////////////////////////////////////
174 
175 namespace sdr
176 {
177 	namespace contact
178 	{
179 		class ViewContactOfPageHierarchy : public ViewContactOfPageSubObject
180 		{
181 		protected:
182 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
183 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
184 
185 		public:
186 			ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
187 			virtual ~ViewContactOfPageHierarchy();
188 
189 			virtual sal_uInt32 GetObjectCount() const;
190 			virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
191 		};
192 	} // end of namespace contact
193 } // end of namespace sdr
194 
195 //////////////////////////////////////////////////////////////////////////////
196 
197 namespace sdr
198 {
199 	namespace contact
200 	{
201 		class ViewContactOfGrid : public ViewContactOfPageSubObject
202 		{
203 		protected:
204 			// bitfield
205 			unsigned									mbFront : 1;
206 
207 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
208 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
209 
210 		public:
211 			ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront);
212 			virtual ~ViewContactOfGrid();
213 
getFront() const214 			bool getFront() const { return mbFront; }
215 		};
216 	} // end of namespace contact
217 } // end of namespace sdr
218 
219 //////////////////////////////////////////////////////////////////////////////
220 
221 namespace sdr
222 {
223 	namespace contact
224 	{
225 		class ViewContactOfHelplines : public ViewContactOfPageSubObject
226 		{
227 		protected:
228 			// bitfield
229 			unsigned									mbFront : 1;
230 
231 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
232 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
233 
234 		public:
235 			ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront);
236 			virtual ~ViewContactOfHelplines();
237 
getFront() const238             bool getFront() const { return mbFront; }
239 		};
240 	} // end of namespace contact
241 } // end of namespace sdr
242 
243 //////////////////////////////////////////////////////////////////////////////
244 
245 namespace sdr
246 {
247 	namespace contact
248 	{
249 		class ViewContactOfSdrPage : public ViewContact
250 		{
251 		protected:
252 			// the owner of this ViewContact. Set from constructor and not
253 			// to be changed in any way.
254 			SdrPage&										mrPage;
255 
256 			// helper viewContacts to build a clear paint hierarchy
257 			ViewContactOfPageBackground						maViewContactOfPageBackground;
258 			ViewContactOfPageShadow							maViewContactOfPageShadow;
259 			ViewContactOfPageFill							maViewContactOfPageFill;
260 			ViewContactOfMasterPage							maViewContactOfMasterPage;
261 			ViewContactOfOuterPageBorder					maViewContactOfOuterPageBorder;
262 			ViewContactOfInnerPageBorder					maViewContactOfInnerPageBorder;
263 			ViewContactOfGrid								maViewContactOfGridBack;
264 			ViewContactOfHelplines							maViewContactOfHelplinesBack;
265 			ViewContactOfPageHierarchy						maViewContactOfPageHierarchy;
266 			ViewContactOfGrid								maViewContactOfGridFront;
267 			ViewContactOfHelplines							maViewContactOfHelplinesFront;
268 
269 			// Create a Object-Specific ViewObjectContact, set ViewContact and
270 			// ObjectContact. Always needs to return something. Default is to create
271 			// a standard ViewObjectContact containing the given ObjectContact and *this
272 			virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
273 
274 		public:
275 			// access to SdrObject
GetSdrPage() const276 			SdrPage& GetSdrPage() const
277 			{
278 				return mrPage;
279 			}
280 
281 			// basic constructor, used from SdrPage.
282 			ViewContactOfSdrPage(SdrPage& rObj);
283 			virtual ~ViewContactOfSdrPage();
284 
285 			// Access to possible sub-hierarchy
286 			virtual sal_uInt32 GetObjectCount() const;
287 			virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
288 
289 			// React on changes of the object of this ViewContact
290 			virtual void ActionChanged();
291 
292 			// overload for acessing the SdrPage
293 			virtual SdrPage* TryToGetSdrPage() const;
294 
295 		protected:
296 			// This method is responsible for creating the graphical visualisation data
297             // ONLY based on model data
298 			virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
299 		};
300 	} // end of namespace contact
301 } // end of namespace sdr
302 
303 //////////////////////////////////////////////////////////////////////////////
304 
305 #endif //_SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
306 
307 // eof
308