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