clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name fuoaprms.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -isystem /usr/include/libxml2 -isystem /usr/include/dbus-1.0 -isystem /usr/lib64/dbus-1.0/include -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SD_DLLIMPLEMENTATION -D SDUI_DLL_NAME="libsduilo.so" -D SYSTEM_LIBXML -D ENABLE_SDREMOTE -D ENABLE_SDREMOTE_BLUETOOTH -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/i18n -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/common -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/external/bluez_bluetooth/inc -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/sd/inc -I /home/maarten/src/libreoffice/core/sd/source/ui/inc -I /home/maarten/src/libreoffice/core/sd/source/ui/slidesorter/inc -I /home/maarten/src/libreoffice/core/workdir/SdiTarget/sd/sdi -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/oox/generated -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/sd/source/ui/func/fuoaprms.cxx
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | #include <fuoaprms.hxx> |
21 | #include <sdattr.hrc> |
22 | |
23 | #include <editeng/colritem.hxx> |
24 | #include <svx/svdundo.hxx> |
25 | #include <sfx2/objsh.hxx> |
26 | #include <sfx2/request.hxx> |
27 | #include <sfx2/viewfrm.hxx> |
28 | #include <sfx2/sfxdlg.hxx> |
29 | #include <svl/aeitem.hxx> |
30 | #include <svl/intitem.hxx> |
31 | #include <svl/stritem.hxx> |
32 | #include <svx/svdopath.hxx> |
33 | #include <tools/debug.hxx> |
34 | |
35 | #include <strings.hrc> |
36 | #include <drawdoc.hxx> |
37 | #include <ViewShell.hxx> |
38 | #include <ViewShellBase.hxx> |
39 | #include <anminfo.hxx> |
40 | #include <unoaprms.hxx> |
41 | #include <sdundogr.hxx> |
42 | #include <View.hxx> |
43 | #include <sdabstdlg.hxx> |
44 | #include <sdresid.hxx> |
45 | #include <tools/helpers.hxx> |
46 | #include <basegfx/polygon/b2dpolygon.hxx> |
47 | #include <memory> |
48 | |
49 | using namespace ::com::sun::star; |
50 | |
51 | namespace sd { |
52 | |
53 | |
54 | #define ATTR_MISSING 0 ///< Attribute missing |
55 | #define ATTR_MIXED 1 ///< Attribute ambiguous (on multi-selection) |
56 | #define ATTR_SET 2 ///< Attribute unique |
57 | |
58 | FuObjectAnimationParameters::FuObjectAnimationParameters ( |
59 | ViewShell* pViewSh, |
60 | ::sd::Window* pWin, |
61 | ::sd::View* pView, |
62 | SdDrawDocument* pDoc, |
63 | SfxRequest& rReq) |
64 | : FuPoor(pViewSh, pWin, pView, pDoc, rReq) |
65 | { |
66 | } |
67 | |
68 | rtl::Reference<FuPoor> FuObjectAnimationParameters::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) |
69 | { |
70 | rtl::Reference<FuPoor> xFunc( new FuObjectAnimationParameters( pViewSh, pWin, pView, pDoc, rReq ) ); |
71 | xFunc->DoExecute(rReq); |
72 | return xFunc; |
73 | } |
74 | |
75 | void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq ) |
76 | { |
77 | SfxUndoManager* pUndoMgr = mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager(); |
78 | |
79 | const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); |
80 | const size_t nCount = rMarkList.GetMarkCount(); |
81 | |
82 | short nAnimationSet = ATTR_MISSING; |
83 | short nEffectSet = ATTR_MISSING; |
84 | short nTextEffectSet = ATTR_MISSING; |
85 | short nSpeedSet = ATTR_MISSING; |
86 | short nFadeColorSet = ATTR_MISSING; |
87 | short nFadeOutSet = ATTR_MISSING; |
88 | short nInvisibleSet = ATTR_MISSING; |
89 | short nSoundOnSet = ATTR_MISSING; |
90 | short nSoundFileSet = ATTR_MISSING; |
91 | short nPlayFullSet = ATTR_MISSING; |
92 | short nClickActionSet = ATTR_MISSING; |
93 | short nBookmarkSet = ATTR_MISSING; |
94 | |
95 | short nSecondEffectSet = ATTR_MISSING; |
96 | short nSecondSpeedSet = ATTR_MISSING; |
97 | short nSecondSoundOnSet = ATTR_MISSING; |
98 | short nSecondPlayFullSet = ATTR_MISSING; |
99 | |
100 | |
101 | presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE; |
102 | presentation::AnimationEffect eTextEffect = presentation::AnimationEffect_NONE; |
103 | presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM; |
104 | bool bActive = false; |
105 | bool bFadeOut = false; |
106 | Color aFadeColor = COL_LIGHTGRAY; |
107 | bool bInvisible = false; |
108 | bool bSoundOn = false; |
109 | OUString aSound; |
110 | bool bPlayFull = false; |
111 | presentation::ClickAction eClickAction = presentation::ClickAction_NONE; |
112 | OUString aBookmark; |
113 | |
114 | presentation::AnimationEffect eSecondEffect = presentation::AnimationEffect_NONE; |
115 | presentation::AnimationSpeed eSecondSpeed = presentation::AnimationSpeed_MEDIUM; |
116 | bool bSecondSoundOn = false; |
117 | bool bSecondPlayFull = false; |
118 | |
119 | SdAnimationInfo* pInfo; |
120 | SdrMark* pMark; |
121 | |
122 | |
123 | pMark = rMarkList.GetMark(0); |
124 | pInfo = SdDrawDocument::GetAnimationInfo(pMark->GetMarkedSdrObj()); |
125 | if( pInfo ) |
| 1 | Assuming 'pInfo' is null | |
|
| |
126 | { |
127 | bActive = pInfo->mbActive; |
128 | nAnimationSet = ATTR_SET; |
129 | |
130 | eEffect = pInfo->meEffect; |
131 | nEffectSet = ATTR_SET; |
132 | |
133 | eTextEffect = pInfo->meTextEffect; |
134 | nTextEffectSet = ATTR_SET; |
135 | |
136 | eSpeed = pInfo->meSpeed; |
137 | nSpeedSet = ATTR_SET; |
138 | |
139 | bFadeOut = pInfo->mbDimPrevious; |
140 | nFadeOutSet = ATTR_SET; |
141 | |
142 | aFadeColor = pInfo->maDimColor; |
143 | nFadeColorSet = ATTR_SET; |
144 | |
145 | bInvisible = pInfo->mbDimHide; |
146 | nInvisibleSet = ATTR_SET; |
147 | |
148 | bSoundOn = pInfo->mbSoundOn; |
149 | nSoundOnSet = ATTR_SET; |
150 | |
151 | aSound = pInfo->maSoundFile; |
152 | nSoundFileSet = ATTR_SET; |
153 | |
154 | bPlayFull = pInfo->mbPlayFull; |
155 | nPlayFullSet = ATTR_SET; |
156 | |
157 | eClickAction = pInfo->meClickAction; |
158 | nClickActionSet = ATTR_SET; |
159 | |
160 | aBookmark = pInfo->GetBookmark(); |
161 | nBookmarkSet = ATTR_SET; |
162 | |
163 | eSecondEffect = pInfo->meSecondEffect; |
164 | nSecondEffectSet = ATTR_SET; |
165 | |
166 | eSecondSpeed = pInfo->meSecondSpeed; |
167 | nSecondSpeedSet = ATTR_SET; |
168 | |
169 | bSecondSoundOn = pInfo->mbSecondSoundOn; |
170 | nSecondSoundOnSet = ATTR_SET; |
171 | |
172 | bSecondPlayFull = pInfo->mbSecondPlayFull; |
173 | nSecondPlayFullSet = ATTR_SET; |
174 | } |
175 | |
176 | |
177 | for( size_t nObject = 1; nObject < nCount; ++nObject ) |
| 3 | | Assuming 'nObject' is >= 'nCount' | |
|
| 4 | | Loop condition is false. Execution continues on line 286 | |
|
178 | { |
179 | pMark = rMarkList.GetMark( nObject ); |
180 | SdrObject* pObject = pMark->GetMarkedSdrObj(); |
181 | pInfo = SdDrawDocument::GetAnimationInfo(pObject); |
182 | if( pInfo ) |
183 | { |
184 | if( bActive != pInfo->mbActive ) |
185 | nAnimationSet = ATTR_MIXED; |
186 | |
187 | if( eEffect != pInfo->meEffect ) |
188 | nEffectSet = ATTR_MIXED; |
189 | |
190 | if( eTextEffect != pInfo->meTextEffect ) |
191 | nTextEffectSet = ATTR_MIXED; |
192 | |
193 | if( eSpeed != pInfo->meSpeed ) |
194 | nSpeedSet = ATTR_MIXED; |
195 | |
196 | if( bFadeOut != pInfo->mbDimPrevious ) |
197 | nFadeOutSet = ATTR_MIXED; |
198 | |
199 | if( aFadeColor != pInfo->maDimColor ) |
200 | nFadeColorSet = ATTR_MIXED; |
201 | |
202 | if( bInvisible != pInfo->mbDimHide ) |
203 | nInvisibleSet = ATTR_MIXED; |
204 | |
205 | if( bSoundOn != pInfo->mbSoundOn ) |
206 | nSoundOnSet = ATTR_MIXED; |
207 | |
208 | if( aSound != pInfo->maSoundFile ) |
209 | nSoundFileSet = ATTR_MIXED; |
210 | |
211 | if( bPlayFull != pInfo->mbPlayFull ) |
212 | nPlayFullSet = ATTR_MIXED; |
213 | |
214 | if( eClickAction != pInfo->meClickAction ) |
215 | nClickActionSet = ATTR_MIXED; |
216 | |
217 | if( aBookmark != pInfo->GetBookmark() ) |
218 | nBookmarkSet = ATTR_MIXED; |
219 | |
220 | if( eSecondEffect != pInfo->meSecondEffect ) |
221 | nSecondEffectSet = ATTR_MIXED; |
222 | |
223 | if( eSecondSpeed != pInfo->meSecondSpeed ) |
224 | nSecondSpeedSet = ATTR_MIXED; |
225 | |
226 | if( bSecondSoundOn != pInfo->mbSecondSoundOn ) |
227 | nSecondSoundOnSet = ATTR_MIXED; |
228 | |
229 | if( bSecondPlayFull != pInfo->mbSecondPlayFull ) |
230 | nSecondPlayFullSet = ATTR_MIXED; |
231 | } |
232 | else |
233 | { |
234 | if (nAnimationSet == ATTR_SET && bActive) |
235 | nAnimationSet = ATTR_MIXED; |
236 | |
237 | if (nEffectSet == ATTR_SET && eEffect != presentation::AnimationEffect_NONE) |
238 | nEffectSet = ATTR_MIXED; |
239 | |
240 | if (nTextEffectSet == ATTR_SET && eTextEffect != presentation::AnimationEffect_NONE) |
241 | nTextEffectSet = ATTR_MIXED; |
242 | |
243 | if (nSpeedSet == ATTR_SET) |
244 | nSpeedSet = ATTR_MIXED; |
245 | |
246 | if (nFadeOutSet == ATTR_SET && bFadeOut) |
247 | nFadeOutSet = ATTR_MIXED; |
248 | |
249 | if (nFadeColorSet == ATTR_SET) |
250 | nFadeColorSet = ATTR_MIXED; |
251 | |
252 | if (nInvisibleSet == ATTR_SET && bInvisible) |
253 | nInvisibleSet = ATTR_MIXED; |
254 | |
255 | if (nSoundOnSet == ATTR_SET && bSoundOn) |
256 | nSoundOnSet = ATTR_MIXED; |
257 | |
258 | if (nSoundFileSet == ATTR_SET) |
259 | nSoundFileSet = ATTR_MIXED; |
260 | |
261 | if (nPlayFullSet == ATTR_SET && bPlayFull) |
262 | nPlayFullSet = ATTR_MIXED; |
263 | |
264 | if (nClickActionSet == ATTR_SET && eClickAction != presentation::ClickAction_NONE) |
265 | nClickActionSet = ATTR_MIXED; |
266 | |
267 | if (nBookmarkSet == ATTR_SET) |
268 | nBookmarkSet = ATTR_MIXED; |
269 | |
270 | if (nSecondEffectSet == ATTR_SET && eSecondEffect != presentation::AnimationEffect_NONE) |
271 | nSecondEffectSet = ATTR_MIXED; |
272 | |
273 | if (nSecondSpeedSet == ATTR_SET) |
274 | nSecondSpeedSet = ATTR_MIXED; |
275 | |
276 | if (nSecondSoundOnSet == ATTR_SET && bSecondSoundOn) |
277 | nSecondSoundOnSet = ATTR_MIXED; |
278 | |
279 | if (nSecondPlayFullSet == ATTR_SET && bSecondPlayFull) |
280 | nSecondPlayFullSet = ATTR_MIXED; |
281 | } |
282 | } |
283 | |
284 | |
285 | |
286 | if (nCount == 2) |
| |
287 | { |
288 | SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj(); |
289 | SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj(); |
290 | SdrObjKind eKind1 = static_cast<SdrObjKind>(pObject1->GetObjIdentifier()); |
291 | SdrObjKind eKind2 = static_cast<SdrObjKind>(pObject2->GetObjIdentifier()); |
292 | SdAnimationInfo* pInfo1 = SdDrawDocument::GetAnimationInfo(pObject1); |
293 | SdAnimationInfo* pInfo2 = SdDrawDocument::GetAnimationInfo(pObject2); |
294 | pInfo = nullptr; |
295 | |
296 | if (pObject1->GetObjInventor() == SdrInventor::Default && |
297 | ((eKind1 == OBJ_LINE) || |
298 | (eKind1 == OBJ_PLIN) || |
299 | (eKind1 == OBJ_PATHLINE)) && |
300 | (pInfo2 && pInfo2->meEffect == presentation::AnimationEffect_PATH)) |
301 | { |
302 | pInfo = pInfo2; |
303 | } |
304 | |
305 | if (pObject2->GetObjInventor() == SdrInventor::Default && |
306 | ((eKind2 == OBJ_LINE) || |
307 | (eKind2 == OBJ_PLIN) || |
308 | (eKind2 == OBJ_PATHLINE)) && |
309 | (pInfo1 && pInfo1->meEffect == presentation::AnimationEffect_PATH)) |
310 | { |
311 | pInfo = pInfo1; |
312 | } |
313 | |
314 | if (pInfo) |
315 | { |
316 | bActive = pInfo->mbActive; nAnimationSet = ATTR_SET; |
317 | eEffect = pInfo->meEffect; nEffectSet = ATTR_SET; |
318 | eTextEffect = pInfo->meTextEffect; nTextEffectSet = ATTR_SET; |
319 | eSpeed = pInfo->meSpeed; nSpeedSet = ATTR_SET; |
320 | bFadeOut = pInfo->mbDimPrevious; nFadeOutSet = ATTR_SET; |
321 | aFadeColor = pInfo->maDimColor; nFadeColorSet = ATTR_SET; |
322 | bInvisible = pInfo->mbDimHide; nInvisibleSet = ATTR_SET; |
323 | bSoundOn = pInfo->mbSoundOn; nSoundOnSet = ATTR_SET; |
324 | aSound = pInfo->maSoundFile; nSoundFileSet = ATTR_SET; |
325 | bPlayFull = pInfo->mbPlayFull; nPlayFullSet = ATTR_SET; |
326 | eClickAction = pInfo->meClickAction; nClickActionSet = ATTR_SET; |
327 | aBookmark = pInfo->GetBookmark(); nBookmarkSet = ATTR_SET; |
328 | eSecondEffect = pInfo->meSecondEffect; nSecondEffectSet = ATTR_SET; |
329 | eSecondSpeed = pInfo->meSecondSpeed; nSecondSpeedSet = ATTR_SET; |
330 | bSecondSoundOn = pInfo->mbSecondSoundOn; nSecondSoundOnSet = ATTR_SET; |
331 | bSecondPlayFull = pInfo->mbSecondPlayFull; nSecondPlayFullSet = ATTR_SET; |
332 | } |
333 | } |
334 | |
335 | const SfxItemSet* pArgs = rReq.GetArgs(); |
336 | |
337 | if(!pArgs) |
| 6 | | Assuming 'pArgs' is null | |
|
| |
338 | { |
339 | |
340 | SfxItemSet aSet(mpDoc->GetPool(), svl::Items<ATTR_ANIMATION_START, ATTR_ACTION_END>{}); |
341 | |
342 | |
343 | if (nAnimationSet == ATTR_SET) |
| |
344 | aSet.Put( SfxBoolItem( ATTR_ANIMATION_ACTIVE, bActive)); |
345 | else if (nAnimationSet == ATTR_MIXED) |
| |
346 | aSet.InvalidateItem(ATTR_ANIMATION_ACTIVE); |
347 | else |
348 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE, false)); |
349 | |
350 | if (nEffectSet == ATTR_SET) |
| |
351 | aSet.Put(SfxUInt16Item(ATTR_ANIMATION_EFFECT, static_cast<sal_uInt16>(eEffect))); |
352 | else if (nEffectSet == ATTR_MIXED) |
| |
353 | aSet.InvalidateItem( ATTR_ANIMATION_EFFECT ); |
354 | else |
355 | aSet.Put(SfxUInt16Item(ATTR_ANIMATION_EFFECT, sal_uInt16(presentation::AnimationEffect_NONE))); |
356 | |
357 | if (nTextEffectSet == ATTR_SET) |
| |
358 | aSet.Put(SfxUInt16Item(ATTR_ANIMATION_TEXTEFFECT, static_cast<sal_uInt16>(eTextEffect))); |
359 | else if (nTextEffectSet == ATTR_MIXED) |
| |
360 | aSet.InvalidateItem( ATTR_ANIMATION_TEXTEFFECT ); |
361 | else |
362 | aSet.Put(SfxUInt16Item(ATTR_ANIMATION_TEXTEFFECT, sal_uInt16(presentation::AnimationEffect_NONE))); |
363 | |
364 | if (nSpeedSet == ATTR_SET) |
| |
365 | aSet.Put(SfxUInt16Item(ATTR_ANIMATION_SPEED, static_cast<sal_uInt16>(eSpeed))); |
366 | else |
367 | aSet.InvalidateItem(ATTR_ANIMATION_SPEED); |
368 | |
369 | if (nFadeOutSet == ATTR_SET) |
| |
370 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, bFadeOut)); |
371 | else if (nFadeOutSet == ATTR_MIXED) |
| |
372 | aSet.InvalidateItem(ATTR_ANIMATION_FADEOUT); |
373 | else |
374 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, false)); |
375 | |
376 | if (nFadeColorSet == ATTR_SET) |
| |
377 | aSet.Put(SvxColorItem(aFadeColor, ATTR_ANIMATION_COLOR)); |
378 | else if (nFadeColorSet == ATTR_MIXED) |
| |
379 | aSet.InvalidateItem(ATTR_ANIMATION_COLOR); |
380 | else |
381 | aSet.Put(SvxColorItem(COL_LIGHTGRAY, ATTR_ANIMATION_COLOR)); |
382 | |
383 | if (nInvisibleSet == ATTR_SET) |
| |
384 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, bInvisible)); |
385 | else if (nInvisibleSet == ATTR_MIXED) |
| |
386 | aSet.InvalidateItem(ATTR_ANIMATION_INVISIBLE); |
387 | else |
388 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, false)); |
389 | |
390 | if (nSoundOnSet == ATTR_SET) |
| |
391 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, bSoundOn)); |
392 | else if (nSoundOnSet == ATTR_MIXED) |
| |
393 | aSet.InvalidateItem(ATTR_ANIMATION_SOUNDON); |
394 | else |
395 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, false)); |
396 | |
397 | if (nSoundFileSet == ATTR_SET) |
| |
398 | aSet.Put(SfxStringItem(ATTR_ANIMATION_SOUNDFILE, aSound)); |
399 | else |
400 | aSet.InvalidateItem(ATTR_ANIMATION_SOUNDFILE); |
401 | |
402 | if (nPlayFullSet == ATTR_SET) |
| |
403 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, bPlayFull)); |
404 | else if (nPlayFullSet == ATTR_MIXED) |
| |
405 | aSet.InvalidateItem(ATTR_ANIMATION_PLAYFULL); |
406 | else |
407 | aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, false)); |
408 | |
409 | if (nClickActionSet == ATTR_SET) |
| |
410 | aSet.Put(SfxUInt16Item(ATTR_ACTION, static_cast<sal_uInt16>(eClickAction))); |
411 | else if (nClickActionSet == ATTR_MIXED) |
| |
412 | aSet.InvalidateItem(ATTR_ACTION); |
413 | else |
414 | aSet.Put(SfxUInt16Item(ATTR_ACTION, sal_uInt16(presentation::ClickAction_NONE))); |
415 | |
416 | if (nBookmarkSet == ATTR_SET) |
| |
417 | aSet.Put(SfxStringItem(ATTR_ACTION_FILENAME, aBookmark)); |
418 | else |
419 | aSet.InvalidateItem(ATTR_ACTION_FILENAME); |
420 | |
421 | if (nSecondEffectSet == ATTR_SET) |
| |
422 | aSet.Put(SfxUInt16Item(ATTR_ACTION_EFFECT, static_cast<sal_uInt16>(eSecondEffect))); |
423 | else if (nSecondEffectSet == ATTR_MIXED) |
| |
424 | aSet.InvalidateItem( ATTR_ACTION_EFFECT ); |
425 | else |
426 | aSet.Put(SfxUInt16Item(ATTR_ACTION_EFFECT, sal_uInt16(presentation::AnimationEffect_NONE))); |
427 | |
428 | if (nSecondSpeedSet == ATTR_SET) |
| |
429 | aSet.Put(SfxUInt16Item(ATTR_ACTION_EFFECTSPEED, static_cast<sal_uInt16>(eSecondSpeed))); |
430 | else |
431 | aSet.InvalidateItem(ATTR_ACTION_EFFECTSPEED); |
432 | |
433 | if (nSecondSoundOnSet == ATTR_SET) |
| |
434 | aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, bSecondSoundOn)); |
435 | else if (nSecondSoundOnSet == ATTR_MIXED) |
| |
436 | aSet.InvalidateItem(ATTR_ACTION_SOUNDON); |
437 | else |
438 | aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, false)); |
439 | |
440 | if (nSecondPlayFullSet == ATTR_SET) |
| |
441 | aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, bSecondPlayFull)); |
442 | else if (nSecondPlayFullSet == ATTR_MIXED) |
| |
443 | aSet.InvalidateItem(ATTR_ACTION_PLAYFULL); |
444 | else |
445 | aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, false)); |
446 | |
447 | SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); |
448 | ScopedVclPtr<SfxAbstractDialog> pDlg( pFact->CreatSdActionDialog(mpViewShell->GetFrameWeld(), &aSet, mpView) ); |
| 36 | | Calling constructor for 'ScopedVclPtr<SfxAbstractDialog>' | |
|
| 43 | | Returning from constructor for 'ScopedVclPtr<SfxAbstractDialog>' | |
|
| 44 | | Calling implicit destructor for 'VclPtr<SfxAbstractDialog>' | |
|
| |
| 52 | | Returning from '~Reference' | |
|
| 53 | | Returning from destructor for 'VclPtr<SfxAbstractDialog>' | |
|
449 | |
450 | short nResult = pDlg->Execute(); |
| 54 | | Calling 'VclPtr::operator->' | |
|
451 | |
452 | if( nResult != RET_OK ) |
453 | return; |
454 | |
455 | rReq.Done( *( pDlg->GetOutputItemSet() ) ); |
456 | pArgs = rReq.GetArgs(); |
457 | } |
458 | |
459 | |
460 | if (pArgs->GetItemState(ATTR_ANIMATION_ACTIVE) == SfxItemState::SET) |
461 | { |
462 | bActive = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_ACTIVE)).GetValue(); |
463 | nAnimationSet = ATTR_SET; |
464 | } |
465 | else |
466 | nAnimationSet = ATTR_MISSING; |
467 | |
468 | if (pArgs->GetItemState(ATTR_ANIMATION_EFFECT) == SfxItemState::SET) |
469 | { |
470 | eEffect = static_cast<presentation::AnimationEffect>(static_cast<const SfxUInt16Item&>( pArgs-> |
471 | Get(ATTR_ANIMATION_EFFECT)).GetValue()); |
472 | nEffectSet = ATTR_SET; |
473 | } |
474 | else |
475 | nEffectSet = ATTR_MISSING; |
476 | |
477 | if (pArgs->GetItemState(ATTR_ANIMATION_TEXTEFFECT) == SfxItemState::SET) |
478 | { |
479 | eTextEffect = static_cast<presentation::AnimationEffect>(static_cast<const SfxUInt16Item&>( pArgs-> |
480 | Get(ATTR_ANIMATION_TEXTEFFECT)).GetValue()); |
481 | nTextEffectSet = ATTR_SET; |
482 | } |
483 | else |
484 | nTextEffectSet = ATTR_MISSING; |
485 | |
486 | if (pArgs->GetItemState(ATTR_ANIMATION_SPEED) == SfxItemState::SET) |
487 | { |
488 | eSpeed = static_cast<presentation::AnimationSpeed>(static_cast<const SfxUInt16Item&>( pArgs-> |
489 | Get(ATTR_ANIMATION_SPEED)).GetValue()); |
490 | nSpeedSet = ATTR_SET; |
491 | } |
492 | else |
493 | nSpeedSet = ATTR_MISSING; |
494 | |
495 | if (pArgs->GetItemState(ATTR_ANIMATION_FADEOUT) == SfxItemState::SET) |
496 | { |
497 | bFadeOut = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_FADEOUT)).GetValue(); |
498 | nFadeOutSet = ATTR_SET; |
499 | } |
500 | else |
501 | nFadeOutSet = ATTR_MISSING; |
502 | |
503 | if (pArgs->GetItemState(ATTR_ANIMATION_INVISIBLE) == SfxItemState::SET) |
504 | { |
505 | bInvisible = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_INVISIBLE)).GetValue(); |
506 | nInvisibleSet = ATTR_SET; |
507 | } |
508 | else |
509 | nInvisibleSet = ATTR_MISSING; |
510 | |
511 | if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDON) == SfxItemState::SET) |
512 | { |
513 | bSoundOn = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_SOUNDON)).GetValue(); |
514 | nSoundOnSet = ATTR_SET; |
515 | } |
516 | else |
517 | nSoundOnSet = ATTR_MISSING; |
518 | |
519 | if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDFILE) == SfxItemState::SET) |
520 | { |
521 | aSound = static_cast<const SfxStringItem&>(pArgs->Get(ATTR_ANIMATION_SOUNDFILE)).GetValue(); |
522 | nSoundFileSet = ATTR_SET; |
523 | } |
524 | else |
525 | nSoundFileSet = ATTR_MISSING; |
526 | |
527 | if (pArgs->GetItemState(ATTR_ANIMATION_COLOR) == SfxItemState::SET) |
528 | { |
529 | aFadeColor = static_cast<const SvxColorItem&>(pArgs->Get(ATTR_ANIMATION_COLOR)).GetValue(); |
530 | nFadeColorSet = ATTR_SET; |
531 | } |
532 | else |
533 | nFadeColorSet = ATTR_MISSING; |
534 | |
535 | if (pArgs->GetItemState(ATTR_ANIMATION_PLAYFULL) == SfxItemState::SET) |
536 | { |
537 | bPlayFull = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_PLAYFULL)).GetValue(); |
538 | nPlayFullSet = ATTR_SET; |
539 | } |
540 | else |
541 | nPlayFullSet = ATTR_MISSING; |
542 | |
543 | if (pArgs->GetItemState(ATTR_ACTION) == SfxItemState::SET) |
544 | { |
545 | eClickAction = static_cast<presentation::ClickAction>(static_cast<const SfxUInt16Item&>(pArgs-> |
546 | Get(ATTR_ACTION)).GetValue()); |
547 | nClickActionSet = ATTR_SET; |
548 | } |
549 | else |
550 | nClickActionSet = ATTR_MISSING; |
551 | |
552 | if (pArgs->GetItemState(ATTR_ACTION_FILENAME) == SfxItemState::SET) |
553 | { |
554 | aBookmark = static_cast<const SfxStringItem&>(pArgs-> |
555 | Get(ATTR_ACTION_FILENAME)).GetValue(); |
556 | nBookmarkSet = ATTR_SET; |
557 | } |
558 | else |
559 | nBookmarkSet = ATTR_MISSING; |
560 | |
561 | if (pArgs->GetItemState(ATTR_ACTION_EFFECT) == SfxItemState::SET) |
562 | { |
563 | eSecondEffect = static_cast<presentation::AnimationEffect>(static_cast<const SfxUInt16Item&>( pArgs-> |
564 | Get(ATTR_ACTION_EFFECT)).GetValue()); |
565 | nSecondEffectSet = ATTR_SET; |
566 | } |
567 | else |
568 | nSecondEffectSet = ATTR_MISSING; |
569 | |
570 | if (pArgs->GetItemState(ATTR_ACTION_EFFECTSPEED) == SfxItemState::SET) |
571 | { |
572 | eSecondSpeed = static_cast<presentation::AnimationSpeed>(static_cast<const SfxUInt16Item&>( pArgs-> |
573 | Get(ATTR_ACTION_EFFECTSPEED)).GetValue()); |
574 | nSecondSpeedSet = ATTR_SET; |
575 | } |
576 | else |
577 | nSecondSpeedSet = ATTR_MISSING; |
578 | |
579 | if (pArgs->GetItemState(ATTR_ACTION_SOUNDON) == SfxItemState::SET) |
580 | { |
581 | bSecondSoundOn = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ACTION_SOUNDON)).GetValue(); |
582 | nSecondSoundOnSet = ATTR_SET; |
583 | } |
584 | else |
585 | nSecondSoundOnSet = ATTR_MISSING; |
586 | |
587 | if (pArgs->GetItemState(ATTR_ACTION_PLAYFULL) == SfxItemState::SET) |
588 | { |
589 | bSecondPlayFull = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ACTION_PLAYFULL)).GetValue(); |
590 | nSecondPlayFullSet = ATTR_SET; |
591 | } |
592 | else |
593 | nSecondPlayFullSet = ATTR_MISSING; |
594 | |
595 | |
596 | if (!(nEffectSet == ATTR_SET || |
597 | nTextEffectSet == ATTR_SET || |
598 | nSpeedSet == ATTR_SET || |
599 | nAnimationSet == ATTR_SET || |
600 | nFadeOutSet == ATTR_SET || |
601 | nFadeColorSet == ATTR_SET || |
602 | nInvisibleSet == ATTR_SET || |
603 | nSoundOnSet == ATTR_SET || |
604 | nSoundFileSet == ATTR_SET || |
605 | nPlayFullSet == ATTR_SET || |
606 | nClickActionSet == ATTR_SET || |
607 | nBookmarkSet == ATTR_SET || |
608 | nSecondEffectSet == ATTR_SET || |
609 | nSecondSpeedSet == ATTR_SET || |
610 | nSecondSoundOnSet == ATTR_SET || |
611 | nSecondPlayFullSet == ATTR_SET)) |
612 | return; |
613 | |
614 | |
615 | OUString aComment(SdResId(STR_UNDO_ANIMATION)); |
616 | |
617 | |
618 | |
619 | pUndoMgr->EnterListAction(aComment, aComment, 0, mpViewShell->GetViewShellBase().GetViewShellId()); |
620 | |
621 | |
622 | std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(mpDoc)); |
623 | pUndoGroup->SetComment(aComment); |
624 | |
625 | |
626 | SdrPathObj* pPath = nullptr; |
627 | if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET) |
628 | { |
629 | DBG_ASSERT(nCount == 2, "This effect expects two selected objects"); |
630 | SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj(); |
631 | SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj(); |
632 | SdrObjKind eKind1 = static_cast<SdrObjKind>(pObject1->GetObjIdentifier()); |
633 | SdrObjKind eKind2 = static_cast<SdrObjKind>(pObject2->GetObjIdentifier()); |
634 | SdrObject* pRunningObj = nullptr; |
635 | |
636 | if (pObject1->GetObjInventor() == SdrInventor::Default && |
637 | ((eKind1 == OBJ_LINE) || |
638 | (eKind1 == OBJ_PLIN) || |
639 | (eKind1 == OBJ_PATHLINE))) |
640 | { |
641 | pPath = static_cast<SdrPathObj*>(pObject1); |
642 | pRunningObj = pObject2; |
643 | } |
644 | |
645 | if (pObject2->GetObjInventor() == SdrInventor::Default && |
646 | ((eKind2 == OBJ_LINE) || |
647 | (eKind2 == OBJ_PLIN) || |
648 | (eKind2 == OBJ_PATHLINE))) |
649 | { |
650 | pPath = static_cast<SdrPathObj*>(pObject2); |
651 | pRunningObj = pObject1; |
652 | } |
653 | |
654 | assert(pRunningObj && pPath && "no curve found"); |
655 | |
656 | |
657 | if (pRunningObj) |
658 | { |
659 | ::tools::Rectangle aCurRect(pRunningObj->GetLogicRect()); |
660 | Point aCurCenter(aCurRect.Center()); |
661 | const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly(); |
662 | sal_uInt32 nNoOfPolygons(rPolyPolygon.count()); |
663 | const ::basegfx::B2DPolygon& aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1)); |
664 | sal_uInt32 nPoints(aPolygon.count()); |
665 | const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1)); |
666 | const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY())); |
667 | Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y()); |
668 | pRunningObj->Move(aDistance); |
669 | |
670 | pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance)); |
671 | } |
672 | } |
673 | |
674 | for (size_t nObject = 0; nObject < nCount; ++nObject) |
675 | { |
676 | SdrObject* pObject = rMarkList.GetMark(nObject)->GetMarkedSdrObj(); |
677 | |
678 | pInfo = SdDrawDocument::GetAnimationInfo(pObject); |
679 | |
680 | bool bCreated = false; |
681 | if( !pInfo ) |
682 | { |
683 | pInfo = SdDrawDocument::GetShapeUserData(*pObject,true); |
684 | bCreated = true; |
685 | } |
686 | |
687 | |
688 | if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath) |
689 | { |
690 | SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction |
691 | (mpDoc, pObject, bCreated); |
692 | pAction->SetActive(pInfo->mbActive, pInfo->mbActive); |
693 | pAction->SetEffect(pInfo->meEffect, pInfo->meEffect); |
694 | pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect); |
695 | pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed); |
696 | pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious); |
697 | pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor); |
698 | pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide); |
699 | pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn); |
700 | pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile); |
701 | pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull); |
702 | pAction->SetClickAction(pInfo->meClickAction, pInfo->meClickAction); |
703 | pAction->SetBookmark(pInfo->GetBookmark(), pInfo->GetBookmark()); |
704 | pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb); |
705 | pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect); |
706 | pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed); |
707 | pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn); |
708 | pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull); |
709 | pUndoGroup->AddAction(pAction); |
710 | |
711 | } |
712 | else |
713 | { |
714 | |
715 | |
716 | SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction |
717 | (mpDoc, pObject, bCreated); |
718 | pAction->SetActive(pInfo->mbActive, bActive); |
719 | pAction->SetEffect(pInfo->meEffect, eEffect); |
720 | pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect); |
721 | pAction->SetSpeed(pInfo->meSpeed, eSpeed); |
722 | pAction->SetDim(pInfo->mbDimPrevious, bFadeOut); |
723 | pAction->SetDimColor(pInfo->maDimColor, aFadeColor); |
724 | pAction->SetDimHide(pInfo->mbDimHide, bInvisible); |
725 | pAction->SetSoundOn(pInfo->mbSoundOn, bSoundOn); |
726 | pAction->SetSound(pInfo->maSoundFile, aSound); |
727 | pAction->SetPlayFull(pInfo->mbPlayFull, bPlayFull); |
728 | pAction->SetClickAction(pInfo->meClickAction, eClickAction); |
729 | pAction->SetBookmark(pInfo->GetBookmark(), aBookmark); |
730 | pAction->SetVerb(pInfo->mnVerb, static_cast<sal_uInt16>(pInfo->GetBookmark().toInt32()) ); |
731 | pAction->SetSecondEffect(pInfo->meSecondEffect, eSecondEffect); |
732 | pAction->SetSecondSpeed(pInfo->meSecondSpeed, eSecondSpeed); |
733 | pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, bSecondSoundOn); |
734 | pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull,bSecondPlayFull); |
735 | pUndoGroup->AddAction(pAction); |
736 | |
737 | |
738 | if (nAnimationSet == ATTR_SET) |
739 | pInfo->mbActive = bActive; |
740 | |
741 | if (nEffectSet == ATTR_SET) |
742 | pInfo->meEffect = eEffect; |
743 | |
744 | if (nTextEffectSet == ATTR_SET) |
745 | pInfo->meTextEffect = eTextEffect; |
746 | |
747 | if (nSpeedSet == ATTR_SET) |
748 | pInfo->meSpeed = eSpeed; |
749 | |
750 | if (nFadeOutSet == ATTR_SET) |
751 | pInfo->mbDimPrevious = bFadeOut; |
752 | |
753 | if (nFadeColorSet == ATTR_SET) |
754 | pInfo->maDimColor = aFadeColor; |
755 | |
756 | if (nInvisibleSet == ATTR_SET) |
757 | pInfo->mbDimHide = bInvisible; |
758 | |
759 | if (nSoundOnSet == ATTR_SET) |
760 | pInfo->mbSoundOn = bSoundOn; |
761 | |
762 | if (nSoundFileSet == ATTR_SET) |
763 | pInfo->maSoundFile = aSound; |
764 | |
765 | if (nPlayFullSet == ATTR_SET) |
766 | pInfo->mbPlayFull = bPlayFull; |
767 | |
768 | if (nClickActionSet == ATTR_SET) |
769 | pInfo->meClickAction = eClickAction; |
770 | |
771 | if (nBookmarkSet == ATTR_SET) |
772 | pInfo->SetBookmark( aBookmark ); |
773 | |
774 | if (nSecondEffectSet == ATTR_SET) |
775 | pInfo->meSecondEffect = eSecondEffect; |
776 | |
777 | if (nSecondSpeedSet == ATTR_SET) |
778 | pInfo->meSecondSpeed = eSecondSpeed; |
779 | |
780 | if (nSecondSoundOnSet == ATTR_SET) |
781 | pInfo->mbSecondSoundOn = bSecondSoundOn; |
782 | |
783 | if (nSecondPlayFullSet == ATTR_SET) |
784 | pInfo->mbSecondPlayFull = bSecondPlayFull; |
785 | |
786 | if (eClickAction == presentation::ClickAction_VERB) |
787 | pInfo->mnVerb = static_cast<sal_uInt16>(aBookmark.toInt32()); |
788 | } |
789 | } |
790 | |
791 | pUndoMgr->AddUndoAction(std::move(pUndoGroup)); |
792 | pUndoMgr->LeaveListAction(); |
793 | |
794 | |
795 | mpDoc->SetChanged(); |
796 | |
797 | } |
798 | |
799 | } |
800 | |
801 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | #ifndef INCLUDED_VCL_PTR_HXX |
21 | #define INCLUDED_VCL_PTR_HXX |
22 | |
23 | #include <sal/config.h> |
24 | |
25 | #include <rtl/ref.hxx> |
26 | |
27 | #include <utility> |
28 | #include <type_traits> |
29 | |
30 | #ifdef DBG_UTIL |
31 | #ifndef _WIN32 |
32 | #include <vcl/vclmain.hxx> |
33 | #endif |
34 | #endif |
35 | |
36 | class VclReferenceBase; |
37 | |
38 | namespace vcl::detail { |
39 | |
40 | template<typename> |
41 | constexpr bool isIncompleteOrDerivedFromVclReferenceBase(...) { return true; } |
42 | |
43 | template<typename T> constexpr bool isIncompleteOrDerivedFromVclReferenceBase( |
44 | int (*)[sizeof(T)]) |
45 | { return std::is_base_of<VclReferenceBase, T>::value; } |
46 | |
47 | } |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | template <class reference_type> |
57 | class VclPtr |
58 | { |
59 | static_assert( |
60 | vcl::detail::isIncompleteOrDerivedFromVclReferenceBase<reference_type>( |
61 | nullptr), |
62 | "template argument type must be derived from VclReferenceBase"); |
63 | |
64 | ::rtl::Reference<reference_type> m_rInnerRef; |
65 | |
66 | public: |
67 | |
68 | |
69 | VclPtr() |
70 | : m_rInnerRef() |
71 | {} |
72 | |
73 | |
74 | |
75 | VclPtr (reference_type * pBody) |
76 | : m_rInnerRef(pBody) |
77 | {} |
78 | |
79 | |
80 | |
81 | VclPtr (reference_type * pBody, __sal_NoAcquire) |
82 | : m_rInnerRef(pBody, SAL_NO_ACQUIRE) |
83 | {} |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | template< class derived_type > |
94 | VclPtr( |
95 | const VclPtr< derived_type > & rRef, |
96 | typename std::enable_if< |
97 | std::is_base_of<reference_type, derived_type>::value, int>::type |
98 | = 0 ) |
99 | : m_rInnerRef( static_cast<reference_type*>(rRef) ) |
100 | { |
101 | } |
102 | |
103 | #if defined(DBG_UTIL) && !defined(_WIN32) |
104 | virtual ~VclPtr() |
105 | { |
106 | assert(m_rInnerRef.get() == nullptr || vclmain::isAlive()); |
107 | |
108 | |
109 | assert((!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) |
110 | && "someone forgot to call dispose()"); |
111 | } |
112 | VclPtr(VclPtr const &) = default; |
113 | VclPtr(VclPtr &&) = default; |
114 | VclPtr & operator =(VclPtr const &) = default; |
115 | VclPtr & operator =(VclPtr &&) = default; |
116 | #endif |
117 | |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | template<typename... Arg> [[nodiscard]] static VclPtr< reference_type > Create(Arg &&... arg) |
128 | { |
129 | return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ); |
130 | } |
131 | |
132 | |
133 | |
134 | reference_type * operator->() const |
135 | { |
136 | return m_rInnerRef.get(); |
| 55 | | Calling 'Reference::get' | |
|
137 | } |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | reference_type * get() const |
144 | { |
145 | return m_rInnerRef.get(); |
146 | } |
147 | |
148 | void set(reference_type *pBody) |
149 | { |
150 | m_rInnerRef.set(pBody); |
151 | } |
152 | |
153 | void reset(reference_type *pBody) |
154 | { |
155 | m_rInnerRef.set(pBody); |
156 | } |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | |
164 | template<typename derived_type> |
165 | typename std::enable_if< |
166 | std::is_base_of<reference_type, derived_type>::value, |
167 | VclPtr &>::type |
168 | operator =(VclPtr<derived_type> const & rRef) |
169 | { |
170 | m_rInnerRef.set(rRef.get()); |
171 | return *this; |
172 | } |
173 | |
174 | VclPtr & operator =(reference_type * pBody) |
175 | { |
176 | m_rInnerRef.set(pBody); |
177 | return *this; |
178 | } |
179 | |
180 | operator reference_type * () const |
181 | { |
182 | return m_rInnerRef.get(); |
183 | } |
184 | |
185 | explicit operator bool () const |
186 | { |
187 | return m_rInnerRef.get() != nullptr; |
188 | } |
189 | |
190 | void clear() |
191 | { |
192 | m_rInnerRef.clear(); |
193 | } |
194 | |
195 | void reset() |
196 | { |
197 | m_rInnerRef.clear(); |
198 | } |
199 | |
200 | void disposeAndClear() |
201 | { |
202 | |
203 | ::rtl::Reference<reference_type> aTmp(m_rInnerRef); |
204 | m_rInnerRef.clear(); |
205 | if (aTmp.get()) { |
206 | aTmp->disposeOnce(); |
207 | } |
208 | } |
209 | |
210 | |
211 | |
212 | bool operator< (const VclPtr<reference_type> & handle) const |
213 | { |
214 | return (m_rInnerRef < handle.m_rInnerRef); |
215 | } |
216 | }; |
217 | |
218 | template<typename T1, typename T2> |
219 | inline bool operator ==(VclPtr<T1> const & p1, VclPtr<T2> const & p2) { |
220 | return p1.get() == p2.get(); |
221 | } |
222 | |
223 | template<typename T> inline bool operator ==(VclPtr<T> const & p1, T const * p2) |
224 | { |
225 | return p1.get() == p2; |
226 | } |
227 | |
228 | template<typename T> inline bool operator ==(VclPtr<T> const & p1, T * p2) { |
229 | return p1.get() == p2; |
230 | } |
231 | |
232 | template<typename T> inline bool operator ==(T const * p1, VclPtr<T> const & p2) |
233 | { |
234 | return p1 == p2.get(); |
235 | } |
236 | |
237 | template<typename T> inline bool operator ==(T * p1, VclPtr<T> const & p2) { |
238 | return p1 == p2.get(); |
239 | } |
240 | |
241 | template<typename T1, typename T2> |
242 | inline bool operator !=(VclPtr<T1> const & p1, VclPtr<T2> const & p2) { |
243 | return !(p1 == p2); |
244 | } |
245 | |
246 | template<typename T> inline bool operator !=(VclPtr<T> const & p1, T const * p2) |
247 | { |
248 | return !(p1 == p2); |
249 | } |
250 | |
251 | template<typename T> inline bool operator !=(VclPtr<T> const & p1, T * p2) { |
252 | return !(p1 == p2); |
253 | } |
254 | |
255 | template<typename T> inline bool operator !=(T const * p1, VclPtr<T> const & p2) |
256 | { |
257 | return !(p1 == p2); |
258 | } |
259 | |
260 | template<typename T> inline bool operator !=(T * p1, VclPtr<T> const & p2) { |
261 | return !(p1 == p2); |
262 | } |
263 | |
264 | |
265 | |
266 | |
267 | |
268 | |
269 | |
270 | |
271 | |
272 | |
273 | |
274 | template <class reference_type> |
275 | class SAL_WARN_UNUSED VclPtrInstance final : public VclPtr<reference_type> |
276 | { |
277 | public: |
278 | template<typename... Arg> VclPtrInstance(Arg &&... arg) |
279 | : VclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) |
280 | { |
281 | } |
282 | |
283 | |
284 | |
285 | |
286 | |
287 | template<typename... Arg> static VclPtrInstance< reference_type > Create(Arg &&... ) = delete; |
288 | }; |
289 | |
290 | template <class reference_type> |
291 | class ScopedVclPtr : public VclPtr<reference_type> |
292 | { |
293 | public: |
294 | |
295 | |
296 | ScopedVclPtr() |
297 | : VclPtr<reference_type>() |
298 | {} |
299 | |
300 | |
301 | |
302 | ScopedVclPtr (reference_type * pBody) |
303 | : VclPtr<reference_type>(pBody) |
304 | {} |
305 | |
306 | |
307 | |
308 | ScopedVclPtr (const VclPtr<reference_type> & handle) |
309 | : VclPtr<reference_type>(handle) |
| 37 | | Calling implicit copy constructor for 'VclPtr<SfxAbstractDialog>' | |
|
| 38 | | Calling copy constructor for 'Reference<SfxAbstractDialog>' | |
|
| 41 | | Returning from copy constructor for 'Reference<SfxAbstractDialog>' | |
|
| 42 | | Returning from copy constructor for 'VclPtr<SfxAbstractDialog>' | |
|
310 | {} |
311 | |
312 | |
313 | |
314 | |
315 | void disposeAndReset(reference_type *pBody) |
316 | { |
317 | if (pBody != this->get()) { |
318 | VclPtr<reference_type>::disposeAndClear(); |
319 | VclPtr<reference_type>::set(pBody); |
320 | } |
321 | } |
322 | |
323 | |
324 | |
325 | |
326 | ScopedVclPtr<reference_type>& operator = (reference_type * pBody) |
327 | { |
328 | disposeAndReset(pBody); |
329 | return *this; |
330 | } |
331 | |
332 | |
333 | |
334 | |
335 | |
336 | |
337 | |
338 | |
339 | |
340 | template< class derived_type > |
341 | ScopedVclPtr( |
342 | const VclPtr< derived_type > & rRef, |
343 | typename std::enable_if< |
344 | std::is_base_of<reference_type, derived_type>::value, int>::type |
345 | = 0 ) |
346 | : VclPtr<reference_type>( rRef ) |
347 | { |
348 | } |
349 | |
350 | |
351 | |
352 | |
353 | |
354 | |
355 | |
356 | template<typename derived_type> |
357 | typename std::enable_if< |
358 | std::is_base_of<reference_type, derived_type>::value, |
359 | ScopedVclPtr &>::type |
360 | operator =(VclPtr<derived_type> const & rRef) |
361 | { |
362 | disposeAndReset(rRef.get()); |
363 | return *this; |
364 | } |
365 | |
366 | |
367 | |
368 | |
369 | |
370 | template<typename... Arg> static ScopedVclPtr< reference_type > Create(Arg &&... ) = delete; |
371 | |
372 | ~ScopedVclPtr() |
373 | { |
374 | VclPtr<reference_type>::disposeAndClear(); |
375 | assert(VclPtr<reference_type>::get() == nullptr); |
376 | } |
377 | |
378 | private: |
379 | |
380 | ScopedVclPtr (const ScopedVclPtr<reference_type> &) = delete; |
381 | |
382 | ScopedVclPtr<reference_type>& operator = (const ScopedVclPtr<reference_type> &) = delete; |
383 | |
384 | void reset() = delete; |
385 | void reset(reference_type *pBody) = delete; |
386 | |
387 | protected: |
388 | ScopedVclPtr (reference_type * pBody, __sal_NoAcquire) |
389 | : VclPtr<reference_type>(pBody, SAL_NO_ACQUIRE) |
390 | {} |
391 | }; |
392 | |
393 | |
394 | |
395 | |
396 | |
397 | |
398 | |
399 | |
400 | |
401 | |
402 | #if defined _MSC_VER |
403 | #pragma warning(push) |
404 | #pragma warning(disable: 4521) // " multiple copy constructors specified" |
405 | #endif |
406 | template <class reference_type> |
407 | class SAL_WARN_UNUSED ScopedVclPtrInstance final : public ScopedVclPtr<reference_type> |
408 | { |
409 | public: |
410 | template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg) |
411 | : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) |
412 | { |
413 | } |
414 | |
415 | |
416 | |
417 | |
418 | |
419 | template<typename... Arg> static ScopedVclPtrInstance< reference_type > Create(Arg &&...) = delete; |
420 | |
421 | private: |
422 | |
423 | |
424 | |
425 | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 | ScopedVclPtrInstance(ScopedVclPtrInstance &) = delete; |
434 | ScopedVclPtrInstance(ScopedVclPtrInstance const &) = delete; |
435 | }; |
436 | #if defined _MSC_VER |
437 | #pragma warning(pop) |
438 | #endif |
439 | |
440 | #endif // INCLUDED_VCL_PTR_HXX |
441 | |
442 | |