fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / sdr / contact / objectcontact.cxx
blob46fec7ed05098e9e009242fb24864506caa83d8c
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 #include <svx/sdr/contact/objectcontact.hxx>
21 #include <tools/debug.hxx>
22 #include <svx/sdr/contact/viewobjectcontact.hxx>
23 #include <svx/svdpage.hxx>
24 #include <svx/sdr/contact/viewcontact.hxx>
25 #include <svx/sdr/event/eventhandler.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
27 #include <svx/sdr/animation/objectanimator.hxx>
29 //////////////////////////////////////////////////////////////////////////////
31 using namespace com::sun::star;
33 //////////////////////////////////////////////////////////////////////////////
35 namespace sdr
37 namespace contact
39 ObjectContact::ObjectContact()
40 : maViewObjectContactVector(),
41 maPrimitiveAnimator(),
42 mpEventHandler(0),
43 mpViewObjectContactRedirector(0),
44 maViewInformation2D(uno::Sequence< beans::PropertyValue >()),
45 mbIsPreviewRenderer(false)
49 ObjectContact::~ObjectContact()
51 // get rid of all registered contacts
52 // #i84257# To avoid that each 'delete pCandidate' again uses
53 // the local RemoveViewObjectContact with a search and removal in the
54 // vector, simply copy and clear local vector.
55 std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector);
56 maViewObjectContactVector.clear();
58 while(!aLocalVOCList.empty())
60 ViewObjectContact* pCandidate = aLocalVOCList.back();
61 aLocalVOCList.pop_back();
62 DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList (!)");
64 // ViewObjectContacts only make sense with View and Object contacts.
65 // When the contact to the SdrObject is deleted like in this case,
66 // all ViewObjectContacts can be deleted, too.
67 delete pCandidate;
70 // assert when there were new entries added during deletion
71 DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)");
73 // delete the EventHandler. This will destroy all still contained events.
74 DeleteEventHandler();
77 // LazyInvalidate request. Default implementation directly handles
78 // this by calling back triggerLazyInvalidate() at the VOC
79 void ObjectContact::setLazyInvalidate(ViewObjectContact& rVOC)
81 rVOC.triggerLazyInvalidate();
84 // call this to support evtl. preparations for repaint. Default does nothing
85 void ObjectContact::PrepareProcessDisplay()
89 // A new ViewObjectContact was created and shall be remembered.
90 void ObjectContact::AddViewObjectContact(ViewObjectContact& rVOContact)
92 maViewObjectContactVector.push_back(&rVOContact);
95 // A ViewObjectContact was deleted and shall be forgotten.
96 void ObjectContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
98 std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
100 if(aFindResult != maViewObjectContactVector.end())
102 maViewObjectContactVector.erase(aFindResult);
106 // Process the whole displaying
107 void ObjectContact::ProcessDisplay(DisplayInfo& /*rDisplayInfo*/)
109 // default does nothing
112 // test if visualizing of entered groups is switched on at all
113 bool ObjectContact::DoVisualizeEnteredGroup() const
115 // Don not do that as default
116 return false;
119 // get active group's (the entered group) ViewContact
120 const ViewContact* ObjectContact::getActiveViewContact() const
122 // default has no active VC
123 return 0;
126 // Invalidate given rectangle at the window/output which is represented by
127 // this ObjectContact.
128 void ObjectContact::InvalidatePartOfView(const basegfx::B2DRange& /*rRange*/) const
130 // nothing to do here in the default version
133 // Get info if given Rectangle is visible in this view
134 bool ObjectContact::IsAreaVisible(const basegfx::B2DRange& /*rRange*/) const
136 // always visible in default version
137 return true;
140 // Get info about the need to visualize GluePoints
141 bool ObjectContact::AreGluePointsVisible() const
143 return false;
146 // method to create a EventHandler. Needs to give a result.
147 sdr::event::TimerEventHandler* ObjectContact::CreateEventHandler()
149 // Create and return a new EventHandler
150 return new sdr::event::TimerEventHandler();
153 // method to get the primitiveAnimator
154 sdr::animation::primitiveAnimator& ObjectContact::getPrimitiveAnimator()
156 return maPrimitiveAnimator;
159 // method to get the EventHandler. It will
160 // return a existing one or create a new one using CreateEventHandler().
161 sdr::event::TimerEventHandler& ObjectContact::GetEventHandler() const
163 if(!HasEventHandler())
165 const_cast< ObjectContact* >(this)->mpEventHandler = const_cast< ObjectContact* >(this)->CreateEventHandler();
166 DBG_ASSERT(mpEventHandler, "ObjectContact::GetEventHandler(): Got no EventHandler (!)");
169 return *mpEventHandler;
172 // delete the EventHandler
173 void ObjectContact::DeleteEventHandler()
175 if(mpEventHandler)
177 // If there are still Events registered, something has went wrong
178 delete mpEventHandler;
179 mpEventHandler = 0L;
183 // test if there is an EventHandler without creating one on demand
184 bool ObjectContact::HasEventHandler() const
186 return (0L != mpEventHandler);
189 // check if text animation is allowed. Default is sal_true.
190 bool ObjectContact::IsTextAnimationAllowed() const
192 return true;
195 // check if graphic animation is allowed. Default is sal_true.
196 bool ObjectContact::IsGraphicAnimationAllowed() const
198 return true;
201 // check if asynchronious graphis loading is allowed. Default is false.
202 bool ObjectContact::IsAsynchronGraphicsLoadingAllowed() const
204 return false;
207 // access to ViewObjectContactRedirector
208 ViewObjectContactRedirector* ObjectContact::GetViewObjectContactRedirector() const
210 return mpViewObjectContactRedirector;
213 void ObjectContact::SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew)
215 if(mpViewObjectContactRedirector != pNew)
217 mpViewObjectContactRedirector = pNew;
221 // check if buffering of MasterPages is allowed. Default is false.
222 bool ObjectContact::IsMasterPageBufferingAllowed() const
224 return false;
227 // print? Default is false
228 bool ObjectContact::isOutputToPrinter() const
230 return false;
233 // window? Default is true
234 bool ObjectContact::isOutputToWindow() const
236 return true;
239 // VirtualDevice? Default is false
240 bool ObjectContact::isOutputToVirtualDevice() const
242 return false;
245 // recording MetaFile? Default is false
246 bool ObjectContact::isOutputToRecordingMetaFile() const
248 return false;
251 // pdf export? Default is false
252 bool ObjectContact::isOutputToPDFFile() const
254 return false;
257 // gray display mode
258 bool ObjectContact::isDrawModeGray() const
260 return false;
263 // gray display mode
264 bool ObjectContact::isDrawModeBlackWhite() const
266 return false;
269 // high contrast display mode
270 bool ObjectContact::isDrawModeHighContrast() const
272 return false;
275 // access to SdrPageView. Default implementation returns NULL
276 SdrPageView* ObjectContact::TryToGetSdrPageView() const
278 return 0;
281 // access to OutputDevice. Default implementation returns NULL
282 OutputDevice* ObjectContact::TryToGetOutputDevice() const
284 return 0;
287 void ObjectContact::resetViewPort()
289 const drawinglayer::geometry::ViewInformation2D& rCurrentVI2D = getViewInformation2D();
291 if(!rCurrentVI2D.getViewport().isEmpty())
293 const basegfx::B2DRange aEmptyRange;
295 drawinglayer::geometry::ViewInformation2D aNewVI2D(
296 rCurrentVI2D.getObjectTransformation(),
297 rCurrentVI2D.getViewTransformation(),
298 aEmptyRange,
299 rCurrentVI2D.getVisualizedPage(),
300 rCurrentVI2D.getViewTime(),
301 rCurrentVI2D.getExtendedInformationSequence());
303 updateViewInformation2D(aNewVI2D);
307 } // end of namespace contact
308 } // end of namespace sdr
310 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */