LibreOffice Module svx (master)  1
objectcontact.cxx
Go to the documentation of this file.
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 
21 #include <tools/debug.hxx>
24 
25 using namespace com::sun::star;
26 
27 namespace sdr::contact {
28 
29 bool ObjectContact::supportsGridOffsets() const
30 {
31  // default does not support GridOffset
32  return false;
33 }
34 
35 void ObjectContact::calculateGridOffsetForViewOjectContact(
36  basegfx::B2DVector& /*rTarget*/,
37  const ViewObjectContact& /*rClient*/) const
38 {
39  // default does not on-demand calculate GridOffset
40 }
41 
42 void ObjectContact::calculateGridOffsetForB2DRange(
43  basegfx::B2DVector& /*rTarget*/,
44  const basegfx::B2DRange& /*rB2DRange*/) const
45 {
46  // default does not on-demand calculate GridOffset
47 }
48 
49 ObjectContact::ObjectContact()
50 : maViewObjectContactVector(),
51  maPrimitiveAnimator(),
52  mpViewObjectContactRedirector(nullptr),
53  maViewInformation2D(uno::Sequence< beans::PropertyValue >()),
54  mbIsPreviewRenderer(false)
55 {
56 }
57 
58 ObjectContact::~ObjectContact() COVERITY_NOEXCEPT_FALSE
59 {
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);
66 
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;
72 
73  // assert when there were new entries added during deletion
74  DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)");
75 }
76 
77 // LazyInvalidate request. Default implementation directly handles
78 // this by calling back triggerLazyInvalidate() at the VOC
80 {
81  rVOC.triggerLazyInvalidate();
82 }
83 
84 // call this to support evtl. preparations for repaint. Default does nothing
86 {
87 }
88 
89 // A new ViewObjectContact was created and shall be remembered.
91 {
92  maViewObjectContactVector.push_back(&rVOContact);
93 }
94 
95 // A ViewObjectContact was deleted and shall be forgotten.
97 {
98  std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
99 
100  if(aFindResult != maViewObjectContactVector.end())
101  {
102  maViewObjectContactVector.erase(aFindResult);
103  }
104 }
105 
106 // Process the whole displaying
108 {
109  // default does nothing
110 }
111 
112 // test if visualizing of entered groups is switched on at all
114 {
115  // Do not do that as default
116  return false;
117 }
118 
119 // get active group's (the entered group) ViewContact
121 {
122  // default has no active VC
123  return nullptr;
124 }
125 
126 // Invalidate given rectangle at the window/output which is represented by
127 // this ObjectContact.
129 {
130  // nothing to do here in the default version
131 }
132 
133 // Get info about the need to visualize GluePoints
135 {
136  return false;
137 }
138 
139 // check if text animation is allowed. Default is sal_true.
141 {
142  return true;
143 }
144 
145 // check if graphic animation is allowed. Default is sal_true.
147 {
148  return true;
149 }
150 
152 {
154  {
156  }
157 }
158 
159 // print? Default is false
161 {
162  return false;
163 }
164 
165 // recording MetaFile? Default is false
167 {
168  return false;
169 }
170 
171 // pdf export? Default is false
173 {
174  return false;
175 }
176 
177 // gray display mode
179 {
180  return false;
181 }
182 
183 // high contrast display mode
185 {
186  return false;
187 }
188 
189 // access to SdrPageView. Default implementation returns NULL
191 {
192  return nullptr;
193 }
194 
195 // access to OutputDevice. Default implementation returns NULL
197 {
198  return nullptr;
199 }
200 
202 {
203  const sal_uInt32 nVOCCount(getViewObjectContactCount());
204 
205  for(sal_uInt32 a(0); a < nVOCCount; a++)
206  {
208  assert(pVOC && "ObjectContact: ViewObjectContact list Corrupt (!)");
209  pVOC->resetGridOffset();
210  }
211 }
212 
213 }
214 
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void InvalidatePartOfView(const basegfx::B2DRange &rRange) const
virtual bool isDrawModeHighContrast() const
virtual void PrepareProcessDisplay()
virtual bool AreGluePointsVisible() const
void RemoveViewObjectContact(ViewObjectContact &rVOContact)
virtual void setLazyInvalidate(ViewObjectContact &rVOC)
ViewObjectContactRedirector * mpViewObjectContactRedirector
virtual bool isOutputToPrinter() const
virtual bool isOutputToPDFFile() const
#define DBG_ASSERT(sCon, aError)
uno_Any a
void SetViewObjectContactRedirector(ViewObjectContactRedirector *pNew)
ViewObjectContact * getViewObjectContact(sal_uInt32 a) const
virtual bool IsTextAnimationAllowed() const
std::vector< ViewObjectContact * > maViewObjectContactVector
void AddViewObjectContact(ViewObjectContact &rVOContact)
virtual bool isOutputToRecordingMetaFile() const
sal_uInt32 getViewObjectContactCount() const
virtual bool DoVisualizeEnteredGroup() const
virtual void ProcessDisplay(DisplayInfo &rDisplayInfo)
virtual OutputDevice * TryToGetOutputDevice() const
access to OutputDevice. May return 0L like the default implementations do. Override as needed...
virtual bool isDrawModeGray() const
virtual bool IsGraphicAnimationAllowed() const
virtual const ViewContact * getActiveViewContact() const
virtual SdrPageView * TryToGetSdrPageView() const
access to SdrPageView. May return 0L like the default implementations do. Override as needed...
virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE