/src/libreoffice/svx/source/sdr/contact/objectcontact.cxx
Line | Count | Source |
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 | | |
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> |
24 | | |
25 | | using namespace com::sun::star; |
26 | | |
27 | | namespace sdr::contact { |
28 | | |
29 | | bool ObjectContact::supportsGridOffsets() const |
30 | 1.60k | { |
31 | | // default does not support GridOffset |
32 | 1.60k | return false; |
33 | 1.60k | } |
34 | | |
35 | | void ObjectContact::calculateGridOffsetForViewObjectContact( |
36 | | basegfx::B2DVector& /*rTarget*/, |
37 | | const ViewObjectContact& /*rClient*/) const |
38 | 0 | { |
39 | | // default does not on-demand calculate GridOffset |
40 | 0 | } |
41 | | |
42 | | void ObjectContact::calculateGridOffsetForB2DRange( |
43 | | basegfx::B2DVector& /*rTarget*/, |
44 | | const basegfx::B2DRange& /*rB2DRange*/) const |
45 | 0 | { |
46 | | // default does not on-demand calculate GridOffset |
47 | 0 | } |
48 | | |
49 | | ObjectContact::ObjectContact() |
50 | 73.9k | : mpViewObjectContactRedirector(nullptr), |
51 | 73.9k | mbIsPreviewRenderer(false) |
52 | 73.9k | { |
53 | 73.9k | } |
54 | | |
55 | | ObjectContact::~ObjectContact() |
56 | 73.9k | { |
57 | | // get rid of all registered contacts |
58 | | // #i84257# To avoid that each 'delete pCandidate' again uses |
59 | | // the local RemoveViewObjectContact with a search and removal in the |
60 | | // vector, simply copy and clear local vector. |
61 | 73.9k | std::vector< ViewObjectContact* > aLocalVOCList; |
62 | 73.9k | aLocalVOCList.swap(maViewObjectContactVector); |
63 | | |
64 | 73.9k | for (const auto & pCandidate : aLocalVOCList) |
65 | | // ViewObjectContacts only make sense with View and Object contacts. |
66 | | // When the contact to the SdrObject is deleted like in this case, |
67 | | // all ViewObjectContacts can be deleted, too. |
68 | 106k | delete pCandidate; |
69 | | |
70 | | // assert when there were new entries added during deletion |
71 | 73.9k | DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)"); |
72 | 73.9k | } |
73 | | |
74 | | // LazyInvalidate request. Default implementation directly handles |
75 | | // this by calling back triggerLazyInvalidate() at the VOC |
76 | | void ObjectContact::setLazyInvalidate(ViewObjectContact& rVOC) |
77 | 0 | { |
78 | 0 | rVOC.triggerLazyInvalidate(); |
79 | 0 | } |
80 | | |
81 | | // call this to support evtl. preparations for repaint. Default does nothing |
82 | | void ObjectContact::PrepareProcessDisplay() |
83 | 0 | { |
84 | 0 | } |
85 | | |
86 | | // A new ViewObjectContact was created and shall be remembered. |
87 | | void ObjectContact::AddViewObjectContact(ViewObjectContact& rVOContact) |
88 | 106k | { |
89 | 106k | maViewObjectContactVector.push_back(&rVOContact); |
90 | 106k | } |
91 | | |
92 | | // A ViewObjectContact was deleted and shall be forgotten. |
93 | | void ObjectContact::RemoveViewObjectContact(ViewObjectContact& rVOContact) |
94 | 106k | { |
95 | 106k | std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact); |
96 | | |
97 | 106k | if(aFindResult != maViewObjectContactVector.end()) |
98 | 0 | { |
99 | 0 | maViewObjectContactVector.erase(aFindResult); |
100 | 0 | } |
101 | 106k | } |
102 | | |
103 | | // Process the whole displaying |
104 | | void ObjectContact::ProcessDisplay(DisplayInfo& /*rDisplayInfo*/) |
105 | 0 | { |
106 | | // default does nothing |
107 | 0 | } |
108 | | |
109 | | // test if visualizing of entered groups is switched on at all |
110 | | bool ObjectContact::DoVisualizeEnteredGroup() const |
111 | 583 | { |
112 | | // Do not do that as default |
113 | 583 | return false; |
114 | 583 | } |
115 | | |
116 | | // get active group's (the entered group) ViewContact |
117 | | const ViewContact* ObjectContact::getActiveViewContact() const |
118 | 0 | { |
119 | | // default has no active VC |
120 | 0 | return nullptr; |
121 | 0 | } |
122 | | |
123 | | // Invalidate given rectangle at the window/output which is represented by |
124 | | // this ObjectContact. |
125 | | void ObjectContact::InvalidatePartOfView(const basegfx::B2DRange& /*rRange*/) const |
126 | 1.60k | { |
127 | | // nothing to do here in the default version |
128 | 1.60k | } |
129 | | |
130 | | // Get info about the need to visualize GluePoints |
131 | | bool ObjectContact::AreGluePointsVisible() const |
132 | 422 | { |
133 | 422 | return false; |
134 | 422 | } |
135 | | |
136 | | // check if text animation is allowed. Default is sal_true. |
137 | | bool ObjectContact::IsTextAnimationAllowed() const |
138 | 422 | { |
139 | 422 | return true; |
140 | 422 | } |
141 | | |
142 | | // check if graphic animation is allowed. Default is sal_true. |
143 | | bool ObjectContact::IsGraphicAnimationAllowed() const |
144 | 422 | { |
145 | 422 | return true; |
146 | 422 | } |
147 | | |
148 | | void ObjectContact::SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew) |
149 | 445k | { |
150 | 445k | if(mpViewObjectContactRedirector != pNew) |
151 | 445k | { |
152 | 445k | mpViewObjectContactRedirector = pNew; |
153 | 445k | } |
154 | 445k | } |
155 | | |
156 | | // print? Default is false |
157 | | bool ObjectContact::isOutputToPrinter() const |
158 | 1.26k | { |
159 | 1.26k | return false; |
160 | 1.26k | } |
161 | | |
162 | | // display page decoration? Default is true |
163 | | bool ObjectContact::isPageDecorationActive() const |
164 | 0 | { |
165 | 0 | return true; |
166 | 0 | } |
167 | | |
168 | | // display mster page content (ViewContactOfMasterPage)? Default is true |
169 | | bool ObjectContact::isMasterPageActive() const |
170 | 0 | { |
171 | 0 | return true; |
172 | 0 | } |
173 | | |
174 | | // recording MetaFile? Default is false |
175 | | bool ObjectContact::isOutputToRecordingMetaFile() const |
176 | 0 | { |
177 | 0 | return false; |
178 | 0 | } |
179 | | |
180 | | // pdf export? Default is false |
181 | | bool ObjectContact::isOutputToPDFFile() const |
182 | 0 | { |
183 | 0 | return false; |
184 | 0 | } |
185 | | |
186 | | bool ObjectContact::isExportTaggedPDF() const |
187 | 0 | { |
188 | 0 | return false; |
189 | 0 | } |
190 | | |
191 | | ::vcl::PDFExtOutDevData const* ObjectContact::GetPDFExtOutDevData() const |
192 | 0 | { |
193 | 0 | return nullptr; |
194 | 0 | } |
195 | | |
196 | | // gray display mode |
197 | | bool ObjectContact::isDrawModeGray() const |
198 | 0 | { |
199 | 0 | return false; |
200 | 0 | } |
201 | | |
202 | | // high contrast display mode |
203 | | bool ObjectContact::isDrawModeHighContrast() const |
204 | 0 | { |
205 | 0 | return false; |
206 | 0 | } |
207 | | |
208 | | // access to SdrPageView. Default implementation returns NULL |
209 | | SdrPageView* ObjectContact::TryToGetSdrPageView() const |
210 | 839 | { |
211 | 839 | return nullptr; |
212 | 839 | } |
213 | | |
214 | | // access to OutputDevice. Default implementation returns NULL |
215 | | OutputDevice* ObjectContact::TryToGetOutputDevice() const |
216 | 0 | { |
217 | 0 | return nullptr; |
218 | 0 | } |
219 | | |
220 | | void ObjectContact::resetAllGridOffsets() |
221 | 0 | { |
222 | 0 | const sal_uInt32 nVOCCount(getViewObjectContactCount()); |
223 | |
|
224 | 0 | for(sal_uInt32 a(0); a < nVOCCount; a++) |
225 | 0 | { |
226 | 0 | ViewObjectContact* pVOC(getViewObjectContact(a)); |
227 | | assert(pVOC && "ObjectContact: ViewObjectContact list Corrupt (!)"); |
228 | 0 | pVOC->resetGridOffset(); |
229 | 0 | } |
230 | 0 | } |
231 | | |
232 | | } |
233 | | |
234 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |