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_OBJECTCONTACTOFOBJLISTPAINTER_HXX
25 #define _SDR_CONTACT_OBJECTCONTACTOFOBJLISTPAINTER_HXX
26 
27 #include <svx/sdr/contact/objectcontact.hxx>
28 #include "svx/svxdllapi.h"
29 #include <svx/svdpage.hxx>
30 
31 //////////////////////////////////////////////////////////////////////////////
32 // predeclarations
33 
34 class SdrPage;
35 class SdrObject;
36 
37 //////////////////////////////////////////////////////////////////////////////
38 
39 namespace sdr
40 {
41 	namespace contact
42 	{
43 		class SVX_DLLPUBLIC ObjectContactPainter : public ObjectContact
44 		{
45 		protected:
46 			// Hierarchy access methods
47 			virtual sal_uInt32 GetPaintObjectCount() const = 0;
48 			virtual ViewContact& GetPaintObjectViewContact(sal_uInt32 nIndex) const = 0;
49 
50 		public:
51 			// basic constructor/destructor
52 			ObjectContactPainter();
53 			virtual ~ObjectContactPainter();
54 		};
55 	} // end of namespace contact
56 } // end of namespace sdr
57 
58 //////////////////////////////////////////////////////////////////////////////
59 
60 namespace sdr
61 {
62 	namespace contact
63 	{
64 		// typedef for transferring SdrObject
65 		typedef ::std::vector< SdrObject* > SdrObjectVector;
66 
67 		class SVX_DLLPUBLIC ObjectContactOfObjListPainter : public ObjectContactPainter
68 		{
69 		protected:
70 			// Target OutputDevice
71 			OutputDevice&									mrTargetOutputDevice;
72 
73 			// Set StartPoint for next run, also given in constructor
74 			SdrObjectVector									maStartObjects;
75 
76             // the processed page which is the base e.g. for PageNumberFields
77             const SdrPage*                                  mpProcessedPage;
78 
79 			// Hierarchy access methods
80 			virtual sal_uInt32 GetPaintObjectCount() const;
81 			virtual ViewContact& GetPaintObjectViewContact(sal_uInt32 nIndex) const;
82 
83 		public:
84 			// basic constructor/destructor
85 			ObjectContactOfObjListPainter(
86 				OutputDevice& rTargetDevice,
87 				const SdrObjectVector& rObjects,
88                 const SdrPage* pProcessedPage);
89 			virtual ~ObjectContactOfObjListPainter();
90 
91 			// Process the whole displaying
92 			virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
93 
94 			// VirtualDevice? Default is false
95 			virtual bool isOutputToVirtualDevice() const;
96 
97 			// recording MetaFile? Default is false
98 			virtual bool isOutputToRecordingMetaFile() const;
99 
100 			// pdf export? Default is false
101 			virtual bool isOutputToPDFFile() const;
102 
103 			// access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
104 			virtual OutputDevice* TryToGetOutputDevice() const;
105 		};
106 	} // end of namespace contact
107 } // end of namespace sdr
108 
109 //////////////////////////////////////////////////////////////////////////////
110 
111 namespace sdr
112 {
113 	namespace contact
114 	{
115 		class ObjectContactOfPagePainter : public ObjectContactPainter
116 		{
117 		protected:
118 			// the original ObjectContact this painter is working on
119 			ObjectContact&									mrOriginalObjectContact;
120 
121 			// Set StartPoint for next run, also given in constructor
122 			SdrPageWeakRef									mxStartPage;
123 
124 			// Hierarchy access methods
125 			virtual sal_uInt32 GetPaintObjectCount() const;
126 			virtual ViewContact& GetPaintObjectViewContact(sal_uInt32 nIndex) const;
127 
128 		public:
129 			// basic constructor
130 			ObjectContactOfPagePainter(
131 				const SdrPage* pPage,
132 				ObjectContact& rOriginalObjectContact);
133 			virtual ~ObjectContactOfPagePainter();
134 
135 			// set another page
136 			void SetStartPage(const SdrPage* pPage);
GetStartPage() const137 			const SdrPage* GetStartPage() const { return mxStartPage.get(); }
138 
139 			// access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
140 			virtual OutputDevice* TryToGetOutputDevice() const;
141 		};
142 	} // end of namespace contact
143 } // end of namespace sdr
144 
145 //////////////////////////////////////////////////////////////////////////////
146 
147 #endif //_SDR_CONTACT_OBJECTCONTACTOFOBJLISTPAINTER_HXX
148 
149 // eof
150