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>
23 #include <svx/svdpage.hxx>
27 
28 #include <eventhandler.hxx>
29 
30 using namespace com::sun::star;
31 
32 namespace sdr { namespace contact {
33 
34 bool ObjectContact::supportsGridOffsets() const
35 {
36  // default does not support GridOffset
37  return false;
38 }
39 
40 void ObjectContact::calculateGridOffsetForViewOjectContact(
41  basegfx::B2DVector& /*rTarget*/,
42  const ViewObjectContact& /*rClient*/) const
43 {
44  // default does not on-demand calculate GridOffset
45 }
46 
47 void ObjectContact::calculateGridOffsetForB2DRange(
48  basegfx::B2DVector& /*rTarget*/,
49  const basegfx::B2DRange& /*rB2DRange*/) const
50 {
51  // default does not on-demand calculate GridOffset
52 }
53 
54 ObjectContact::ObjectContact()
55 : maViewObjectContactVector(),
56  maPrimitiveAnimator(),
57  mpViewObjectContactRedirector(nullptr),
58  maViewInformation2D(uno::Sequence< beans::PropertyValue >()),
59  mbIsPreviewRenderer(false)
60 {
61 }
62 
63 ObjectContact::~ObjectContact() COVERITY_NOEXCEPT_FALSE
64 {
65  // get rid of all registered contacts
66  // #i84257# To avoid that each 'delete pCandidate' again uses
67  // the local RemoveViewObjectContact with a search and removal in the
68  // vector, simply copy and clear local vector.
69  std::vector< ViewObjectContact* > aLocalVOCList;
70  aLocalVOCList.swap(maViewObjectContactVector);
71 
72  for (const auto & pCandidate : aLocalVOCList)
73  // ViewObjectContacts only make sense with View and Object contacts.
74  // When the contact to the SdrObject is deleted like in this case,
75  // all ViewObjectContacts can be deleted, too.
76  delete pCandidate;
77 
78  // assert when there were new entries added during deletion
79  DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)");
80 }
81 
82 // LazyInvalidate request. Default implementation directly handles
83 // this by calling back triggerLazyInvalidate() at the VOC
85 {
86  rVOC.triggerLazyInvalidate();
87 }
88 
89 // call this to support evtl. preparations for repaint. Default does nothing
91 {
92 }
93 
94 // A new ViewObjectContact was created and shall be remembered.
96 {
97  maViewObjectContactVector.push_back(&rVOContact);
98 }
99 
100 // A ViewObjectContact was deleted and shall be forgotten.
102 {
103  std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
104 
105  if(aFindResult != maViewObjectContactVector.end())
106  {
107  maViewObjectContactVector.erase(aFindResult);
108  }
109 }
110 
111 // Process the whole displaying
113 {
114  // default does nothing
115 }
116 
117 // test if visualizing of entered groups is switched on at all
119 {
120  // Do not do that as default
121  return false;
122 }
123 
124 // get active group's (the entered group) ViewContact
126 {
127  // default has no active VC
128  return nullptr;
129 }
130 
131 // Invalidate given rectangle at the window/output which is represented by
132 // this ObjectContact.
134 {
135  // nothing to do here in the default version
136 }
137 
138 // Get info about the need to visualize GluePoints
140 {
141  return false;
142 }
143 
144 // check if text animation is allowed. Default is sal_true.
146 {
147  return true;
148 }
149 
150 // check if graphic animation is allowed. Default is sal_true.
152 {
153  return true;
154 }
155 
157 {
159  {
161  }
162 }
163 
164 // print? Default is false
166 {
167  return false;
168 }
169 
170 // recording MetaFile? Default is false
172 {
173  return false;
174 }
175 
176 // pdf export? Default is false
178 {
179  return false;
180 }
181 
182 // gray display mode
184 {
185  return false;
186 }
187 
188 // high contrast display mode
190 {
191  return false;
192 }
193 
194 // access to SdrPageView. Default implementation returns NULL
196 {
197  return nullptr;
198 }
199 
200 // access to OutputDevice. Default implementation returns NULL
202 {
203  return nullptr;
204 }
205 
207 {
208  const sal_uInt32 nVOCCount(getViewObjectContactCount());
209 
210  for(sal_uInt32 a(0); a < nVOCCount; a++)
211  {
213  assert(pVOC && "ObjectContact: ViewObjectContact list Corrupt (!)");
214  pVOC->resetGridOffset();
215  }
216 }
217 
218 }}
219 
220 /* 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