Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_INC_SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
21 : #define INCLUDED_SVX_INC_SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
22 :
23 : #include <sal/types.h>
24 : #include <svx/sdr/contact/viewcontact.hxx>
25 :
26 : class SdrPage;
27 :
28 : namespace sdr { namespace contact {
29 :
30 : class ViewContactOfSdrPage;
31 :
32 : class ViewContactOfPageSubObject : public ViewContact
33 : {
34 : protected:
35 : ViewContactOfSdrPage& mrParentViewContactOfSdrPage;
36 :
37 : public:
38 : explicit ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
39 : virtual ~ViewContactOfPageSubObject();
40 :
41 : virtual ViewContact* GetParentContact() const SAL_OVERRIDE;
42 : const SdrPage& getPage() const;
43 : };
44 :
45 : class ViewContactOfPageBackground : public ViewContactOfPageSubObject
46 : {
47 : protected:
48 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
49 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
50 :
51 : public:
52 : explicit ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
53 : virtual ~ViewContactOfPageBackground();
54 : };
55 :
56 : class ViewContactOfPageShadow : public ViewContactOfPageSubObject
57 : {
58 : protected:
59 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
60 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
61 :
62 : public:
63 : explicit ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
64 : virtual ~ViewContactOfPageShadow();
65 : };
66 :
67 : class ViewContactOfPageFill : public ViewContactOfPageSubObject
68 : {
69 : protected:
70 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
71 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
72 :
73 : public:
74 : explicit ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
75 : virtual ~ViewContactOfPageFill();
76 : };
77 :
78 : class ViewContactOfMasterPage : public ViewContactOfPageSubObject
79 : {
80 : protected:
81 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
82 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
83 :
84 : public:
85 : explicit ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
86 : virtual ~ViewContactOfMasterPage();
87 : };
88 :
89 : class ViewContactOfOuterPageBorder : public ViewContactOfPageSubObject
90 : {
91 : protected:
92 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
93 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
94 :
95 : public:
96 : explicit ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
97 : virtual ~ViewContactOfOuterPageBorder();
98 : };
99 :
100 : class ViewContactOfInnerPageBorder : public ViewContactOfPageSubObject
101 : {
102 : protected:
103 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
104 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
105 :
106 : public:
107 : explicit ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
108 : virtual ~ViewContactOfInnerPageBorder();
109 : };
110 :
111 : /**
112 : * This view contact corresponds with all SdrObject instances in a single
113 : * SdrPage. Its GetObjectCount() returns the number of SdrObject instances
114 : * in the SdrPage that it represents, and its GetViewContact() returns the
115 : * view contact of the SdrObject instance associated with the identifier
116 : * passed to the method.
117 : */
118 : class ViewContactOfPageHierarchy : public ViewContactOfPageSubObject
119 : {
120 : protected:
121 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
122 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
123 :
124 : public:
125 : explicit ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
126 : virtual ~ViewContactOfPageHierarchy();
127 :
128 : virtual sal_uInt32 GetObjectCount() const SAL_OVERRIDE;
129 : virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const SAL_OVERRIDE;
130 : };
131 :
132 : class ViewContactOfGrid : public ViewContactOfPageSubObject
133 : {
134 : protected:
135 : // bitfield
136 : bool mbFront : 1;
137 :
138 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
139 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
140 :
141 : public:
142 : ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront);
143 : virtual ~ViewContactOfGrid();
144 :
145 0 : bool getFront() const { return mbFront; }
146 : };
147 :
148 : class ViewContactOfHelplines : public ViewContactOfPageSubObject
149 : {
150 : protected:
151 : // bitfield
152 : bool mbFront : 1;
153 :
154 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
155 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
156 :
157 : public:
158 : ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront);
159 : virtual ~ViewContactOfHelplines();
160 :
161 0 : bool getFront() const { return mbFront; }
162 : };
163 :
164 : class ViewContactOfSdrPage : public ViewContact
165 : {
166 : protected:
167 : // the owner of this ViewContact. Set from constructor and not
168 : // to be changed in any way.
169 : SdrPage& mrPage;
170 :
171 : // helper viewContacts to build a clear paint hierarchy
172 : ViewContactOfPageBackground maViewContactOfPageBackground;
173 : ViewContactOfPageShadow maViewContactOfPageShadow;
174 : ViewContactOfPageFill maViewContactOfPageFill;
175 : ViewContactOfMasterPage maViewContactOfMasterPage;
176 : ViewContactOfOuterPageBorder maViewContactOfOuterPageBorder;
177 : ViewContactOfInnerPageBorder maViewContactOfInnerPageBorder;
178 : ViewContactOfGrid maViewContactOfGridBack;
179 : ViewContactOfHelplines maViewContactOfHelplinesBack;
180 : ViewContactOfPageHierarchy maViewContactOfPageHierarchy;
181 : ViewContactOfGrid maViewContactOfGridFront;
182 : ViewContactOfHelplines maViewContactOfHelplinesFront;
183 :
184 : // Create a Object-Specific ViewObjectContact, set ViewContact and
185 : // ObjectContact. Always needs to return something. Default is to create
186 : // a standard ViewObjectContact containing the given ObjectContact and *this
187 : virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) SAL_OVERRIDE;
188 :
189 : public:
190 : // access to SdrObject
191 207859 : SdrPage& GetSdrPage() const
192 : {
193 207859 : return mrPage;
194 : }
195 :
196 : // basic constructor, used from SdrPage.
197 : explicit ViewContactOfSdrPage(SdrPage& rObj);
198 : virtual ~ViewContactOfSdrPage();
199 :
200 : // Access to possible sub-hierarchy
201 : virtual sal_uInt32 GetObjectCount() const SAL_OVERRIDE;
202 : virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const SAL_OVERRIDE;
203 :
204 : // React on changes of the object of this ViewContact
205 : virtual void ActionChanged() SAL_OVERRIDE;
206 :
207 : // overload for acessing the SdrPage
208 : virtual SdrPage* TryToGetSdrPage() const SAL_OVERRIDE;
209 :
210 : protected:
211 : // This method is responsible for creating the graphical visualisation data
212 : // ONLY based on model data
213 : virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const SAL_OVERRIDE;
214 : };
215 :
216 : }}
217 :
218 : #endif // INCLUDED_SVX_INC_SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
219 :
220 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|