File: | home/maarten/src/libreoffice/core/include/rtl/ref.hxx |
Warning: | line 192, column 9 Use of memory after it is freed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
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 <config_features.h> | |||
21 | ||||
22 | #include <DrawViewShell.hxx> | |||
23 | ||||
24 | #include <sfx2/viewfrm.hxx> | |||
25 | #include <editeng/eeitem.hxx> | |||
26 | #include <editeng/tstpitem.hxx> | |||
27 | #include <editeng/lrspitem.hxx> | |||
28 | #include <editeng/protitem.hxx> | |||
29 | #include <editeng/frmdiritem.hxx> | |||
30 | #include <editeng/adjustitem.hxx> | |||
31 | #include <svx/ruler.hxx> | |||
32 | #include <svx/svdotable.hxx> | |||
33 | #include <editeng/numitem.hxx> | |||
34 | #include <svx/rulritem.hxx> | |||
35 | #include <svx/svxids.hrc> | |||
36 | #include <svx/svdpagv.hxx> | |||
37 | #include <sfx2/request.hxx> | |||
38 | #include <sfx2/dispatch.hxx> | |||
39 | #include <tools/urlobj.hxx> | |||
40 | #include <svl/eitem.hxx> | |||
41 | #include <svl/rectitem.hxx> | |||
42 | #include <svl/stritem.hxx> | |||
43 | #include <svx/svdoole2.hxx> | |||
44 | #include <svl/itempool.hxx> | |||
45 | #include <svl/ptitem.hxx> | |||
46 | #include <basic/sbstar.hxx> | |||
47 | #include <basic/sberrors.hxx> | |||
48 | #include <svx/fmshell.hxx> | |||
49 | #include <svx/f3dchild.hxx> | |||
50 | #include <svx/float3d.hxx> | |||
51 | #include <svx/sdmetitm.hxx> | |||
52 | ||||
53 | #include <app.hrc> | |||
54 | #include <strings.hrc> | |||
55 | ||||
56 | #include <sdundogr.hxx> | |||
57 | #include <undopage.hxx> | |||
58 | #include <fupoor.hxx> | |||
59 | #include <slideshow.hxx> | |||
60 | #include <sdpage.hxx> | |||
61 | #include <Window.hxx> | |||
62 | #include <sdresid.hxx> | |||
63 | #include <unokywds.hxx> | |||
64 | #include <drawview.hxx> | |||
65 | #include <drawdoc.hxx> | |||
66 | #include <DrawDocShell.hxx> | |||
67 | #include <sdabstdlg.hxx> | |||
68 | #include <sfx2/ipclient.hxx> | |||
69 | #include <tools/diagnose_ex.h> | |||
70 | #include <ViewShellBase.hxx> | |||
71 | #include <FormShellManager.hxx> | |||
72 | #include <LayerTabBar.hxx> | |||
73 | #include <com/sun/star/drawing/framework/XControllerManager.hpp> | |||
74 | #include <com/sun/star/drawing/framework/XConfigurationController.hpp> | |||
75 | #include <com/sun/star/drawing/framework/XConfiguration.hpp> | |||
76 | #include <com/sun/star/drawing/XShape.hpp> | |||
77 | #include <com/sun/star/frame/XFrame.hpp> | |||
78 | #include <editeng/lspcitem.hxx> | |||
79 | #include <editeng/ulspitem.hxx> | |||
80 | #include <memory> | |||
81 | #include <comphelper/processfactory.hxx> | |||
82 | #include <oox/drawingml/diagram/diagram.hxx> | |||
83 | #include <oox/export/drawingml.hxx> | |||
84 | #include <oox/shape/ShapeFilterBase.hxx> | |||
85 | ||||
86 | using namespace ::com::sun::star::uno; | |||
87 | using namespace ::com::sun::star::drawing::framework; | |||
88 | using ::com::sun::star::frame::XFrame; | |||
89 | using ::com::sun::star::frame::XController; | |||
90 | ||||
91 | namespace sd { | |||
92 | ||||
93 | /** | |||
94 | * handle SfxRequests for controller | |||
95 | */ | |||
96 | void DrawViewShell::ExecCtrl(SfxRequest& rReq) | |||
97 | { | |||
98 | // except a page switch and jumps to bookmarks, nothing is executed during | |||
99 | // a slide show | |||
100 | if( HasCurrentFunction(SID_PRESENTATION( 10000 + 157 )) && | |||
101 | rReq.GetSlot() != SID_SWITCHPAGE(27000 +42) && | |||
102 | rReq.GetSlot() != SID_JUMPTOMARK(5000 + 598)) | |||
103 | return; | |||
104 | ||||
105 | CheckLineTo (rReq); | |||
106 | ||||
107 | // End text edit mode for some requests. | |||
108 | sal_uInt16 nSlot = rReq.GetSlot(); | |||
109 | switch (nSlot) | |||
| ||||
110 | { | |||
111 | case SID_OUTPUT_QUALITY_COLOR(27000 +366): | |||
112 | case SID_OUTPUT_QUALITY_GRAYSCALE(27000 +367): | |||
113 | case SID_OUTPUT_QUALITY_BLACKWHITE(27000 +368): | |||
114 | case SID_OUTPUT_QUALITY_CONTRAST(27000 +400): | |||
115 | // Do nothing. | |||
116 | break; | |||
117 | default: | |||
118 | if ( mpDrawView->IsTextEdit() ) | |||
119 | { | |||
120 | mpDrawView->SdrEndTextEdit(); | |||
121 | } | |||
122 | } | |||
123 | ||||
124 | // sal_uInt16 nSlot = rReq.GetSlot(); | |||
125 | switch (nSlot) | |||
126 | { | |||
127 | case SID_SWITCHPAGE(27000 +42): // BASIC | |||
128 | { | |||
129 | // switch page in running slide show | |||
130 | if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs()) | |||
131 | { | |||
132 | const SfxUInt32Item* pWhatPage = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATPAGE(27000 +212)); | |||
133 | SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber(static_cast<sal_Int32>((pWhatPage->GetValue()-1)>>1)); | |||
134 | } | |||
135 | else | |||
136 | { | |||
137 | const SfxItemSet *pArgs = rReq.GetArgs (); | |||
138 | sal_uInt16 nSelectedPage = 0; | |||
139 | ||||
140 | if (! pArgs) | |||
141 | { | |||
142 | nSelectedPage = maTabControl->GetCurPagePos(); | |||
143 | } | |||
144 | else if (pArgs->Count () == 2) | |||
145 | { | |||
146 | const SfxUInt32Item* pWhatPage = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATPAGE(27000 +212)); | |||
147 | const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND(27000 +217)); | |||
148 | ||||
149 | sal_Int32 nWhatPage = static_cast<sal_Int32>(pWhatPage->GetValue ()); | |||
150 | PageKind nWhatKind = static_cast<PageKind>(pWhatKind->GetValue ()); | |||
151 | if (nWhatKind < PageKind::Standard || nWhatKind > PageKind::Handout) | |||
152 | { | |||
153 | #if HAVE_FEATURE_SCRIPTING1 | |||
154 | StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUEErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 14)); | |||
155 | #endif | |||
156 | rReq.Ignore (); | |||
157 | break; | |||
158 | } | |||
159 | else if (meEditMode != EditMode::MasterPage) | |||
160 | { | |||
161 | if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount(nWhatKind))((nWhatPage >= 0) && (nWhatPage <= GetDoc()-> GetSdPageCount(nWhatKind)))) | |||
162 | { | |||
163 | #if HAVE_FEATURE_SCRIPTING1 | |||
164 | StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUEErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 14)); | |||
165 | #endif | |||
166 | rReq.Ignore (); | |||
167 | break; | |||
168 | } | |||
169 | ||||
170 | nSelectedPage = static_cast<short>(nWhatPage); | |||
171 | mePageKind = nWhatKind; | |||
172 | } | |||
173 | } | |||
174 | else | |||
175 | { | |||
176 | #if HAVE_FEATURE_SCRIPTING1 | |||
177 | StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGSErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 28)); | |||
178 | #endif | |||
179 | rReq.Ignore (); | |||
180 | break; | |||
181 | } | |||
182 | ||||
183 | if( GetDocSh() && (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED)) | |||
184 | GetDocSh()->SetModified(); | |||
185 | ||||
186 | SwitchPage(nSelectedPage); | |||
187 | ||||
188 | if(HasCurrentFunction(SID_BEZIER_EDIT( 10000 + 126 ))) | |||
189 | GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT( 10000 + 128 ), SfxCallMode::ASYNCHRON); | |||
190 | ||||
191 | Invalidate(); | |||
192 | InvalidateWindows(); | |||
193 | rReq.Done (); | |||
194 | } | |||
195 | break; | |||
196 | } | |||
197 | ||||
198 | case SID_SWITCHLAYER(27000 +44): // BASIC | |||
199 | { | |||
200 | const SfxItemSet *pArgs = rReq.GetArgs (); | |||
201 | ||||
202 | // #i87182# | |||
203 | bool bCurPageValid(false); | |||
204 | sal_uInt16 nCurPage(0); | |||
205 | ||||
206 | if(GetLayerTabControl()) | |||
207 | { | |||
208 | nCurPage = GetLayerTabControl()->GetCurPageId(); | |||
209 | bCurPageValid = true; | |||
210 | } | |||
211 | ||||
212 | if(pArgs && 1 == pArgs->Count()) | |||
213 | { | |||
214 | const SfxUInt32Item* pWhatLayer = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYER(27000 +213)); | |||
215 | ||||
216 | if(pWhatLayer) | |||
217 | { | |||
218 | nCurPage = static_cast<short>(pWhatLayer->GetValue()); | |||
219 | bCurPageValid = true; | |||
220 | } | |||
221 | } | |||
222 | ||||
223 | if(bCurPageValid) | |||
224 | { | |||
225 | OUString aLayerName( GetLayerTabControl()->GetLayerName(nCurPage)); | |||
226 | if (!aLayerName.isEmpty()) | |||
227 | { | |||
228 | mpDrawView->SetActiveLayer(aLayerName); | |||
229 | } | |||
230 | Invalidate(); | |||
231 | } | |||
232 | ||||
233 | rReq.Done (); | |||
234 | ||||
235 | break; | |||
236 | } | |||
237 | ||||
238 | case SID_PAGEMODE(27000 +46): // BASIC | |||
239 | { | |||
240 | ||||
241 | const SfxItemSet *pArgs = rReq.GetArgs(); | |||
242 | ||||
243 | if (pArgs && pArgs->Count () == 2) | |||
244 | { | |||
245 | const SfxBoolItem* pIsActive = rReq.GetArg<SfxBoolItem>(ID_VAL_ISACTIVE(27000 +216)); | |||
246 | const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND(27000 +217)); | |||
247 | ||||
248 | PageKind nWhatKind = static_cast<PageKind>(pWhatKind->GetValue()); | |||
249 | if ( nWhatKind >= PageKind::Standard && nWhatKind <= PageKind::Handout) | |||
250 | { | |||
251 | mbIsLayerModeActive = pIsActive->GetValue(); | |||
252 | mePageKind = nWhatKind; | |||
253 | } | |||
254 | } | |||
255 | ||||
256 | // turn on default layer of page | |||
257 | mpDrawView->SetActiveLayer(sUNO_LayerName_layout); | |||
258 | ||||
259 | ChangeEditMode(EditMode::Page, mbIsLayerModeActive); | |||
260 | ||||
261 | Invalidate(); | |||
262 | rReq.Done (); | |||
263 | ||||
264 | break; | |||
265 | } | |||
266 | ||||
267 | case SID_LAYERMODE(27000 +47): // BASIC | |||
268 | { | |||
269 | const SfxItemSet *pArgs = rReq.GetArgs(); | |||
270 | ||||
271 | if (pArgs && pArgs->Count() == 2) | |||
272 | { | |||
273 | const SfxUInt32Item* pWhatLayer = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYER(27000 +213)); | |||
274 | EditMode nWhatLayer = static_cast<EditMode>(pWhatLayer->GetValue()); | |||
275 | if (nWhatLayer == EditMode::Page || nWhatLayer == EditMode::MasterPage) | |||
276 | { | |||
277 | mbIsLayerModeActive = rReq.GetArg<SfxBoolItem>(ID_VAL_ISACTIVE(27000 +216))->GetValue(); | |||
278 | meEditMode = nWhatLayer; | |||
279 | } | |||
280 | } | |||
281 | ||||
282 | ChangeEditMode(meEditMode, !mbIsLayerModeActive); | |||
283 | ||||
284 | Invalidate(); | |||
285 | rReq.Done(); | |||
286 | ||||
287 | break; | |||
288 | } | |||
289 | ||||
290 | case SID_HEADER_AND_FOOTER(27000 +407): | |||
291 | case SID_INSERT_PAGE_NUMBER(27000 +411): | |||
292 | case SID_INSERT_DATE_TIME(27000 +412): | |||
293 | { | |||
294 | SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); | |||
295 | vcl::Window* pWin = GetActiveWindow(); | |||
296 | VclPtr<AbstractHeaderFooterDialog> pDlg(pFact->CreateHeaderFooterDialog(this, pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), mpActualPage)); | |||
297 | auto xRequest = std::make_shared<SfxRequest>(rReq); | |||
298 | rReq.Ignore(); // the 'old' request is not relevant any more | |||
299 | pDlg->StartExecuteAsync([this, pDlg, xRequest](sal_Int32 /*nResult*/){ | |||
300 | GetActiveWindow()->Invalidate(); | |||
301 | UpdatePreview( mpActualPage ); | |||
302 | ||||
303 | Invalidate(); | |||
304 | xRequest->Done(); | |||
305 | ||||
306 | pDlg->disposeOnce(); | |||
307 | }); | |||
308 | break; | |||
309 | } | |||
310 | ||||
311 | case SID_MASTER_LAYOUTS(27000 +408): | |||
312 | { | |||
313 | SdPage* pPage = GetActualPage(); | |||
314 | if (meEditMode == EditMode::MasterPage) | |||
315 | // Use the master page of the current page. | |||
316 | pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage()); | |||
317 | ||||
318 | SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); | |||
319 | vcl::Window* pWin = GetActiveWindow(); | |||
320 | ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), pPage)); | |||
321 | pDlg->Execute(); | |||
322 | Invalidate(); | |||
323 | rReq.Done (); | |||
324 | break; | |||
325 | } | |||
326 | case SID_OBJECTRESIZETypedWhichId<SfxRectangleItem>(5000 + 1000): | |||
327 | { | |||
328 | // The server likes to change the client size | |||
329 | OSL_ASSERT (GetViewShell()!=nullptr)do { if (true && (!(GetViewShell()!=nullptr))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sd/source/ui/view/drviews3.cxx" ":" "329" ": "), "OSL_ASSERT: %s", "GetViewShell()!=nullptr" ); } } while (false); | |||
330 | SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); | |||
331 | ||||
332 | if ( pIPClient && pIPClient->IsObjectInPlaceActive() ) | |||
333 | { | |||
334 | const SfxRectangleItem& rRect = | |||
335 | rReq.GetArgs()->Get(SID_OBJECTRESIZETypedWhichId<SfxRectangleItem>(5000 + 1000)); | |||
336 | ::tools::Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) ); | |||
337 | ||||
338 | if ( mpDrawView->AreObjectsMarked() ) | |||
339 | { | |||
340 | const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); | |||
341 | ||||
342 | if (rMarkList.GetMarkCount() == 1) | |||
343 | { | |||
344 | SdrMark* pMark = rMarkList.GetMark(0); | |||
345 | SdrObject* pObj = pMark->GetMarkedSdrObj(); | |||
346 | ||||
347 | SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj ); | |||
348 | if(pOle2Obj) | |||
349 | { | |||
350 | if( pOle2Obj->GetObjRef().is() ) | |||
351 | { | |||
352 | pOle2Obj->SetLogicRect(aRect); | |||
353 | } | |||
354 | } | |||
355 | } | |||
356 | } | |||
357 | } | |||
358 | rReq.Ignore (); | |||
359 | break; | |||
360 | } | |||
361 | ||||
362 | case SID_RELOAD(5000 + 508): | |||
363 | { | |||
364 | sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId(); | |||
365 | SfxViewFrame* pFrame = GetViewFrame(); | |||
366 | ||||
367 | try | |||
368 | { | |||
369 | Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW ); | |||
370 | ||||
371 | // Save the current configuration of panes and views. | |||
372 | Reference<XControllerManager> xControllerManager ( | |||
373 | GetViewShellBase().GetController(), UNO_QUERY_THROW); | |||
374 | Reference<XConfigurationController> xConfigurationController ( | |||
375 | xControllerManager->getConfigurationController(), UNO_SET_THROW ); | |||
376 | Reference<XConfiguration> xConfiguration ( | |||
377 | xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW ); | |||
378 | ||||
379 | SfxChildWindow* pWindow = pFrame->GetChildWindow(nId); | |||
380 | if(pWindow) | |||
381 | { | |||
382 | Svx3DWin* p3DWin = static_cast<Svx3DWin*>(pWindow->GetWindow()); | |||
383 | if(p3DWin) | |||
384 | p3DWin->DocumentReload(); | |||
385 | } | |||
386 | ||||
387 | // normal forwarding to ViewFrame for execution | |||
388 | GetViewFrame()->ExecuteSlot(rReq); | |||
389 | ||||
390 | // From here on we must cope with this object and the frame already being | |||
391 | // deleted. Do not call any methods or use data members. | |||
392 | Reference<XController> xController( xFrame->getController(), UNO_SET_THROW ); | |||
393 | ||||
394 | // Restore the configuration. | |||
395 | xControllerManager.set( xController, UNO_QUERY_THROW ); | |||
396 | xConfigurationController.set( xControllerManager->getConfigurationController() ); | |||
397 | if ( ! xConfigurationController.is()) | |||
398 | throw RuntimeException(); | |||
399 | xConfigurationController->restoreConfiguration(xConfiguration); | |||
400 | } | |||
401 | catch (RuntimeException&) | |||
402 | { | |||
403 | DBG_UNHANDLED_EXCEPTION("sd.view")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/sd/source/ui/view/drviews3.cxx" ":" "403" ": ", "sd.view" );; | |||
404 | } | |||
405 | ||||
406 | // We have to return immediately to avoid accessing this object. | |||
407 | return; | |||
408 | } | |||
409 | ||||
410 | case SID_JUMPTOMARK(5000 + 598): | |||
411 | { | |||
412 | if( rReq.GetArgs() ) | |||
413 | { | |||
414 | const SfxStringItem* pBookmark = rReq.GetArg<SfxStringItem>(SID_JUMPTOMARK(5000 + 598)); | |||
415 | ||||
416 | if (pBookmark) | |||
417 | { | |||
418 | OUString sBookmark(INetURLObject::decode(pBookmark->GetValue(), INetURLObject::DecodeMechanism::WithCharset)); | |||
419 | ||||
420 | rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) ); | |||
421 | if(xSlideshow.is() && xSlideshow->isRunning()) | |||
422 | { | |||
423 | xSlideshow->jumpToBookmark(sBookmark); | |||
424 | } | |||
425 | else | |||
426 | { | |||
427 | GotoBookmark(sBookmark); | |||
428 | } | |||
429 | } | |||
430 | } | |||
431 | rReq.Done(); | |||
432 | break; | |||
433 | } | |||
434 | ||||
435 | case SID_OUTPUT_QUALITY_COLOR(27000 +366): | |||
436 | case SID_OUTPUT_QUALITY_GRAYSCALE(27000 +367): | |||
437 | case SID_OUTPUT_QUALITY_BLACKWHITE(27000 +368): | |||
438 | case SID_OUTPUT_QUALITY_CONTRAST(27000 +400): | |||
439 | { | |||
440 | ExecReq( rReq ); | |||
441 | break; | |||
442 | } | |||
443 | ||||
444 | case SID_MAIL_SCROLLBODY_PAGEDOWN(5000 + 1588): | |||
445 | { | |||
446 | ExecReq( rReq ); | |||
447 | break; | |||
448 | } | |||
449 | ||||
450 | case SID_ATTR_YEAR2000(((((10000 + 1499) + 1) + 499) + 1) + 87): | |||
451 | { | |||
452 | FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); | |||
453 | if (pFormShell != nullptr) | |||
454 | { | |||
455 | const SfxPoolItem* pItem; | |||
456 | if (rReq.GetArgs()->GetItemState( | |||
457 | SID_ATTR_YEAR2000(((((10000 + 1499) + 1) + 499) + 1) + 87), true, &pItem) == SfxItemState::SET) | |||
458 | pFormShell->SetY2KState ( | |||
459 | static_cast<const SfxUInt16Item*>(pItem)->GetValue()); | |||
460 | } | |||
461 | ||||
462 | rReq.Done(); | |||
463 | } | |||
464 | break; | |||
465 | ||||
466 | case SID_OPT_LOCALE_CHANGED(((((10000 + 1499) + 1) + 499) + 1) + 94): | |||
467 | { | |||
468 | GetActiveWindow()->Invalidate(); | |||
469 | UpdatePreview( mpActualPage ); | |||
470 | rReq.Done(); | |||
471 | } | |||
472 | break; | |||
473 | ||||
474 | case SID_REGENERATE_DIAGRAM(27000 +451): | |||
475 | { | |||
476 | const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); | |||
477 | if (rMarkList.GetMarkCount() == 1) | |||
478 | { | |||
479 | SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); | |||
480 | Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY); | |||
481 | ||||
482 | if (oox::drawingml::DrawingML::IsDiagram(xShape)) | |||
483 | { | |||
484 | mpDrawView->UnmarkAll(); | |||
485 | ||||
486 | css::uno::Reference<css::uno::XComponentContext> xContext | |||
487 | = comphelper::getProcessComponentContext(); | |||
488 | rtl::Reference<oox::shape::ShapeFilterBase> xFilter( | |||
489 | new oox::shape::ShapeFilterBase(xContext)); | |||
490 | xFilter->setTargetDocument(GetDocSh()->GetModel()); | |||
491 | xFilter->importTheme(); | |||
492 | oox::drawingml::reloadDiagram(pObj, *xFilter); | |||
493 | ||||
494 | mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); | |||
495 | } | |||
496 | } | |||
497 | ||||
498 | rReq.Done(); | |||
499 | } | |||
500 | break; | |||
501 | ||||
502 | case SID_EDIT_DIAGRAM(27000 +452): | |||
503 | { | |||
504 | const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); | |||
505 | if (rMarkList.GetMarkCount() == 1) | |||
506 | { | |||
507 | SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); | |||
508 | Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY); | |||
509 | ||||
510 | if (oox::drawingml::DrawingML::IsDiagram(xShape)) | |||
511 | { | |||
512 | VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); | |||
513 | ScopedVclPtr<VclAbstractDialog> pDlg | |||
514 | = pFact->CreateDiagramDialog(GetFrameWeld(), pObj->GetDiagramData()); | |||
515 | pDlg->Execute(); | |||
516 | } | |||
517 | } | |||
518 | ||||
519 | rReq.Done(); | |||
520 | } | |||
521 | break; | |||
522 | ||||
523 | default: | |||
524 | break; | |||
525 | } | |||
526 | } | |||
527 | ||||
528 | void DrawViewShell::ExecRuler(SfxRequest& rReq) | |||
529 | { | |||
530 | // nothing is executed during a slide show! | |||
531 | if(HasCurrentFunction(SID_PRESENTATION( 10000 + 157 ))) | |||
532 | return; | |||
533 | ||||
534 | CheckLineTo (rReq); | |||
535 | ||||
536 | const SfxItemSet* pArgs = rReq.GetArgs(); | |||
537 | const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); | |||
538 | Size aPageSize = mpActualPage->GetSize(); | |||
539 | Size aViewSize = GetActiveWindow()->GetViewSize(); | |||
540 | ||||
541 | switch ( rReq.GetSlot() ) | |||
542 | { | |||
543 | case SID_ATTR_LONG_LRSPACE( 10000 + 285 ): | |||
544 | if (pArgs) | |||
545 | { | |||
546 | std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(GetDoc())); | |||
547 | pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDERreinterpret_cast<char const *>("STR_UNDO_CHANGE_PAGEBORDER" "\004" u8"Modify page margins"))); | |||
548 | ||||
549 | const SvxLongLRSpaceItem& rLRSpace = static_cast<const SvxLongLRSpaceItem&>( | |||
550 | pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE( 10000 + 285 )))); | |||
551 | ||||
552 | if( mpDrawView->IsTextEdit() ) | |||
553 | { | |||
554 | ::tools::Rectangle aRect = maMarkRect; | |||
555 | aRect.SetPos(aRect.TopLeft() + aPagePos); | |||
556 | aRect.SetLeft( rLRSpace.GetLeft() ); | |||
557 | aRect.SetRight( aViewSize.Width() - rLRSpace.GetRight() ); | |||
558 | aRect.SetPos(aRect.TopLeft() - aPagePos); | |||
559 | if ( aRect != maMarkRect) | |||
560 | { | |||
561 | mpDrawView->SetAllMarkedRect(aRect); | |||
562 | maMarkRect = mpDrawView->GetAllMarkedRect(); | |||
563 | Invalidate( SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ) ); | |||
564 | } | |||
565 | } | |||
566 | else | |||
567 | { | |||
568 | long nLeft = std::max(0L, rLRSpace.GetLeft() - aPagePos.X()); | |||
569 | long nRight = std::max(0L, rLRSpace.GetRight() + aPagePos.X() + | |||
570 | aPageSize.Width() - aViewSize.Width()); | |||
571 | ||||
572 | sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); | |||
573 | sal_uInt16 i; | |||
574 | for ( i = 0; i < nPageCnt; i++) | |||
575 | { | |||
576 | SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); | |||
577 | SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(), | |||
578 | pPage, | |||
579 | pPage->GetLeftBorder(), | |||
580 | pPage->GetRightBorder(), | |||
581 | nLeft, nRight); | |||
582 | pUndoGroup->AddAction(pUndo); | |||
583 | pPage->SetLeftBorder(nLeft); | |||
584 | pPage->SetRightBorder(nRight); | |||
585 | } | |||
586 | nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); | |||
587 | ||||
588 | for (i = 0; i < nPageCnt; i++) | |||
589 | { | |||
590 | SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind); | |||
591 | SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(), | |||
592 | pPage, | |||
593 | pPage->GetLeftBorder(), | |||
594 | pPage->GetRightBorder(), | |||
595 | nLeft, nRight); | |||
596 | pUndoGroup->AddAction(pUndo); | |||
597 | pPage->SetLeftBorder(nLeft); | |||
598 | pPage->SetRightBorder(nRight); | |||
599 | } | |||
600 | InvalidateWindows(); | |||
601 | } | |||
602 | ||||
603 | // give the undo group to the undo manager | |||
604 | GetViewFrame()->GetObjectShell()->GetUndoManager()-> | |||
605 | AddUndoAction(std::move(pUndoGroup)); | |||
606 | } | |||
607 | break; | |||
608 | case SID_ATTR_LONG_ULSPACE( 10000 + 284 ): | |||
609 | if (pArgs) | |||
610 | { | |||
611 | std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(GetDoc())); | |||
612 | pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDERreinterpret_cast<char const *>("STR_UNDO_CHANGE_PAGEBORDER" "\004" u8"Modify page margins"))); | |||
613 | ||||
614 | const SvxLongULSpaceItem& rULSpace = static_cast<const SvxLongULSpaceItem&>( | |||
615 | pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE( 10000 + 284 )))); | |||
616 | ||||
617 | if( mpDrawView->IsTextEdit() ) | |||
618 | { | |||
619 | ::tools::Rectangle aRect = maMarkRect; | |||
620 | aRect.SetPos(aRect.TopLeft() + aPagePos); | |||
621 | aRect.SetTop( rULSpace.GetUpper() ); | |||
622 | aRect.SetBottom( aViewSize.Height() - rULSpace.GetLower() ); | |||
623 | aRect.SetPos(aRect.TopLeft() - aPagePos); | |||
624 | ||||
625 | if ( aRect != maMarkRect) | |||
626 | { | |||
627 | mpDrawView->SetAllMarkedRect(aRect); | |||
628 | maMarkRect = mpDrawView->GetAllMarkedRect(); | |||
629 | Invalidate( SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ) ); | |||
630 | } | |||
631 | } | |||
632 | else | |||
633 | { | |||
634 | long nUpper = std::max(0L, rULSpace.GetUpper() - aPagePos.Y()); | |||
635 | long nLower = std::max(0L, rULSpace.GetLower() + aPagePos.Y() + | |||
636 | aPageSize.Height() - aViewSize.Height()); | |||
637 | ||||
638 | sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); | |||
639 | sal_uInt16 i; | |||
640 | for ( i = 0; i < nPageCnt; i++) | |||
641 | { | |||
642 | SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); | |||
643 | SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(), | |||
644 | pPage, | |||
645 | pPage->GetUpperBorder(), | |||
646 | pPage->GetLowerBorder(), | |||
647 | nUpper, nLower); | |||
648 | pUndoGroup->AddAction(pUndo); | |||
649 | pPage->SetUpperBorder(nUpper); | |||
650 | pPage->SetLowerBorder(nLower); | |||
651 | } | |||
652 | nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); | |||
653 | ||||
654 | for (i = 0; i < nPageCnt; i++) | |||
655 | { | |||
656 | SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind); | |||
657 | SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(), | |||
658 | pPage, | |||
659 | pPage->GetUpperBorder(), | |||
660 | pPage->GetLowerBorder(), | |||
661 | nUpper, nLower); | |||
662 | pUndoGroup->AddAction(pUndo); | |||
663 | pPage->SetUpperBorder(nUpper); | |||
664 | pPage->SetLowerBorder(nLower); | |||
665 | } | |||
666 | InvalidateWindows(); | |||
667 | } | |||
668 | ||||
669 | // give the undo group to the undo manager | |||
670 | GetViewFrame()->GetObjectShell()->GetUndoManager()-> | |||
671 | AddUndoAction(std::move(pUndoGroup)); | |||
672 | } | |||
673 | break; | |||
674 | case SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ): | |||
675 | if (pArgs) | |||
676 | { | |||
677 | ::tools::Rectangle aRect = maMarkRect; | |||
678 | aRect.SetPos(aRect.TopLeft() + aPagePos); | |||
679 | ||||
680 | const SvxObjectItem& rOI = static_cast<const SvxObjectItem&>( | |||
681 | pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 )))); | |||
682 | ||||
683 | if ( rOI.GetStartX() != rOI.GetEndX() ) | |||
684 | { | |||
685 | aRect.SetLeft( rOI.GetStartX() ); | |||
686 | aRect.SetRight( rOI.GetEndX() ); | |||
687 | } | |||
688 | if ( rOI.GetStartY() != rOI.GetEndY() ) | |||
689 | { | |||
690 | aRect.SetTop( rOI.GetStartY() ); | |||
691 | aRect.SetBottom( rOI.GetEndY() ); | |||
692 | } | |||
693 | aRect.SetPos(aRect.TopLeft() - aPagePos); | |||
694 | if ( aRect != maMarkRect) | |||
695 | { | |||
696 | mpDrawView->SetAllMarkedRect(aRect); | |||
697 | maMarkRect = mpDrawView->GetAllMarkedRect(); | |||
698 | Invalidate( SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ) ); | |||
699 | } | |||
700 | } | |||
701 | break; | |||
702 | case SID_ATTR_TABSTOP( 10000 + 2 ): | |||
703 | if (pArgs && mpDrawView->IsTextEdit()) | |||
704 | { | |||
705 | const SvxTabStopItem& rItem = pArgs->Get( EE_PARA_TABS ); | |||
706 | ||||
707 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_TABS, EE_PARA_TABS>{} ); | |||
708 | ||||
709 | aEditAttr.Put( rItem ); | |||
710 | mpDrawView->SetAttributes( aEditAttr ); | |||
711 | ||||
712 | Invalidate(SID_ATTR_TABSTOP( 10000 + 2 )); | |||
713 | } | |||
714 | break; | |||
715 | case SID_ATTR_PARA_LINESPACE( 10000 + 33 ): | |||
716 | if (pArgs) | |||
717 | { | |||
718 | SvxLineSpacingItem aParaLineSP = static_cast<const SvxLineSpacingItem&>(pArgs->Get( | |||
719 | GetPool().GetWhich(SID_ATTR_PARA_LINESPACE( 10000 + 33 )))); | |||
720 | ||||
721 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_SBL, EE_PARA_SBL>{} ); | |||
722 | aParaLineSP.SetWhich( EE_PARA_SBL ); | |||
723 | ||||
724 | aEditAttr.Put( aParaLineSP ); | |||
725 | mpDrawView->SetAttributes( aEditAttr ); | |||
726 | ||||
727 | Invalidate(SID_ATTR_PARA_LINESPACE( 10000 + 33 )); | |||
728 | } | |||
729 | break; | |||
730 | case SID_ATTR_PARA_ADJUST_LEFT( 10000 + 28 ): | |||
731 | { | |||
732 | SvxAdjustItem aItem( SvxAdjust::Left, EE_PARA_JUST ); | |||
733 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_JUST, EE_PARA_JUST>{} ); | |||
734 | ||||
735 | aEditAttr.Put( aItem ); | |||
736 | mpDrawView->SetAttributes( aEditAttr ); | |||
737 | ||||
738 | Invalidate(SID_ATTR_PARA_ADJUST_LEFT( 10000 + 28 )); | |||
739 | break; | |||
740 | } | |||
741 | case SID_ATTR_PARA_ADJUST_CENTER( 10000 + 30 ): | |||
742 | { | |||
743 | SvxAdjustItem aItem( SvxAdjust::Center, EE_PARA_JUST ); | |||
744 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_JUST, EE_PARA_JUST>{} ); | |||
745 | ||||
746 | aEditAttr.Put( aItem ); | |||
747 | mpDrawView->SetAttributes( aEditAttr ); | |||
748 | ||||
749 | Invalidate(SID_ATTR_PARA_ADJUST_CENTER( 10000 + 30 )); | |||
750 | break; | |||
751 | } | |||
752 | case SID_ATTR_PARA_ADJUST_RIGHT( 10000 + 29 ): | |||
753 | { | |||
754 | SvxAdjustItem aItem( SvxAdjust::Right, EE_PARA_JUST ); | |||
755 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_JUST, EE_PARA_JUST>{} ); | |||
756 | ||||
757 | aEditAttr.Put( aItem ); | |||
758 | mpDrawView->SetAttributes( aEditAttr ); | |||
759 | ||||
760 | Invalidate(SID_ATTR_PARA_ADJUST_RIGHT( 10000 + 29 )); | |||
761 | break; | |||
762 | } | |||
763 | case SID_ATTR_PARA_ADJUST_BLOCK( 10000 + 31 ): | |||
764 | { | |||
765 | SvxAdjustItem aItem( SvxAdjust::Block, EE_PARA_JUST ); | |||
766 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_JUST, EE_PARA_JUST>{} ); | |||
767 | ||||
768 | aEditAttr.Put( aItem ); | |||
769 | mpDrawView->SetAttributes( aEditAttr ); | |||
770 | ||||
771 | Invalidate(SID_ATTR_PARA_ADJUST_BLOCK( 10000 + 31 )); | |||
772 | break; | |||
773 | } | |||
774 | case SID_ATTR_PARA_ULSPACE( 10000 + 42 ): | |||
775 | if (pArgs) | |||
776 | { | |||
777 | SvxULSpaceItem aULSP = static_cast<const SvxULSpaceItem&>(pArgs->Get( | |||
778 | GetPool().GetWhich(SID_ATTR_PARA_ULSPACE( 10000 + 42 )))); | |||
779 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_ULSPACE, EE_PARA_ULSPACE>{} ); | |||
780 | aULSP.SetWhich( EE_PARA_ULSPACE ); | |||
781 | ||||
782 | aEditAttr.Put( aULSP ); | |||
783 | mpDrawView->SetAttributes( aEditAttr ); | |||
784 | ||||
785 | Invalidate(SID_ATTR_PARA_ULSPACE( 10000 + 42 )); | |||
786 | } | |||
787 | break; | |||
788 | case SID_ATTR_PARA_LRSPACE( 10000 + 43 ): | |||
789 | if (pArgs) | |||
790 | { | |||
791 | SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get( | |||
792 | GetPool().GetWhich(SID_ATTR_PARA_LRSPACE( 10000 + 43 )))); | |||
793 | ||||
794 | SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); | |||
795 | aLRSpace.SetWhich( EE_PARA_LRSPACE ); | |||
796 | ||||
797 | aEditAttr.Put( aLRSpace ); | |||
798 | mpDrawView->SetAttributes( aEditAttr ); | |||
799 | ||||
800 | Invalidate(SID_ATTR_PARA_LRSPACE( 10000 + 43 )); | |||
801 | } | |||
802 | break; | |||
803 | case SID_ATTR_LRSPACE( 10000 + 48 ): | |||
804 | if (pArgs && mpDrawView->IsTextEdit()) | |||
805 | { | |||
806 | sal_uInt16 nId = SID_ATTR_PARA_LRSPACE( 10000 + 43 ); | |||
807 | const SvxLRSpaceItem& rItem = static_cast<const SvxLRSpaceItem&>( | |||
808 | pArgs->Get( nId )); | |||
809 | ||||
810 | static const sal_uInt16 aWhichTable[]= | |||
811 | { | |||
812 | EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL, | |||
813 | EE_PARA_LRSPACE, EE_PARA_LRSPACE, | |||
814 | EE_PARA_NUMBULLET, EE_PARA_NUMBULLET, | |||
815 | 0, 0 | |||
816 | }; | |||
817 | ||||
818 | SfxItemSet aEditAttr( GetDoc()->GetPool(), | |||
819 | aWhichTable ); | |||
820 | mpDrawView->GetAttributes( aEditAttr ); | |||
821 | ||||
822 | nId = EE_PARA_LRSPACE; | |||
823 | SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), | |||
824 | rItem.GetRight(), rItem.GetTextLeft(), | |||
825 | rItem.GetTextFirstLineOffset(), nId ); | |||
826 | ||||
827 | const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue(); | |||
828 | const SvxLRSpaceItem& rOrigLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE ); | |||
829 | const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET ); | |||
830 | if( nOutlineLevel != -1 && | |||
831 | rNumBulletItem.GetNumRule() && | |||
832 | rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel ) | |||
833 | { | |||
834 | const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel); | |||
835 | SvxNumberFormat aFormat(rFormat); | |||
836 | ||||
837 | // left margin gets distributed onto LRSpace item | |||
838 | // and number format AbsLSpace - this fixes | |||
839 | // n#707779 (previously, LRSpace left indent could | |||
840 | // become negative - EditEngine really does not | |||
841 | // like that. | |||
842 | const auto nAbsLSpace=aFormat.GetAbsLSpace(); | |||
843 | const long nTxtLeft=rItem.GetTextLeft(); | |||
844 | const long nLeftIndent=std::max(0L,nTxtLeft - nAbsLSpace); | |||
845 | aLRSpaceItem.SetTextLeft(nLeftIndent); | |||
846 | // control for clipped left indent - remainder | |||
847 | // reduces number format first line indent | |||
848 | aFormat.SetAbsLSpace(nTxtLeft - nLeftIndent); | |||
849 | ||||
850 | // negative first line indent goes to the number | |||
851 | // format, positive to the lrSpace item | |||
852 | if( rItem.GetTextFirstLineOffset() < 0 ) | |||
853 | { | |||
854 | aFormat.SetFirstLineOffset( | |||
855 | rItem.GetTextFirstLineOffset() | |||
856 | - rOrigLRSpaceItem.GetTextFirstLineOffset() | |||
857 | + aFormat.GetCharTextDistance()); | |||
858 | aLRSpaceItem.SetTextFirstLineOffset(0); | |||
859 | } | |||
860 | else | |||
861 | { | |||
862 | aFormat.SetFirstLineOffset(0); | |||
863 | aLRSpaceItem.SetTextFirstLineOffset( | |||
864 | rItem.GetTextFirstLineOffset() | |||
865 | - aFormat.GetFirstLineOffset() //TODO: overflow | |||
866 | + aFormat.GetCharTextDistance()); | |||
867 | } | |||
868 | ||||
869 | if( rFormat != aFormat ) | |||
870 | { | |||
871 | // put all items | |||
872 | rNumBulletItem.GetNumRule()->SetLevel(nOutlineLevel,aFormat); | |||
873 | aEditAttr.Put( rNumBulletItem ); | |||
874 | aEditAttr.Put( aLRSpaceItem ); | |||
875 | mpDrawView->SetAttributes( aEditAttr ); | |||
876 | ||||
877 | Invalidate(SID_ATTR_PARA_LRSPACE( 10000 + 43 )); | |||
878 | break; | |||
879 | } | |||
880 | } | |||
881 | ||||
882 | // only put lrSpace item | |||
883 | SfxItemSet aEditAttrReduced( GetDoc()->GetPool(), | |||
884 | svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); | |||
885 | aEditAttrReduced.Put( aLRSpaceItem ); | |||
886 | mpDrawView->SetAttributes( aEditAttrReduced ); | |||
887 | ||||
888 | Invalidate(SID_ATTR_PARA_LRSPACE( 10000 + 43 )); | |||
889 | } | |||
890 | break; | |||
891 | } | |||
892 | } | |||
893 | ||||
894 | void DrawViewShell::GetRulerState(SfxItemSet& rSet) | |||
895 | { | |||
896 | Point aOrigin; | |||
897 | ||||
898 | if (mpDrawView->GetSdrPageView()) | |||
899 | { | |||
900 | aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin(); | |||
901 | } | |||
902 | ||||
903 | Size aViewSize = GetActiveWindow()->GetViewSize(); | |||
904 | ||||
905 | const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); | |||
906 | Size aPageSize = mpActualPage->GetSize(); | |||
907 | ||||
908 | ::tools::Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()), | |||
909 | aViewSize.Height() - (aPagePos.Y() + aPageSize.Height()))); | |||
910 | ||||
911 | if( mpDrawView->IsTextEdit() ) | |||
912 | { | |||
913 | Point aPnt1 = GetActiveWindow()->GetWinViewPos(); | |||
914 | ::tools::Rectangle aMinMaxRect( aPnt1, Size(ULONG_MAX(9223372036854775807L *2UL+1UL), ULONG_MAX(9223372036854775807L *2UL+1UL)) ); | |||
915 | rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAXTypedWhichId<SfxUInt32Item>( 10000 + 84 ), aMinMaxRect) ); | |||
916 | } | |||
917 | else | |||
918 | { | |||
919 | rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAXTypedWhichId<SfxUInt32Item>( 10000 + 84 ), aRect) ); | |||
920 | } | |||
921 | ||||
922 | SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLeftBorder(), | |||
923 | aRect.Right() + mpActualPage->GetRightBorder(), | |||
924 | GetPool().GetWhich(SID_ATTR_LONG_LRSPACE( 10000 + 285 ))); | |||
925 | SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUpperBorder(), | |||
926 | aRect.Bottom() + mpActualPage->GetLowerBorder(), | |||
927 | GetPool().GetWhich(SID_ATTR_LONG_ULSPACE( 10000 + 284 ))); | |||
928 | rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(), | |||
929 | aViewSize.Height())); | |||
930 | SfxPointItem aPointItem( SID_RULER_NULL_OFFSETTypedWhichId<SfxPointItem>( 10000 + 79 ), aPagePos + aOrigin ); | |||
931 | ||||
932 | SvxProtectItem aProtect( SID_RULER_PROTECT( 10000 + 415 ) ); | |||
933 | ||||
934 | maMarkRect = mpDrawView->GetAllMarkedRect(); | |||
935 | ||||
936 | const bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == css::text::WritingMode_RL_TB; | |||
937 | rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT( 10000 + 952 ), bRTL)); | |||
938 | ||||
939 | if( mpDrawView->AreObjectsMarked() ) | |||
940 | { | |||
941 | if( mpDrawView->IsTextEdit() ) | |||
942 | { | |||
943 | SdrObject* pObj = mpDrawView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj(); | |||
944 | if( pObj->GetObjInventor() == SdrInventor::Default) | |||
945 | { | |||
946 | SfxItemSet aEditAttr( GetDoc()->GetPool() ); | |||
947 | mpDrawView->GetAttributes( aEditAttr ); | |||
948 | if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SfxItemState::DEFAULT ) | |||
949 | { | |||
950 | const SvxTabStopItem& rItem = aEditAttr.Get( EE_PARA_TABS ); | |||
951 | rSet.Put( rItem ); | |||
952 | ||||
953 | const SvxLRSpaceItem& rLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE ); | |||
954 | SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(), | |||
955 | rLRSpaceItem.GetRight(), rLRSpaceItem.GetTextLeft(), | |||
956 | rLRSpaceItem.GetTextFirstLineOffset(), SID_ATTR_PARA_LRSPACE( 10000 + 43 ) ); | |||
957 | ||||
958 | const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue(); | |||
959 | const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET ); | |||
960 | if( nOutlineLevel != -1 && | |||
961 | rNumBulletItem.GetNumRule() && | |||
962 | rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel ) | |||
963 | { | |||
964 | const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel); | |||
965 | aLRSpaceItem.SetTextLeft(rFormat.GetAbsLSpace() + rLRSpaceItem.GetTextLeft()); | |||
966 | aLRSpaceItem.SetTextFirstLineOffset( | |||
967 | rLRSpaceItem.GetTextFirstLineOffset() + rFormat.GetFirstLineOffset() | |||
968 | //TODO: overflow | |||
969 | - rFormat.GetCharTextDistance()); | |||
970 | } | |||
971 | ||||
972 | rSet.Put( aLRSpaceItem ); | |||
973 | ||||
974 | Point aPos( aPagePos + maMarkRect.TopLeft() ); | |||
975 | ||||
976 | if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SfxItemState::SET ) | |||
977 | { | |||
978 | const SdrMetricItem& rTLDItem = aEditAttr.Get( SDRATTR_TEXT_LEFTDIST ); | |||
979 | long nLD = rTLDItem.GetValue(); | |||
980 | aPos.AdjustX(nLD ); | |||
981 | } | |||
982 | ||||
983 | aPointItem.SetValue( aPos ); | |||
984 | ||||
985 | ::tools::Rectangle aParaRect(maMarkRect); | |||
986 | if (pObj->GetObjIdentifier() == OBJ_TABLE) | |||
987 | { | |||
988 | sdr::table::SdrTableObj* pTable = static_cast<sdr::table::SdrTableObj*>(pObj); | |||
989 | sdr::table::CellPos cellpos; | |||
990 | pTable->getActiveCellPos(cellpos); | |||
991 | pTable->getCellBounds(cellpos, aParaRect); | |||
992 | } | |||
993 | ||||
994 | aLRSpace.SetLeft(aPagePos.X() + aParaRect.Left()); | |||
995 | ||||
996 | if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SfxItemState::SET ) | |||
997 | { | |||
998 | const SdrMetricItem& rTLDItem = aEditAttr.Get( SDRATTR_TEXT_LEFTDIST ); | |||
999 | long nLD = rTLDItem.GetValue(); | |||
1000 | aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD ); | |||
1001 | } | |||
1002 | ||||
1003 | aLRSpace.SetRight(aRect.Right() + aPageSize.Width() - aParaRect.Right()); | |||
1004 | ||||
1005 | if ( aEditAttr.GetItemState( SDRATTR_TEXT_RIGHTDIST ) == SfxItemState::SET ) | |||
1006 | { | |||
1007 | const SdrMetricItem& rTRDItem = aEditAttr.Get( SDRATTR_TEXT_RIGHTDIST ); | |||
1008 | long nRD = rTRDItem.GetValue(); | |||
1009 | aLRSpace.SetRight( aLRSpace.GetRight() + nRD ); | |||
1010 | } | |||
1011 | ||||
1012 | aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() ); | |||
1013 | aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() ); | |||
1014 | ||||
1015 | rSet.DisableItem( SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ) ); | |||
1016 | ||||
1017 | // lock page margins | |||
1018 | aProtect.SetSizeProtect( true ); | |||
1019 | aProtect.SetPosProtect( true ); | |||
1020 | } | |||
1021 | ||||
1022 | if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SfxItemState::DEFAULT ) | |||
1023 | { | |||
1024 | const SvxFrameDirectionItem& rItem = aEditAttr.Get( EE_PARA_WRITINGDIR ); | |||
1025 | rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT( 10000 + 952 ), rItem.GetValue() == SvxFrameDirection::Horizontal_RL_TB)); | |||
1026 | } | |||
1027 | } | |||
1028 | } | |||
1029 | else | |||
1030 | { | |||
1031 | rSet.DisableItem( EE_PARA_TABS ); | |||
1032 | rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT( 10000 + 952 ) ); | |||
1033 | ||||
1034 | if( mpDrawView->IsResizeAllowed(true) ) | |||
1035 | { | |||
1036 | ::tools::Rectangle aResizeRect( maMarkRect ); | |||
1037 | ||||
1038 | aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos); | |||
1039 | SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(), | |||
1040 | aResizeRect.Top(), aResizeRect.Bottom()); | |||
1041 | rSet.Put(aObjItem); | |||
1042 | rSet.DisableItem( EE_PARA_TABS ); | |||
1043 | } | |||
1044 | else | |||
1045 | { | |||
1046 | rSet.DisableItem( SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ) ); | |||
1047 | } | |||
1048 | } | |||
1049 | } | |||
1050 | else | |||
1051 | { | |||
1052 | rSet.DisableItem( SID_RULER_OBJECTTypedWhichId<SvxRulerItem>( 10000 + 81 ) ); | |||
1053 | rSet.DisableItem( EE_PARA_TABS ); | |||
1054 | } | |||
1055 | ||||
1056 | rSet.Put( aLRSpace ); | |||
1057 | rSet.Put( aULSpace ); | |||
1058 | ||||
1059 | rSet.Put( aPointItem ); | |||
1060 | rSet.Put( aProtect ); | |||
1061 | } | |||
1062 | ||||
1063 | void DrawViewShell::ExecStatusBar(SfxRequest& rReq) | |||
1064 | { | |||
1065 | // nothing is executed during a slide show! | |||
1066 | if(HasCurrentFunction(SID_PRESENTATION( 10000 + 157 ))) | |||
1067 | return; | |||
1068 | ||||
1069 | CheckLineTo (rReq); | |||
1070 | ||||
1071 | switch ( rReq.GetSlot() ) | |||
1072 | { | |||
1073 | case SID_ATTR_SIZETypedWhichId<SvxSizeItem>( 10000 + 224 ): | |||
1074 | { | |||
1075 | GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORMTypedWhichId<SfxInt32Item>( 10000 + 87 ), SfxCallMode::ASYNCHRON ); | |||
1076 | } | |||
1077 | break; | |||
1078 | ||||
1079 | case SID_STATUS_LAYOUT(27000 +87): | |||
1080 | { | |||
1081 | GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT(27000 +64), SfxCallMode::ASYNCHRON ); | |||
1082 | } | |||
1083 | break; | |||
1084 | } | |||
1085 | } | |||
1086 | ||||
1087 | /** | |||
1088 | * set state of snap object entries in popup | |||
1089 | */ | |||
1090 | void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) | |||
1091 | { | |||
1092 | SdrPageView* pPV; | |||
1093 | Point aMPos = GetActiveWindow()->PixelToLogic(maMousePos); | |||
1094 | sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( | |||
1095 | Size(FuPoor::HITPIX,0)).Width()); | |||
1096 | sal_uInt16 nHelpLine; | |||
1097 | ||||
1098 | if ( !mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) | |||
1099 | return; | |||
1100 | ||||
1101 | const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine]; | |||
1102 | ||||
1103 | if ( rHelpLine.GetKind() == SdrHelpLineKind::Point ) | |||
1104 | { | |||
1105 | rSet.Put( SfxStringItem( SID_SET_SNAPITEM(27000 +77), | |||
1106 | SdResId( STR_POPUP_EDIT_SNAPPOINTreinterpret_cast<char const *>("STR_POPUP_EDIT_SNAPPOINT" "\004" u8"Edit Snap Point..."))) ); | |||
1107 | rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM(27000 +108), | |||
1108 | SdResId( STR_POPUP_DELETE_SNAPPOINTreinterpret_cast<char const *>("STR_POPUP_DELETE_SNAPPOINT" "\004" u8"Delete Snap Point"))) ); | |||
1109 | } | |||
1110 | else | |||
1111 | { | |||
1112 | rSet.Put( SfxStringItem( SID_SET_SNAPITEM(27000 +77), | |||
1113 | SdResId( STR_POPUP_EDIT_SNAPLINEreinterpret_cast<char const *>("STR_POPUP_EDIT_SNAPLINE" "\004" u8"Edit Snap Line..."))) ); | |||
1114 | rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM(27000 +108), | |||
1115 | SdResId( STR_POPUP_DELETE_SNAPLINEreinterpret_cast<char const *>("STR_POPUP_DELETE_SNAPLINE" "\004" u8"Delete Snap Line"))) ); | |||
1116 | } | |||
1117 | } | |||
1118 | ||||
1119 | } // end of namespace sd | |||
1120 | ||||
1121 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
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 | #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 | } // namespace vcl::detail |
48 | |
49 | /** |
50 | * A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for references to vcl::Window subclasses. |
51 | * |
52 | * For more details on the design please see vcl/README.lifecycle |
53 | * |
54 | * @param reference_type must be a subclass of vcl::Window |
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 | /** Constructor... |
68 | */ |
69 | VclPtr() |
70 | : m_rInnerRef() |
71 | {} |
72 | |
73 | /** Constructor... |
74 | */ |
75 | VclPtr (reference_type * pBody) |
76 | : m_rInnerRef(pBody) |
77 | {} |
78 | |
79 | /** Constructor... that doesn't take a ref. |
80 | */ |
81 | VclPtr (reference_type * pBody, __sal_NoAcquire) |
82 | : m_rInnerRef(pBody, SAL_NO_ACQUIRE) |
83 | {} |
84 | |
85 | /** Up-casting conversion constructor: Copies interface reference. |
86 | |
87 | Does not work for up-casts to ambiguous bases. For the special case of |
88 | up-casting to Reference< XInterface >, see the corresponding conversion |
89 | operator. |
90 | |
91 | @param rRef another reference |
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())(static_cast <bool> (m_rInnerRef.get() == nullptr || vclmain ::isAlive()) ? void (0) : __assert_fail ("m_rInnerRef.get() == nullptr || vclmain::isAlive()" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 106, __extension__ __PRETTY_FUNCTION__)); |
107 | // We can be one of the intermediate counts, but if we are the last |
108 | // VclPtr keeping this object alive, then something forgot to call dispose(). |
109 | assert((!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1)(static_cast <bool> ((!m_rInnerRef.get() || m_rInnerRef ->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()") ? void (0) : __assert_fail ("(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && \"someone forgot to call dispose()\"" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 110, __extension__ __PRETTY_FUNCTION__)) |
110 | && "someone forgot to call dispose()")(static_cast <bool> ((!m_rInnerRef.get() || m_rInnerRef ->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()") ? void (0) : __assert_fail ("(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && \"someone forgot to call dispose()\"" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 110, __extension__ __PRETTY_FUNCTION__)); |
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 | * A construction helper for VclPtr. Since VclPtr types are created |
120 | * with a reference-count of one - to help fit into the existing |
121 | * code-flow; this helps us to construct them easily. |
122 | * |
123 | * For more details on the design please see vcl/README.lifecycle |
124 | * |
125 | * @tparam reference_type must be a subclass of vcl::Window |
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 | /** Probably most common used: handle->someBodyOp(). |
133 | */ |
134 | reference_type * operator->() const |
135 | { |
136 | return m_rInnerRef.get(); |
137 | } |
138 | |
139 | /** Get the body. Can be used instead of operator->(). |
140 | I.e. handle->someBodyOp() and handle.get()->someBodyOp() |
141 | are the same. |
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 | /** Up-casting copy assignment operator. |
159 | |
160 | Does not work for up-casts to ambiguous bases. |
161 | |
162 | @param rRef another reference |
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 | // hold it alive for the lifetime of this method |
203 | ::rtl::Reference<reference_type> aTmp(m_rInnerRef); |
204 | m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-) |
205 | if (aTmp.get()) { |
206 | aTmp->disposeOnce(); |
207 | } |
208 | } |
209 | |
210 | /** Needed to place VclPtr's into STL collection. |
211 | */ |
212 | bool operator< (const VclPtr<reference_type> & handle) const |
213 | { |
214 | return (m_rInnerRef < handle.m_rInnerRef); |
215 | } |
216 | }; // class VclPtr |
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 | * A construction helper for a temporary VclPtr. Since VclPtr types |
266 | * are created with a reference-count of one - to help fit into |
267 | * the existing code-flow; this helps us to construct them easily. |
268 | * see also VclPtr::Create and ScopedVclPtr |
269 | * |
270 | * For more details on the design please see vcl/README.lifecycle |
271 | * |
272 | * @param reference_type must be a subclass of vcl::Window |
273 | */ |
274 | template <class reference_type> |
275 | class SAL_WARN_UNUSED__attribute__((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 | * Override and disallow this, to prevent people accidentally calling it and actually |
285 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
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 | /** Constructor... |
295 | */ |
296 | ScopedVclPtr() |
297 | : VclPtr<reference_type>() |
298 | {} |
299 | |
300 | /** Constructor |
301 | */ |
302 | ScopedVclPtr (reference_type * pBody) |
303 | : VclPtr<reference_type>(pBody) |
304 | {} |
305 | |
306 | /** Copy constructor... |
307 | */ |
308 | ScopedVclPtr (const VclPtr<reference_type> & handle) |
309 | : VclPtr<reference_type>(handle) |
310 | {} |
311 | |
312 | /** |
313 | Assignment that releases the last reference. |
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 | Assignment that releases the last reference. |
325 | */ |
326 | ScopedVclPtr<reference_type>& operator = (reference_type * pBody) |
327 | { |
328 | disposeAndReset(pBody); |
329 | return *this; |
330 | } |
331 | |
332 | /** Up-casting conversion constructor: Copies interface reference. |
333 | |
334 | Does not work for up-casts to ambiguous bases. For the special case of |
335 | up-casting to Reference< XInterface >, see the corresponding conversion |
336 | operator. |
337 | |
338 | @param rRef another reference |
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 | /** Up-casting assignment operator. |
351 | |
352 | Does not work for up-casts to ambiguous bases. |
353 | |
354 | @param rRef another VclPtr |
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 | * Override and disallow this, to prevent people accidentally calling it and actually |
368 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
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)(static_cast <bool> (VclPtr<reference_type>::get( ) == nullptr) ? void (0) : __assert_fail ("VclPtr<reference_type>::get() == nullptr" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 375, __extension__ __PRETTY_FUNCTION__)); // make sure there are no lingering references |
376 | } |
377 | |
378 | private: |
379 | // Most likely we don't want this default copy-constructor. |
380 | ScopedVclPtr (const ScopedVclPtr<reference_type> &) = delete; |
381 | // And certainly we don't want a default assignment operator. |
382 | ScopedVclPtr<reference_type>& operator = (const ScopedVclPtr<reference_type> &) = delete; |
383 | // And disallow reset as that doesn't call disposeAndClear on the original reference |
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 | * A construction helper for ScopedVclPtr. Since VclPtr types are created |
395 | * with a reference-count of one - to help fit into the existing |
396 | * code-flow; this helps us to construct them easily. |
397 | * |
398 | * For more details on the design please see vcl/README.lifecycle |
399 | * |
400 | * @param reference_type must be a subclass of vcl::Window |
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__attribute__((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 | * Override and disallow this, to prevent people accidentally calling it and actually |
417 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
418 | */ |
419 | template<typename... Arg> static ScopedVclPtrInstance< reference_type > Create(Arg &&...) = delete; |
420 | |
421 | private: |
422 | // Prevent the above perfect forwarding ctor from hijacking (accidental) |
423 | // attempts at ScopedVclPtrInstance copy construction (where the hijacking |
424 | // would typically lead to somewhat obscure error messages); both non-const |
425 | // and const variants are needed here, as the ScopedVclPtr base class has a |
426 | // const--variant copy ctor, so the implicitly declared copy ctor for |
427 | // ScopedVclPtrInstance would also be the const variant, so non-const copy |
428 | // construction attempts would be hijacked by the perfect forwarding ctor; |
429 | // but if we only declared a non-const variant here, the const variant would |
430 | // no longer be implicitly declared (as there would already be an explicitly |
431 | // declared copy ctor), so const copy construction attempts would then be |
432 | // hijacked by the perfect forwarding ctor: |
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 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
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 | #ifndef INCLUDED_RTL_REF_HXX | ||||||||
21 | #define INCLUDED_RTL_REF_HXX | ||||||||
22 | |||||||||
23 | #include "sal/config.h" | ||||||||
24 | |||||||||
25 | #include <cassert> | ||||||||
26 | #include <cstddef> | ||||||||
27 | #include <functional> | ||||||||
28 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||
29 | #include <type_traits> | ||||||||
30 | #endif | ||||||||
31 | |||||||||
32 | #include "sal/types.h" | ||||||||
33 | |||||||||
34 | namespace rtl | ||||||||
35 | { | ||||||||
36 | |||||||||
37 | /** Template reference class for reference type. | ||||||||
38 | */ | ||||||||
39 | template <class reference_type> | ||||||||
40 | class Reference | ||||||||
41 | { | ||||||||
42 | /** The <b>reference_type</b> body pointer. | ||||||||
43 | */ | ||||||||
44 | reference_type * m_pBody; | ||||||||
45 | |||||||||
46 | |||||||||
47 | public: | ||||||||
48 | /** Constructor... | ||||||||
49 | */ | ||||||||
50 | Reference() | ||||||||
51 | : m_pBody (NULL__null) | ||||||||
52 | {} | ||||||||
53 | |||||||||
54 | |||||||||
55 | /** Constructor... | ||||||||
56 | */ | ||||||||
57 | Reference (reference_type * pBody, __sal_NoAcquire) | ||||||||
58 | : m_pBody (pBody) | ||||||||
59 | { | ||||||||
60 | } | ||||||||
61 | |||||||||
62 | /** Constructor... | ||||||||
63 | */ | ||||||||
64 | Reference (reference_type * pBody) | ||||||||
65 | : m_pBody (pBody) | ||||||||
66 | { | ||||||||
67 | if (m_pBody) | ||||||||
68 | m_pBody->acquire(); | ||||||||
69 | } | ||||||||
70 | |||||||||
71 | /** Copy constructor... | ||||||||
72 | */ | ||||||||
73 | Reference (const Reference<reference_type> & handle) | ||||||||
74 | : m_pBody (handle.m_pBody) | ||||||||
75 | { | ||||||||
76 | if (m_pBody) | ||||||||
77 | m_pBody->acquire(); | ||||||||
78 | } | ||||||||
79 | |||||||||
80 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||
81 | /** Move constructor... | ||||||||
82 | */ | ||||||||
83 | Reference (Reference<reference_type> && handle) noexcept | ||||||||
84 | : m_pBody (handle.m_pBody) | ||||||||
85 | { | ||||||||
86 | handle.m_pBody = nullptr; | ||||||||
87 | } | ||||||||
88 | #endif | ||||||||
89 | |||||||||
90 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||
91 | /** Up-casting conversion constructor: Copies interface reference. | ||||||||
92 | |||||||||
93 | Does not work for up-casts to ambiguous bases. | ||||||||
94 | |||||||||
95 | @param rRef another reference | ||||||||
96 | */ | ||||||||
97 | template< class derived_type > | ||||||||
98 | inline Reference( | ||||||||
99 | const Reference< derived_type > & rRef, | ||||||||
100 | std::enable_if_t<std::is_base_of_v<reference_type, derived_type>, int> = 0 ) | ||||||||
101 | : m_pBody (rRef.get()) | ||||||||
102 | { | ||||||||
103 | if (m_pBody) | ||||||||
104 | m_pBody->acquire(); | ||||||||
105 | } | ||||||||
106 | #endif | ||||||||
107 | |||||||||
108 | /** Destructor... | ||||||||
109 | */ | ||||||||
110 | ~Reference() COVERITY_NOEXCEPT_FALSE | ||||||||
111 | { | ||||||||
112 | if (m_pBody
| ||||||||
113 | m_pBody->release(); | ||||||||
114 | } | ||||||||
115 | |||||||||
116 | /** Set... | ||||||||
117 | Similar to assignment. | ||||||||
118 | */ | ||||||||
119 | Reference<reference_type> & | ||||||||
120 | SAL_CALL set (reference_type * pBody) | ||||||||
121 | { | ||||||||
122 | if (pBody) | ||||||||
123 | pBody->acquire(); | ||||||||
124 | reference_type * const pOld = m_pBody; | ||||||||
125 | m_pBody = pBody; | ||||||||
126 | if (pOld) | ||||||||
127 | pOld->release(); | ||||||||
128 | return *this; | ||||||||
129 | } | ||||||||
130 | |||||||||
131 | /** Assignment. | ||||||||
132 | Unbinds this instance from its body (if bound) and | ||||||||
133 | bind it to the body represented by the handle. | ||||||||
134 | */ | ||||||||
135 | Reference<reference_type> & | ||||||||
136 | SAL_CALL operator= (const Reference<reference_type> & handle) | ||||||||
137 | { | ||||||||
138 | return set( handle.m_pBody ); | ||||||||
139 | } | ||||||||
140 | |||||||||
141 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||
142 | /** Assignment. | ||||||||
143 | * Unbinds this instance from its body (if bound), | ||||||||
144 | * bind it to the body represented by the handle, and | ||||||||
145 | * set the body represented by the handle to nullptr. | ||||||||
146 | */ | ||||||||
147 | Reference<reference_type> & | ||||||||
148 | operator= (Reference<reference_type> && handle) | ||||||||
149 | { | ||||||||
150 | // self-movement guts ourself | ||||||||
151 | if (m_pBody) | ||||||||
152 | m_pBody->release(); | ||||||||
153 | m_pBody = handle.m_pBody; | ||||||||
154 | handle.m_pBody = nullptr; | ||||||||
155 | return *this; | ||||||||
156 | } | ||||||||
157 | #endif | ||||||||
158 | |||||||||
159 | /** Assignment... | ||||||||
160 | */ | ||||||||
161 | Reference<reference_type> & | ||||||||
162 | SAL_CALL operator= (reference_type * pBody) | ||||||||
163 | { | ||||||||
164 | return set( pBody ); | ||||||||
165 | } | ||||||||
166 | |||||||||
167 | /** Unbind the body from this handle. | ||||||||
168 | Note that for a handle representing a large body, | ||||||||
169 | "handle.clear().set(new body());" _might_ | ||||||||
170 | perform a little bit better than "handle.set(new body());", | ||||||||
171 | since in the second case two large objects exist in memory | ||||||||
172 | (the old body and the new body). | ||||||||
173 | */ | ||||||||
174 | Reference<reference_type> & SAL_CALL clear() | ||||||||
175 | { | ||||||||
176 | if (m_pBody) | ||||||||
177 | { | ||||||||
178 | reference_type * const pOld = m_pBody; | ||||||||
179 | m_pBody = NULL__null; | ||||||||
180 | pOld->release(); | ||||||||
181 | } | ||||||||
182 | return *this; | ||||||||
183 | } | ||||||||
184 | |||||||||
185 | |||||||||
186 | /** Get the body. Can be used instead of operator->(). | ||||||||
187 | I.e. handle->someBodyOp() and handle.get()->someBodyOp() | ||||||||
188 | are the same. | ||||||||
189 | */ | ||||||||
190 | reference_type * SAL_CALL get() const | ||||||||
191 | { | ||||||||
192 | return m_pBody; | ||||||||
| |||||||||
193 | } | ||||||||
194 | |||||||||
195 | |||||||||
196 | /** Probably most common used: handle->someBodyOp(). | ||||||||
197 | */ | ||||||||
198 | reference_type * SAL_CALL operator->() const | ||||||||
199 | { | ||||||||
200 | assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail ("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx" , 200, __extension__ __PRETTY_FUNCTION__)); | ||||||||
201 | return m_pBody; | ||||||||
202 | } | ||||||||
203 | |||||||||
204 | |||||||||
205 | /** Allows (*handle).someBodyOp(). | ||||||||
206 | */ | ||||||||
207 | reference_type & SAL_CALL operator*() const | ||||||||
208 | { | ||||||||
209 | assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail ("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx" , 209, __extension__ __PRETTY_FUNCTION__)); | ||||||||
210 | return *m_pBody; | ||||||||
211 | } | ||||||||
212 | |||||||||
213 | |||||||||
214 | /** Returns True if the handle does point to a valid body. | ||||||||
215 | */ | ||||||||
216 | bool SAL_CALL is() const | ||||||||
217 | { | ||||||||
218 | return (m_pBody != NULL__null); | ||||||||
219 | } | ||||||||
220 | |||||||||
221 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||
222 | /** Returns True if the handle does point to a valid body. | ||||||||
223 | */ | ||||||||
224 | explicit operator bool() const | ||||||||
225 | { | ||||||||
226 | return is(); | ||||||||
227 | } | ||||||||
228 | #endif | ||||||||
229 | |||||||||
230 | /** Returns True if this points to pBody. | ||||||||
231 | */ | ||||||||
232 | bool SAL_CALL operator== (const reference_type * pBody) const | ||||||||
233 | { | ||||||||
234 | return (m_pBody == pBody); | ||||||||
235 | } | ||||||||
236 | |||||||||
237 | |||||||||
238 | /** Returns True if handle points to the same body. | ||||||||
239 | */ | ||||||||
240 | bool | ||||||||
241 | SAL_CALL operator== (const Reference<reference_type> & handle) const | ||||||||
242 | { | ||||||||
243 | return (m_pBody == handle.m_pBody); | ||||||||
244 | } | ||||||||
245 | |||||||||
246 | |||||||||
247 | /** Needed to place References into STL collection. | ||||||||
248 | */ | ||||||||
249 | bool | ||||||||
250 | SAL_CALL operator!= (const Reference<reference_type> & handle) const | ||||||||
251 | { | ||||||||
252 | return (m_pBody != handle.m_pBody); | ||||||||
253 | } | ||||||||
254 | |||||||||
255 | |||||||||
256 | /** Needed to place References into STL collection. | ||||||||
257 | */ | ||||||||
258 | bool | ||||||||
259 | SAL_CALL operator< (const Reference<reference_type> & handle) const | ||||||||
260 | { | ||||||||
261 | return (m_pBody < handle.m_pBody); | ||||||||
262 | } | ||||||||
263 | |||||||||
264 | |||||||||
265 | /** Needed to place References into STL collection. | ||||||||
266 | */ | ||||||||
267 | bool | ||||||||
268 | SAL_CALL operator> (const Reference<reference_type> & handle) const | ||||||||
269 | { | ||||||||
270 | return (m_pBody > handle.m_pBody); | ||||||||
271 | } | ||||||||
272 | }; | ||||||||
273 | |||||||||
274 | } // namespace rtl | ||||||||
275 | |||||||||
276 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||
277 | namespace std | ||||||||
278 | { | ||||||||
279 | |||||||||
280 | /// @cond INTERNAL | ||||||||
281 | /** | ||||||||
282 | Make rtl::Reference hashable by default for use in STL containers. | ||||||||
283 | |||||||||
284 | @since LibreOffice 6.3 | ||||||||
285 | */ | ||||||||
286 | template<typename T> | ||||||||
287 | struct hash<::rtl::Reference<T>> | ||||||||
288 | { | ||||||||
289 | std::size_t operator()(::rtl::Reference<T> const & s) const | ||||||||
290 | { return std::size_t(s.get()); } | ||||||||
291 | }; | ||||||||
292 | /// @endcond | ||||||||
293 | |||||||||
294 | } | ||||||||
295 | |||||||||
296 | #endif | ||||||||
297 | |||||||||
298 | #endif /* ! INCLUDED_RTL_REF_HXX */ | ||||||||
299 | |||||||||
300 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
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 | #ifndef INCLUDED_VCL_Reference_HXX |
20 | #define INCLUDED_VCL_Reference_HXX |
21 | |
22 | #include <vcl/dllapi.h> |
23 | #include <osl/interlck.h> |
24 | |
25 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) VclReferenceBase |
26 | { |
27 | mutable oslInterlockedCount mnRefCnt; |
28 | |
29 | template<typename T> friend class VclPtr; |
30 | |
31 | public: |
32 | void acquire() const |
33 | { |
34 | osl_atomic_increment(&mnRefCnt)__sync_add_and_fetch((&mnRefCnt), 1); |
35 | } |
36 | |
37 | void release() const |
38 | { |
39 | if (osl_atomic_decrement(&mnRefCnt)__sync_sub_and_fetch((&mnRefCnt), 1) == 0) |
40 | delete this; |
41 | } |
42 | #ifdef DBG_UTIL |
43 | #ifndef _WIN32 |
44 | sal_Int32 getRefCount() const { return mnRefCnt; } |
45 | #endif |
46 | #endif |
47 | |
48 | |
49 | private: |
50 | VclReferenceBase(const VclReferenceBase&) = delete; |
51 | VclReferenceBase& operator=(const VclReferenceBase&) = delete; |
52 | |
53 | bool mbDisposed : 1; |
54 | |
55 | protected: |
56 | VclReferenceBase(); |
57 | protected: |
58 | virtual ~VclReferenceBase(); |
59 | |
60 | protected: |
61 | virtual void dispose(); |
62 | |
63 | public: |
64 | void disposeOnce(); |
65 | bool isDisposed() const { return mbDisposed; } |
66 | |
67 | }; |
68 | #endif |