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_SDR_CONTACT_OBJECTCONTACT_HXX
21 : #define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
22 :
23 : #include <svx/sdr/animation/objectanimator.hxx>
24 : #include <svx/svxdllapi.h>
25 : #include <drawinglayer/geometry/viewinformation2d.hxx>
26 :
27 : class SetOfByte;
28 : class Rectangle;
29 : class SdrPageView;
30 : class OutputDevice;
31 :
32 : namespace sdr { namespace event {
33 : class TimerEventHandler;
34 : }}
35 :
36 : namespace basegfx {
37 : class B2DRange;
38 : class B2DHomMatrix;
39 : }
40 :
41 : namespace sdr { namespace contact {
42 :
43 : class DisplayInfo;
44 : class ViewContact;
45 : class ViewObjectContactRedirector;
46 :
47 : class SVX_DLLPUBLIC ObjectContact
48 : {
49 : private:
50 : // make ViewObjectContact a friend to exclusively allow it to use
51 : // AddViewObjectContact/RemoveViewObjectContact
52 : friend class ViewObjectContact;
53 :
54 : // All VOCs which are created using this OC, thus remembering this OC
55 : // as a reference. All those VOCs need to be deleted when the OC goes down.
56 : // Registering and de-registering is done in the VOC constructors/destructors.
57 : std::vector< ViewObjectContact* > maViewObjectContactVector;
58 :
59 : // A new ViewObjectContact was created and shall be remembered.
60 : void AddViewObjectContact(ViewObjectContact& rVOContact);
61 :
62 : // A ViewObjectContact was deleted and shall be forgotten.
63 : void RemoveViewObjectContact(ViewObjectContact& rVOContact);
64 :
65 : // the primitiveAnimator which is used if this View and/or the contained primitives
66 : // support animatedSwitchPrimitives
67 : sdr::animation::primitiveAnimator maPrimitiveAnimator;
68 :
69 : // the EventHandler for e.g. asynchronious loading of graphics
70 : sdr::event::TimerEventHandler* mpEventHandler;
71 :
72 : // The redirector. If set it is used to pipe all supported calls
73 : // to the redirector
74 : ViewObjectContactRedirector* mpViewObjectContactRedirector;
75 :
76 : // the Primitive2DParameters containing view information
77 : drawinglayer::geometry::ViewInformation2D maViewInformation2D;
78 :
79 : // bitfield
80 : // flag for preview renderer
81 : bool mbIsPreviewRenderer : 1;
82 :
83 : // method to create a EventHandler. Needs to give a result.
84 : static sdr::event::TimerEventHandler* CreateEventHandler();
85 :
86 : protected:
87 : // Interface to allow derivates to travel over the registered VOC's
88 7633 : sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
89 161036 : ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
90 :
91 : // interface to allow derivates to set PreviewRenderer flag
92 2648 : void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
93 :
94 : // interface to allow derivates to set ViewInformation2D
95 41116 : void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
96 :
97 : public:
98 : // basic constructor
99 : ObjectContact();
100 : virtual ~ObjectContact();
101 :
102 : // LazyInvalidate request. This is used from the VOCs to mark that they
103 : // got invalidated by an ActionCanged() call. An active view needs to remember
104 : // this and take action on it. Default implementation directly calls back
105 : // triggerLazyInvalidate() which promptly handles the request
106 : virtual void setLazyInvalidate(ViewObjectContact& rVOC);
107 :
108 : // call this to support evtl. preparations for repaint. Default does nothing
109 : virtual void PrepareProcessDisplay();
110 :
111 : // Process the whole displaying
112 : virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
113 :
114 : // test if visualizing of entered groups is switched on at all. Default
115 : // implementation returns sal_False.
116 : virtual bool DoVisualizeEnteredGroup() const;
117 :
118 : // get active group's (the entered group) ViewContact
119 : virtual const ViewContact* getActiveViewContact() const;
120 :
121 : // Invalidate given rectangle at the window/output which is represented by
122 : // this ObjectContact. Default does nothing.
123 : virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
124 :
125 : // Get info if given Rectangle is visible in this view
126 : virtual bool IsAreaVisible(const basegfx::B2DRange& rRange) const;
127 :
128 : // Get info about the need to visualize GluePoints. The default
129 : // is that it is not necessary.
130 : virtual bool AreGluePointsVisible() const;
131 :
132 : // method to get the primitiveAnimator
133 40823 : sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; }
134 :
135 : // method to get the EventHandler. It will
136 : // return a existing one or create a new one using CreateEventHandler().
137 : sdr::event::TimerEventHandler& GetEventHandler() const;
138 :
139 : // delete the EventHandler
140 : void DeleteEventHandler();
141 :
142 : // test if there is an EventHandler without creating one on demand
143 : bool HasEventHandler() const;
144 :
145 : // check if text animation is allowed. Default is sal_true.
146 : virtual bool IsTextAnimationAllowed() const;
147 :
148 : // check if graphic animation is allowed. Default is sal_true.
149 : virtual bool IsGraphicAnimationAllowed() const;
150 :
151 : // check if asynchronious graphis loading is allowed. Default is sal_False.
152 : virtual bool IsAsynchronGraphicsLoadingAllowed() const;
153 :
154 : // access to ViewObjectContactRedirector
155 64589 : ViewObjectContactRedirector* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector; }
156 : void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
157 :
158 : // check if buffering of MasterPages is allowed. Default is sal_False.
159 : virtual bool IsMasterPageBufferingAllowed() const;
160 :
161 : // print? Default is false
162 : virtual bool isOutputToPrinter() const;
163 :
164 : // window? Default is true
165 : virtual bool isOutputToWindow() const;
166 :
167 : // VirtualDevice? Default is false
168 : virtual bool isOutputToVirtualDevice() const;
169 :
170 : // recording MetaFile? Default is false
171 : virtual bool isOutputToRecordingMetaFile() const;
172 :
173 : // pdf export? Default is false
174 : virtual bool isOutputToPDFFile() const;
175 :
176 : // gray display mode
177 : virtual bool isDrawModeGray() const;
178 :
179 : // gray display mode
180 : virtual bool isDrawModeBlackWhite() const;
181 :
182 : // high contrast display mode
183 : virtual bool isDrawModeHighContrast() const;
184 :
185 : // check if this is a preview renderer. Default is sal_False.
186 3559 : bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
187 :
188 : // get Primitive2DParameters for this view
189 284214 : const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
190 :
191 : /// access to SdrPageView. May return 0L like the default implementations do. Override as needed.
192 : virtual SdrPageView* TryToGetSdrPageView() const;
193 :
194 : /// access to OutputDevice. May return 0L like the default implementations do. Override as needed.
195 : virtual OutputDevice* TryToGetOutputDevice() const;
196 :
197 : // reset ViewPort at internal ViewInformation2D. This is needed when the OC is used
198 : // not for ProcessDisplay() but to get a VOC associated with it. When trying to get
199 : // a sequence of primitives from the VOC then, the last initialized ViewPort from
200 : // the last ProcessDisplay() is used for geometric visibility testing. If this is not
201 : // wanted (like in such cases) this method is used. It will reuse the current
202 : // ViewInformation2D, but clear the ViewPort (no ViewPort means all is visible)
203 : void resetViewPort();
204 : };
205 :
206 : }}
207 :
208 :
209 :
210 : #endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
211 :
212 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|