Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / sdr / contact / objectcontact.hxx
blob61db82083a4a684488fc337ea798b85fff4b3cf1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
21 #define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
23 #include <svx/sdr/animation/objectanimator.hxx>
24 #include <svx/svxdllapi.h>
25 #include <drawinglayer/geometry/viewinformation2d.hxx>
27 class SetOfByte;
28 class Rectangle;
29 class SdrPageView;
30 class OutputDevice;
32 namespace sdr { namespace event {
33 class TimerEventHandler;
36 namespace basegfx {
37 class B2DRange;
38 class B2DHomMatrix;
41 namespace sdr { namespace contact {
43 class DisplayInfo;
44 class ViewContact;
45 class ViewObjectContactRedirector;
47 class SVX_DLLPUBLIC ObjectContact
49 private:
50 // make ViewObjectContact a friend to exclusively allow it to use
51 // AddViewObjectContact/RemoveViewObjectContact
52 friend class ViewObjectContact;
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;
59 // A new ViewObjectContact was created and shall be remembered.
60 void AddViewObjectContact(ViewObjectContact& rVOContact);
62 // A ViewObjectContact was deleted and shall be forgotten.
63 void RemoveViewObjectContact(ViewObjectContact& rVOContact);
65 // the primitiveAnimator which is used if this View and/or the contained primitives
66 // support animatedSwitchPrimitives
67 sdr::animation::primitiveAnimator maPrimitiveAnimator;
69 // the EventHandler for e.g. asynchronious loading of graphics
70 sdr::event::TimerEventHandler* mpEventHandler;
72 // The redirector. If set it is used to pipe all supported calls
73 // to the redirector
74 ViewObjectContactRedirector* mpViewObjectContactRedirector;
76 // the Primitive2DParameters containing view information
77 drawinglayer::geometry::ViewInformation2D maViewInformation2D;
79 // bitfield
80 // flag for preview renderer
81 bool mbIsPreviewRenderer : 1;
83 // method to create a EventHandler. Needs to give a result.
84 static sdr::event::TimerEventHandler* CreateEventHandler();
86 protected:
87 // Interface to allow derivates to travel over the registered VOC's
88 sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
89 ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
91 // interface to allow derivates to set PreviewRenderer flag
92 void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
94 // interface to allow derivates to set ViewInformation2D
95 void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
97 public:
98 // basic constructor
99 ObjectContact();
100 virtual ~ObjectContact();
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);
108 // call this to support evtl. preparations for repaint. Default does nothing
109 virtual void PrepareProcessDisplay();
111 // Process the whole displaying
112 virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
114 // test if visualizing of entered groups is switched on at all. Default
115 // implementation returns sal_False.
116 virtual bool DoVisualizeEnteredGroup() const;
118 // get active group's (the entered group) ViewContact
119 virtual const ViewContact* getActiveViewContact() const;
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;
125 // Get info if given Rectangle is visible in this view
126 virtual bool IsAreaVisible(const basegfx::B2DRange& rRange) const;
128 // Get info about the need to visualize GluePoints. The default
129 // is that it is not necessary.
130 virtual bool AreGluePointsVisible() const;
132 // method to get the primitiveAnimator
133 sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; }
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;
139 // delete the EventHandler
140 void DeleteEventHandler();
142 // test if there is an EventHandler without creating one on demand
143 bool HasEventHandler() const;
145 // check if text animation is allowed. Default is sal_true.
146 virtual bool IsTextAnimationAllowed() const;
148 // check if graphic animation is allowed. Default is sal_true.
149 virtual bool IsGraphicAnimationAllowed() const;
151 // check if asynchronious graphis loading is allowed. Default is sal_False.
152 virtual bool IsAsynchronGraphicsLoadingAllowed() const;
154 // access to ViewObjectContactRedirector
155 ViewObjectContactRedirector* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector; }
156 void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
158 // check if buffering of MasterPages is allowed. Default is sal_False.
159 virtual bool IsMasterPageBufferingAllowed() const;
161 // print? Default is false
162 virtual bool isOutputToPrinter() const;
164 // window? Default is true
165 virtual bool isOutputToWindow() const;
167 // VirtualDevice? Default is false
168 virtual bool isOutputToVirtualDevice() const;
170 // recording MetaFile? Default is false
171 virtual bool isOutputToRecordingMetaFile() const;
173 // pdf export? Default is false
174 virtual bool isOutputToPDFFile() const;
176 // gray display mode
177 virtual bool isDrawModeGray() const;
179 // gray display mode
180 virtual bool isDrawModeBlackWhite() const;
182 // high contrast display mode
183 virtual bool isDrawModeHighContrast() const;
185 // check if this is a preview renderer. Default is sal_False.
186 bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
188 // get Primitive2DParameters for this view
189 const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
191 /// access to SdrPageView. May return 0L like the default implementations do. Override as needed.
192 virtual SdrPageView* TryToGetSdrPageView() const;
194 /// access to OutputDevice. May return 0L like the default implementations do. Override as needed.
195 virtual OutputDevice* TryToGetOutputDevice() const;
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();
210 #endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */