1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SDR_CONTACT_OBJECTCONTACT_HXX
21 #define _SDR_CONTACT_OBJECTCONTACT_HXX
23 #include <svx/sdr/animation/objectanimator.hxx>
24 #include "svx/svxdllapi.h"
25 #include <drawinglayer/geometry/viewinformation2d.hxx>
27 //////////////////////////////////////////////////////////////////////////////
35 namespace sdr
{ namespace contact
{
38 class ViewObjectContactRedirector
;
41 namespace sdr
{ namespace event
{
42 class TimerEventHandler
;
50 //////////////////////////////////////////////////////////////////////////////
56 class SVX_DLLPUBLIC ObjectContact
59 // make ViewObjectContact a friend to exclusively allow it to use
60 // AddViewObjectContact/RemoveViewObjectContact
61 friend class ViewObjectContact
;
63 // All VOCs which are created using this OC, thus remembering this OC
64 // as a reference. All those VOCs need to be deleted when the OC goes down.
65 // Registering and de-registering is done in the VOC constructors/destructors.
66 std::vector
< ViewObjectContact
* > maViewObjectContactVector
;
68 // A new ViewObjectContact was created and shall be remembered.
69 void AddViewObjectContact(ViewObjectContact
& rVOContact
);
71 // A ViewObjectContact was deleted and shall be forgotten.
72 virtual void RemoveViewObjectContact(ViewObjectContact
& rVOContact
);
74 // the primitiveAnimator which is used if this View and/or the contained primitives
75 // support animatedSwitchPrimitives
76 sdr::animation::primitiveAnimator maPrimitiveAnimator
;
78 // the EventHandler for e.g. asynchronious loading of graphics
79 sdr::event::TimerEventHandler
* mpEventHandler
;
81 // The redirector. If set it is used to pipe all supported calls
83 ViewObjectContactRedirector
* mpViewObjectContactRedirector
;
85 // the Primitive2DParameters containing view information
86 drawinglayer::geometry::ViewInformation2D maViewInformation2D
;
89 // flag for preview renderer
90 unsigned mbIsPreviewRenderer
: 1;
92 // method to create a EventHandler. Needs to give a result.
93 sdr::event::TimerEventHandler
* CreateEventHandler();
96 // Interface to allow derivates to travel over the registered VOC's
97 sal_uInt32
getViewObjectContactCount() const { return maViewObjectContactVector
.size(); }
98 ViewObjectContact
* getViewObjectContact(sal_uInt32 a
) const { return maViewObjectContactVector
[a
]; }
100 // interface to allow derivates to set PreviewRenderer flag
101 void setPreviewRenderer(bool bNew
) { mbIsPreviewRenderer
= bNew
; }
103 // interface to allow derivates to set ViewInformation2D
104 void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D
& rViewInformation2D
) { maViewInformation2D
= rViewInformation2D
; }
109 virtual ~ObjectContact();
111 // LazyInvalidate request. This is used from the VOCs to mark that they
112 // got invalidated by an ActionCanged() call. An active view needs to remember
113 // this and take action on it. Default implementation directly calls back
114 // triggerLazyInvalidate() which promptly handles the request
115 virtual void setLazyInvalidate(ViewObjectContact
& rVOC
);
117 // call this to support evtl. preparations for repaint. Default does nothing
118 virtual void PrepareProcessDisplay();
120 // Process the whole displaying
121 virtual void ProcessDisplay(DisplayInfo
& rDisplayInfo
);
123 // test if visualizing of entered groups is switched on at all. Default
124 // implementation returns sal_False.
125 virtual bool DoVisualizeEnteredGroup() const;
127 // get active group's (the entered group) ViewContact
128 virtual const ViewContact
* getActiveViewContact() const;
130 // Invalidate given rectangle at the window/output which is represented by
131 // this ObjectContact. Default does nothing.
132 virtual void InvalidatePartOfView(const basegfx::B2DRange
& rRange
) const;
134 // Get info if given Rectangle is visible in this view
135 virtual bool IsAreaVisible(const basegfx::B2DRange
& rRange
) const;
137 // Get info about the need to visualize GluePoints. The default
138 // is that it is not necessary.
139 virtual bool AreGluePointsVisible() const;
141 // method to get the primitiveAnimator
142 sdr::animation::primitiveAnimator
& getPrimitiveAnimator();
144 // method to get the EventHandler. It will
145 // return a existing one or create a new one using CreateEventHandler().
146 sdr::event::TimerEventHandler
& GetEventHandler() const;
148 // delete the EventHandler
149 void DeleteEventHandler();
151 // test if there is an EventHandler without creating one on demand
152 bool HasEventHandler() const;
154 // check if text animation is allowed. Default is sal_true.
155 virtual bool IsTextAnimationAllowed() const;
157 // check if graphic animation is allowed. Default is sal_true.
158 virtual bool IsGraphicAnimationAllowed() const;
160 // check if asynchronious graphis loading is allowed. Default is sal_False.
161 virtual bool IsAsynchronGraphicsLoadingAllowed() const;
163 // access to ViewObjectContactRedirector
164 ViewObjectContactRedirector
* GetViewObjectContactRedirector() const;
165 void SetViewObjectContactRedirector(ViewObjectContactRedirector
* pNew
);
167 // check if buffering of MasterPages is allowed. Default is sal_False.
168 virtual bool IsMasterPageBufferingAllowed() const;
170 // print? Default is false
171 virtual bool isOutputToPrinter() const;
173 // window? Default is true
174 virtual bool isOutputToWindow() const;
176 // VirtualDevice? Default is false
177 virtual bool isOutputToVirtualDevice() const;
179 // recording MetaFile? Default is false
180 virtual bool isOutputToRecordingMetaFile() const;
182 // pdf export? Default is false
183 virtual bool isOutputToPDFFile() const;
186 virtual bool isDrawModeGray() const;
189 virtual bool isDrawModeBlackWhite() const;
191 // high contrast display mode
192 virtual bool isDrawModeHighContrast() const;
194 // check if this is a preview renderer. Default is sal_False.
195 bool IsPreviewRenderer() const { return mbIsPreviewRenderer
; }
197 // get Primitive2DParameters for this view
198 const drawinglayer::geometry::ViewInformation2D
& getViewInformation2D() const { return maViewInformation2D
; }
200 // access to SdrPageView. May return 0L like the default implementations do. Needs to be overloaded as needed.
201 virtual SdrPageView
* TryToGetSdrPageView() const;
203 // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
204 virtual OutputDevice
* TryToGetOutputDevice() const;
206 // reset ViewPort at internal ViewInformation2D. This is needed when the OC is used
207 // not for ProcessDisplay() but to get a VOC associated with it. When trying to get
208 // a sequence of primitives from the VOC then, the last initialized ViewPort from
209 // the last ProcessDisplay() is used for geometric visibility testing. If this is not
210 // wanted (like in such cases) this method is used. It will reuse the current
211 // ViewInformation2D, but clear the ViewPort (no ViewPort means all is visible)
212 void resetViewPort();
214 } // end of namespace contact
215 } // end of namespace sdr
217 //////////////////////////////////////////////////////////////////////////////
219 #endif //_SDR_CONTACT_OBJECTCONTACT_HXX
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */