bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / sdr / contact / objectcontact.cxx
blobee623c0625906110586a40f558cdc54686be7ab0
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/sdr/contact/viewcontact.hxx>
25 using namespace com::sun::star;
27 namespace sdr::contact {
29 bool ObjectContact::supportsGridOffsets() const
31 // default does not support GridOffset
32 return false;
35 void ObjectContact::calculateGridOffsetForViewOjectContact(
36 basegfx::B2DVector& /*rTarget*/,
37 const ViewObjectContact& /*rClient*/) const
39 // default does not on-demand calculate GridOffset
42 void ObjectContact::calculateGridOffsetForB2DRange(
43 basegfx::B2DVector& /*rTarget*/,
44 const basegfx::B2DRange& /*rB2DRange*/) const
46 // default does not on-demand calculate GridOffset
49 ObjectContact::ObjectContact()
50 : maViewObjectContactVector(),
51 maPrimitiveAnimator(),
52 mpViewObjectContactRedirector(nullptr),
53 maViewInformation2D(uno::Sequence< beans::PropertyValue >()),
54 mbIsPreviewRenderer(false)
58 ObjectContact::~ObjectContact() COVERITY_NOEXCEPT_FALSE
60 // get rid of all registered contacts
61 // #i84257# To avoid that each 'delete pCandidate' again uses
62 // the local RemoveViewObjectContact with a search and removal in the
63 // vector, simply copy and clear local vector.
64 std::vector< ViewObjectContact* > aLocalVOCList;
65 aLocalVOCList.swap(maViewObjectContactVector);
67 for (const auto & pCandidate : aLocalVOCList)
68 // ViewObjectContacts only make sense with View and Object contacts.
69 // When the contact to the SdrObject is deleted like in this case,
70 // all ViewObjectContacts can be deleted, too.
71 delete pCandidate;
73 // assert when there were new entries added during deletion
74 DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)");
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 // Do 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 nullptr;
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 about the need to visualize GluePoints
134 bool ObjectContact::AreGluePointsVisible() const
136 return false;
139 // check if text animation is allowed. Default is sal_true.
140 bool ObjectContact::IsTextAnimationAllowed() const
142 return true;
145 // check if graphic animation is allowed. Default is sal_true.
146 bool ObjectContact::IsGraphicAnimationAllowed() const
148 return true;
151 void ObjectContact::SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew)
153 if(mpViewObjectContactRedirector != pNew)
155 mpViewObjectContactRedirector = pNew;
159 // print? Default is false
160 bool ObjectContact::isOutputToPrinter() const
162 return false;
165 // recording MetaFile? Default is false
166 bool ObjectContact::isOutputToRecordingMetaFile() const
168 return false;
171 // pdf export? Default is false
172 bool ObjectContact::isOutputToPDFFile() const
174 return false;
177 // gray display mode
178 bool ObjectContact::isDrawModeGray() const
180 return false;
183 // high contrast display mode
184 bool ObjectContact::isDrawModeHighContrast() const
186 return false;
189 // access to SdrPageView. Default implementation returns NULL
190 SdrPageView* ObjectContact::TryToGetSdrPageView() const
192 return nullptr;
195 // access to OutputDevice. Default implementation returns NULL
196 OutputDevice* ObjectContact::TryToGetOutputDevice() const
198 return nullptr;
201 void ObjectContact::resetAllGridOffsets()
203 const sal_uInt32 nVOCCount(getViewObjectContactCount());
205 for(sal_uInt32 a(0); a < nVOCCount; a++)
207 ViewObjectContact* pVOC(getViewObjectContact(a));
208 assert(pVOC && "ObjectContact: ViewObjectContact list Corrupt (!)");
209 pVOC->resetGridOffset();
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */