File: | home/maarten/src/libreoffice/core/sc/source/ui/drawfunc/fuconrec.cxx |
Warning: | line 141, column 44 Called C++ object pointer is null |
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 <fuconrec.hxx> | |||
21 | #include <tabvwsh.hxx> | |||
22 | #include <drawview.hxx> | |||
23 | ||||
24 | #include <editeng/outlobj.hxx> | |||
25 | // Create default drawing objects via keyboard | |||
26 | #include <svx/svdopath.hxx> | |||
27 | #include <svx/svdocapt.hxx> | |||
28 | #include <svx/svxids.hrc> | |||
29 | #include <svx/strings.hrc> | |||
30 | #include <svx/xlnwtit.hxx> | |||
31 | #include <svx/xlnstwit.hxx> | |||
32 | #include <svx/xlnedwit.hxx> | |||
33 | #include <svx/xlnedit.hxx> | |||
34 | #include <svx/xlnstit.hxx> | |||
35 | #include <svx/dialmgr.hxx> | |||
36 | #include <svx/svdomeas.hxx> | |||
37 | #include <basegfx/polygon/b2dpolygontools.hxx> | |||
38 | ||||
39 | #include <basegfx/polygon/b2dpolygon.hxx> | |||
40 | #include <basegfx/point/b2dpoint.hxx> | |||
41 | ||||
42 | FuConstRectangle::FuConstRectangle(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP, | |||
43 | SdrModel* pDoc, const SfxRequest& rReq) | |||
44 | : FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq) | |||
45 | { | |||
46 | } | |||
47 | ||||
48 | FuConstRectangle::~FuConstRectangle() | |||
49 | { | |||
50 | } | |||
51 | ||||
52 | /** | |||
53 | * set line starts and ends for the object to be created | |||
54 | */ | |||
55 | ||||
56 | namespace { | |||
57 | ||||
58 | ::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel) | |||
59 | { | |||
60 | ::basegfx::B2DPolyPolygon aRetval; | |||
61 | XLineEndListRef pLineEndList(rModel.GetLineEndList()); | |||
62 | ||||
63 | if( pLineEndList.is() ) | |||
64 | { | |||
65 | OUString aArrowName( SvxResId(pResId) ); | |||
66 | long nCount = pLineEndList->Count(); | |||
67 | long nIndex; | |||
68 | for( nIndex = 0; nIndex < nCount; nIndex++ ) | |||
69 | { | |||
70 | const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex); | |||
71 | if( pEntry->GetName() == aArrowName ) | |||
72 | { | |||
73 | aRetval = pEntry->GetLineEnd(); | |||
74 | break; | |||
75 | } | |||
76 | } | |||
77 | } | |||
78 | ||||
79 | return aRetval; | |||
80 | } | |||
81 | ||||
82 | } | |||
83 | ||||
84 | bool FuConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) | |||
85 | { | |||
86 | // remember button state for creation of own MouseEvents | |||
87 | SetMouseButtonCode(rMEvt.GetButtons()); | |||
88 | ||||
89 | bool bReturn = FuConstruct::MouseButtonDown(rMEvt); | |||
90 | ||||
91 | if ( rMEvt.IsLeft() && !pView->IsAction() ) | |||
92 | { | |||
93 | Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); | |||
94 | pWindow->CaptureMouse(); | |||
95 | ||||
96 | if ( pView->GetCurrentObjIdentifier() == OBJ_CAPTION ) | |||
97 | { | |||
98 | Size aCaptionSize ( 2268, 1134 ); // 4x2cm | |||
99 | ||||
100 | bReturn = pView->BegCreateCaptionObj( aPos, aCaptionSize ); | |||
101 | ||||
102 | // How do you set the font for writing | |||
103 | } | |||
104 | else | |||
105 | bReturn = pView->BegCreateObj(aPos); | |||
106 | ||||
107 | SdrObject* pObj = pView->GetCreateObj(); | |||
108 | ||||
109 | if (pObj) | |||
110 | { | |||
111 | SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().GetItemPool()); | |||
112 | SetLineEnds(aAttr, *pObj, aSfxRequest.GetSlot()); | |||
113 | pObj->SetMergedItemSet(aAttr); | |||
114 | } | |||
115 | } | |||
116 | return bReturn; | |||
117 | } | |||
118 | ||||
119 | bool FuConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) | |||
120 | { | |||
121 | // remember button state for creation of own MouseEvents | |||
122 | SetMouseButtonCode(rMEvt.GetButtons()); | |||
123 | ||||
124 | bool bReturn = false; | |||
125 | ||||
126 | if ( pView->IsCreateObj() && rMEvt.IsLeft() ) | |||
| ||||
127 | { | |||
128 | pView->EndCreateObj(SdrCreateCmd::ForceEnd); | |||
129 | ||||
130 | if (aSfxRequest.GetSlot() == SID_DRAW_CAPTION_VERTICAL( 10000 + 906 )) | |||
131 | { | |||
132 | // set vertical flag for caption object | |||
133 | ||||
134 | const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); | |||
135 | if (rMarkList.GetMark(0)) | |||
136 | { | |||
137 | SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); | |||
138 | // create OutlinerParaObject now so it can be set to vertical | |||
139 | if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr ) | |||
140 | static_cast<SdrTextObj*>(pObj)->ForceOutlinerParaObject(); | |||
141 | OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); | |||
| ||||
142 | if( pOPO && !pOPO->IsVertical() ) | |||
143 | pOPO->SetVertical( true ); | |||
144 | } | |||
145 | } | |||
146 | ||||
147 | bReturn = true; | |||
148 | } | |||
149 | return (FuConstruct::MouseButtonUp(rMEvt) || bReturn); | |||
150 | } | |||
151 | ||||
152 | void FuConstRectangle::Activate() | |||
153 | { | |||
154 | SdrObjKind aObjKind; | |||
155 | ||||
156 | switch (aSfxRequest.GetSlot() ) | |||
157 | { | |||
158 | case SID_DRAW_LINE( 10000 + 102 ): | |||
159 | case SID_DRAW_XLINE( 10000 + 103 ): | |||
160 | case SID_LINE_ARROW_END( 10000 + 1166 ): | |||
161 | case SID_LINE_ARROW_CIRCLE( 10000 + 1159 ): | |||
162 | case SID_LINE_ARROW_SQUARE( 10000 + 1160 ): | |||
163 | case SID_LINE_ARROW_START( 10000 + 1165 ): | |||
164 | case SID_LINE_CIRCLE_ARROW( 10000 + 1161 ): | |||
165 | case SID_LINE_SQUARE_ARROW( 10000 + 1162 ): | |||
166 | case SID_LINE_ARROWS( 10000 + 1163 ): | |||
167 | aNewPointer = PointerStyle::DrawLine; | |||
168 | aObjKind = OBJ_LINE; | |||
169 | break; | |||
170 | ||||
171 | case SID_DRAW_MEASURELINE( 10000 + 1167 ): | |||
172 | aNewPointer = PointerStyle::DrawLine; | |||
173 | aObjKind = OBJ_MEASURE; | |||
174 | break; | |||
175 | ||||
176 | case SID_DRAW_RECT( 10000 + 104 ): | |||
177 | aNewPointer = PointerStyle::DrawRect; | |||
178 | aObjKind = OBJ_RECT; | |||
179 | break; | |||
180 | ||||
181 | case SID_DRAW_ELLIPSE( 10000 + 110 ): | |||
182 | aNewPointer = PointerStyle::DrawEllipse; | |||
183 | aObjKind = OBJ_CIRC; | |||
184 | break; | |||
185 | ||||
186 | case SID_DRAW_CAPTION( 10000 + 254 ): | |||
187 | case SID_DRAW_CAPTION_VERTICAL( 10000 + 906 ): | |||
188 | aNewPointer = PointerStyle::DrawCaption; | |||
189 | aObjKind = OBJ_CAPTION; | |||
190 | break; | |||
191 | ||||
192 | default: | |||
193 | aNewPointer = PointerStyle::Cross; | |||
194 | aObjKind = OBJ_RECT; | |||
195 | break; | |||
196 | } | |||
197 | ||||
198 | pView->SetCurrentObj(sal::static_int_cast<sal_uInt16>(aObjKind)); | |||
199 | ||||
200 | aOldPointer = pWindow->GetPointer(); | |||
201 | rViewShell.SetActivePointer( aNewPointer ); | |||
202 | ||||
203 | FuConstruct::Activate(); | |||
204 | } | |||
205 | ||||
206 | void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject& rObj, sal_uInt16 nSlotId) | |||
207 | { | |||
208 | SdrModel& rModel(rObj.getSdrModelFromSdrObject()); | |||
209 | ||||
210 | if ( !(nSlotId == SID_LINE_ARROW_START( 10000 + 1165 ) || | |||
211 | nSlotId == SID_LINE_ARROW_END( 10000 + 1166 ) || | |||
212 | nSlotId == SID_LINE_ARROWS( 10000 + 1163 ) || | |||
213 | nSlotId == SID_LINE_ARROW_CIRCLE( 10000 + 1159 ) || | |||
214 | nSlotId == SID_LINE_CIRCLE_ARROW( 10000 + 1161 ) || | |||
215 | nSlotId == SID_LINE_ARROW_SQUARE( 10000 + 1160 ) || | |||
216 | nSlotId == SID_LINE_SQUARE_ARROW( 10000 + 1162 ) || | |||
217 | nSlotId == SID_DRAW_MEASURELINE( 10000 + 1167 )) ) | |||
218 | return; | |||
219 | ||||
220 | ||||
221 | // set attributes of line start and ends | |||
222 | ||||
223 | // arrowhead | |||
224 | ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROWreinterpret_cast<char const *>("RID_SVXSTR_ARROW" "\004" u8"Arrow"), rModel ) ); | |||
225 | if( !aArrow.count() ) | |||
226 | { | |||
227 | ::basegfx::B2DPolygon aNewArrow; | |||
228 | aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0)); | |||
229 | aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0)); | |||
230 | aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0)); | |||
231 | aNewArrow.setClosed(true); | |||
232 | aArrow.append(aNewArrow); | |||
233 | } | |||
234 | ||||
235 | // Circles | |||
236 | ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLEreinterpret_cast<char const *>("RID_SVXSTR_CIRCLE" "\004" u8"Circle"), rModel ) ); | |||
237 | if( !aCircle.count() ) | |||
238 | { | |||
239 | ::basegfx::B2DPolygon aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0); | |||
240 | aNewCircle.setClosed(true); | |||
241 | aCircle.append(aNewCircle); | |||
242 | } | |||
243 | ||||
244 | // Square | |||
245 | ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUAREreinterpret_cast<char const *>("RID_SVXSTR_SQUARE" "\004" u8"Square"), rModel ) ); | |||
246 | if( !aSquare.count() ) | |||
247 | { | |||
248 | ::basegfx::B2DPolygon aNewSquare; | |||
249 | aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0)); | |||
250 | aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0)); | |||
251 | aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0)); | |||
252 | aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0)); | |||
253 | aNewSquare.setClosed(true); | |||
254 | aSquare.append(aNewSquare); | |||
255 | } | |||
256 | ||||
257 | SfxItemSet aSet( rModel.GetItemPool() ); | |||
258 | long nWidth = 200; // (1/100th mm) | |||
259 | ||||
260 | // determine line width and calculate with it the line end width | |||
261 | if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) | |||
262 | { | |||
263 | long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue(); | |||
264 | if( nValue > 0 ) | |||
265 | nWidth = nValue * 3; | |||
266 | } | |||
267 | ||||
268 | switch (nSlotId) | |||
269 | { | |||
270 | case SID_LINE_ARROWS( 10000 + 1163 ): | |||
271 | case SID_DRAW_MEASURELINE( 10000 + 1167 ): | |||
272 | { | |||
273 | // connector with arrow ends | |||
274 | rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROWreinterpret_cast<char const *>("RID_SVXSTR_ARROW" "\004" u8"Arrow")), aArrow)); | |||
275 | rAttr.Put(XLineStartWidthItem(nWidth)); | |||
276 | rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROWreinterpret_cast<char const *>("RID_SVXSTR_ARROW" "\004" u8"Arrow")), aArrow)); | |||
277 | rAttr.Put(XLineEndWidthItem(nWidth)); | |||
278 | } | |||
279 | break; | |||
280 | ||||
281 | case SID_LINE_ARROW_START( 10000 + 1165 ): | |||
282 | case SID_LINE_ARROW_CIRCLE( 10000 + 1159 ): | |||
283 | case SID_LINE_ARROW_SQUARE( 10000 + 1160 ): | |||
284 | { | |||
285 | // connector with arrow start | |||
286 | rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROWreinterpret_cast<char const *>("RID_SVXSTR_ARROW" "\004" u8"Arrow")), aArrow)); | |||
287 | rAttr.Put(XLineStartWidthItem(nWidth)); | |||
288 | } | |||
289 | break; | |||
290 | ||||
291 | case SID_LINE_ARROW_END( 10000 + 1166 ): | |||
292 | case SID_LINE_CIRCLE_ARROW( 10000 + 1161 ): | |||
293 | case SID_LINE_SQUARE_ARROW( 10000 + 1162 ): | |||
294 | { | |||
295 | // connector with arrow end | |||
296 | rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROWreinterpret_cast<char const *>("RID_SVXSTR_ARROW" "\004" u8"Arrow")), aArrow)); | |||
297 | rAttr.Put(XLineEndWidthItem(nWidth)); | |||
298 | } | |||
299 | break; | |||
300 | } | |||
301 | ||||
302 | // and again, for the still missing ends | |||
303 | switch (nSlotId) | |||
304 | { | |||
305 | case SID_LINE_ARROW_CIRCLE( 10000 + 1159 ): | |||
306 | { | |||
307 | // circle end | |||
308 | rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLEreinterpret_cast<char const *>("RID_SVXSTR_CIRCLE" "\004" u8"Circle")), aCircle)); | |||
309 | rAttr.Put(XLineEndWidthItem(nWidth)); | |||
310 | } | |||
311 | break; | |||
312 | ||||
313 | case SID_LINE_CIRCLE_ARROW( 10000 + 1161 ): | |||
314 | { | |||
315 | // circle start | |||
316 | rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLEreinterpret_cast<char const *>("RID_SVXSTR_CIRCLE" "\004" u8"Circle")), aCircle)); | |||
317 | rAttr.Put(XLineStartWidthItem(nWidth)); | |||
318 | } | |||
319 | break; | |||
320 | ||||
321 | case SID_LINE_ARROW_SQUARE( 10000 + 1160 ): | |||
322 | { | |||
323 | // square end | |||
324 | rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_SQUAREreinterpret_cast<char const *>("RID_SVXSTR_SQUARE" "\004" u8"Square")), aSquare)); | |||
325 | rAttr.Put(XLineEndWidthItem(nWidth)); | |||
326 | } | |||
327 | break; | |||
328 | ||||
329 | case SID_LINE_SQUARE_ARROW( 10000 + 1162 ): | |||
330 | { | |||
331 | // square start | |||
332 | rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_SQUAREreinterpret_cast<char const *>("RID_SVXSTR_SQUARE" "\004" u8"Square")), aSquare)); | |||
333 | rAttr.Put(XLineStartWidthItem(nWidth)); | |||
334 | } | |||
335 | break; | |||
336 | } | |||
337 | } | |||
338 | ||||
339 | void FuConstRectangle::Deactivate() | |||
340 | { | |||
341 | FuConstruct::Deactivate(); | |||
342 | rViewShell.SetActivePointer( aOldPointer ); | |||
343 | } | |||
344 | ||||
345 | // Create default drawing objects via keyboard | |||
346 | SdrObjectUniquePtr FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) | |||
347 | { | |||
348 | SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject( | |||
349 | *pDrDoc, | |||
350 | pView->GetCurrentObjInventor(), | |||
351 | pView->GetCurrentObjIdentifier())); | |||
352 | ||||
353 | if(pObj) | |||
354 | { | |||
355 | tools::Rectangle aRect(rRectangle); | |||
356 | Point aStart = aRect.TopLeft(); | |||
357 | Point aEnd = aRect.BottomRight(); | |||
358 | ||||
359 | switch(nID) | |||
360 | { | |||
361 | case SID_DRAW_LINE( 10000 + 102 ): | |||
362 | case SID_DRAW_XLINE( 10000 + 103 ): | |||
363 | case SID_LINE_ARROW_END( 10000 + 1166 ): | |||
364 | case SID_LINE_ARROW_CIRCLE( 10000 + 1159 ): | |||
365 | case SID_LINE_ARROW_SQUARE( 10000 + 1160 ): | |||
366 | case SID_LINE_ARROW_START( 10000 + 1165 ): | |||
367 | case SID_LINE_CIRCLE_ARROW( 10000 + 1161 ): | |||
368 | case SID_LINE_SQUARE_ARROW( 10000 + 1162 ): | |||
369 | case SID_LINE_ARROWS( 10000 + 1163 ): | |||
370 | { | |||
371 | if(auto pPathObj = dynamic_cast<SdrPathObj*>( pObj.get() )) | |||
372 | { | |||
373 | sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); | |||
374 | basegfx::B2DPolygon aPoly; | |||
375 | aPoly.append(basegfx::B2DPoint(aStart.X(), nYMiddle)); | |||
376 | aPoly.append(basegfx::B2DPoint(aEnd.X(), nYMiddle)); | |||
377 | pPathObj->SetPathPoly(basegfx::B2DPolyPolygon(aPoly)); | |||
378 | } | |||
379 | else | |||
380 | { | |||
381 | OSL_FAIL("Object is NO line object")do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/drawfunc/fuconrec.cxx" ":" "381" ": "), "%s", "Object is NO line object"); } } while (false); | |||
382 | } | |||
383 | ||||
384 | break; | |||
385 | } | |||
386 | ||||
387 | case SID_DRAW_MEASURELINE( 10000 + 1167 ): | |||
388 | { | |||
389 | if(auto pMeasureObj = dynamic_cast<SdrMeasureObj*>( pObj.get() )) | |||
390 | { | |||
391 | sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); | |||
392 | pMeasureObj->SetPoint(Point(aStart.X(), nYMiddle), 0); | |||
393 | pMeasureObj->SetPoint(Point(aEnd.X(), nYMiddle), 1); | |||
394 | } | |||
395 | ||||
396 | break; | |||
397 | } | |||
398 | ||||
399 | case SID_DRAW_CAPTION( 10000 + 254 ): | |||
400 | case SID_DRAW_CAPTION_VERTICAL( 10000 + 906 ): | |||
401 | { | |||
402 | if(auto pCaptionObj = dynamic_cast<SdrCaptionObj*>( pObj.get() )) | |||
403 | { | |||
404 | bool bIsVertical(SID_DRAW_CAPTION_VERTICAL( 10000 + 906 ) == nID); | |||
405 | ||||
406 | pCaptionObj->SetVerticalWriting(bIsVertical); | |||
407 | ||||
408 | if(bIsVertical) | |||
409 | { | |||
410 | SfxItemSet aSet(pObj->GetMergedItemSet()); | |||
411 | aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); | |||
412 | aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); | |||
413 | pObj->SetMergedItemSet(aSet); | |||
414 | } | |||
415 | ||||
416 | // don't set default text, start edit mode instead | |||
417 | // (Edit mode is started in ScTabViewShell::ExecDraw, because | |||
418 | // it must be handled by FuText) | |||
419 | ||||
420 | pCaptionObj->SetLogicRect(aRect); | |||
421 | pCaptionObj->SetTailPos( | |||
422 | aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2)); | |||
423 | } | |||
424 | else | |||
425 | { | |||
426 | OSL_FAIL("Object is NO caption object")do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/drawfunc/fuconrec.cxx" ":" "426" ": "), "%s", "Object is NO caption object"); } } while (false); | |||
427 | } | |||
428 | ||||
429 | break; | |||
430 | } | |||
431 | ||||
432 | default: | |||
433 | { | |||
434 | pObj->SetLogicRect(aRect); | |||
435 | ||||
436 | break; | |||
437 | } | |||
438 | } | |||
439 | ||||
440 | SfxItemSet aAttr(pDrDoc->GetItemPool()); | |||
441 | SetLineEnds(aAttr, *pObj, nID); | |||
442 | pObj->SetMergedItemSet(aAttr); | |||
443 | } | |||
444 | ||||
445 | return pObj; | |||
446 | } | |||
447 | ||||
448 | /* 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_SVX_SVDCRTV_HXX |
21 | #define INCLUDED_SVX_SVDCRTV_HXX |
22 | |
23 | #include <svx/svddrgv.hxx> |
24 | #include <svx/svxdllapi.h> |
25 | #include <memory> |
26 | |
27 | class XLineAttrSetItem; |
28 | class XFillAttrSetItem; |
29 | class SdrEdgeObj; |
30 | class SdrObjConnection; |
31 | |
32 | class ImplConnectMarkerOverlay; |
33 | class ImpSdrCreateViewExtraData; |
34 | |
35 | class SVXCORE_DLLPUBLIC__attribute__ ((visibility("default"))) SdrCreateView : public SdrDragView |
36 | { |
37 | friend class SdrPageView; |
38 | |
39 | protected: |
40 | SdrObject* pCurrentCreate; // The currently being created object |
41 | SdrPageView* pCreatePV; // Here, the creation is started |
42 | std::unique_ptr<ImplConnectMarkerOverlay> mpCoMaOverlay; |
43 | |
44 | // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to |
45 | // compile the apps all the time |
46 | std::unique_ptr<ImpSdrCreateViewExtraData> mpCreateViewExtraData; |
47 | |
48 | PointerStyle aCurrentCreatePointer; |
49 | |
50 | sal_Int32 nAutoCloseDistPix; |
51 | sal_Int32 nFreeHandMinDistPix; |
52 | SdrInventor nCurrentInvent; // set the current ones |
53 | sal_uInt16 nCurrentIdent; // Obj for re-creating |
54 | |
55 | bool b1stPointAsCenter : 1; |
56 | bool bUseIncompatiblePathCreateInterface : 1; |
57 | |
58 | void ImpClearConnectMarker(); |
59 | |
60 | protected: |
61 | bool ImpBegCreateObj(SdrInventor nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut, |
62 | sal_Int16 nMinMov, const tools::Rectangle& rLogRect, SdrObject* pPreparedFactoryObject); |
63 | |
64 | void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/); |
65 | void HideCreateObj(/*OutputDevice* pOut, bool bFull*/); |
66 | bool CheckEdgeMode(); |
67 | |
68 | protected: |
69 | // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView |
70 | SdrCreateView( |
71 | SdrModel& rSdrModel, |
72 | OutputDevice* pOut); |
73 | |
74 | virtual ~SdrCreateView() override; |
75 | |
76 | public: |
77 | virtual bool IsAction() const override; |
78 | virtual void MovAction(const Point& rPnt) override; |
79 | virtual void EndAction() override; |
80 | virtual void BckAction() override; |
81 | virtual void BrkAction() override; |
82 | virtual void TakeActionRect(tools::Rectangle& rRect) const override; |
83 | |
84 | virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; |
85 | |
86 | void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; } |
87 | |
88 | // If the MeasureLayer is not set (empty string), then use the active layer for measuring. |
89 | void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); } |
90 | void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); } |
91 | void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); } |
92 | void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); } |
93 | |
94 | // Determine whether a text tool is activated |
95 | bool IsTextTool() const; |
96 | |
97 | // Determine whether an object connector tool activated |
98 | bool IsEdgeTool() const; |
99 | |
100 | // Determine whether a measurement tool activated |
101 | bool IsMeasureTool() const; |
102 | |
103 | void SetCurrentObj(sal_uInt16 nIdent, SdrInventor nInvent=SdrInventor::Default); |
104 | void TakeCurrentObj(sal_uInt16& nIdent, SdrInventor& nInvent) const { nInvent=nCurrentInvent; nIdent=nCurrentIdent; } |
105 | SdrInventor GetCurrentObjInventor() const { return nCurrentInvent; } |
106 | sal_uInt16 GetCurrentObjIdentifier() const { return nCurrentIdent; } |
107 | |
108 | // Beginning the regular Create |
109 | bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=nullptr, short nMinMov=-3); |
110 | bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject); |
111 | void MovCreateObj(const Point& rPnt); |
112 | bool EndCreateObj(SdrCreateCmd eCmd); |
113 | void BckCreateObj(); // go back one polygon point |
114 | void BrkCreateObj(); |
115 | bool IsCreateObj() const { return pCurrentCreate!=nullptr; } |
116 | SdrObject* GetCreateObj() const { return pCurrentCreate; } |
117 | |
118 | /// Setup layer (eg. foreground / background) of the given object. |
119 | static void SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj); |
120 | |
121 | // BegCreateCaptionObj() creates a SdrCaptionObj (legend item). |
122 | // rObjSiz is the initial size of the legend text frame. |
123 | // Only the length of the tip is dragged |
124 | bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=nullptr, short nMinMov=-3); |
125 | |
126 | // Create a circle/rectangle/text frame with the first Point being |
127 | // the center of the object instead of the upper-left corner. |
128 | // Persistent flag. Default = FALSE. |
129 | bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; } |
130 | void SetCreate1stPointAsCenter(bool bOn) { b1stPointAsCenter = bOn; } |
131 | |
132 | // Default = 5 Pixel |
133 | sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); } |
134 | |
135 | // Setting for the minimum distance in pixels between 2 bezier points when |
136 | // creating a freehand line. |
137 | // Default = 10 Pixel |
138 | sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); } |
139 | |
140 | // FIXME: Whoever wants to keep the Create Interface for the PathObj which is |
141 | // incompatible with the rest of the Create functionality of SvDraw, needs |
142 | // to set the following flag. It affects the following object types: |
143 | // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL |
144 | |
145 | // This flag should be regarded as temporary. The affected applications should |
146 | // be changed soon. |
147 | // Default = sal_False; |
148 | bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; } |
149 | void SetUseIncompatiblePathCreateInterface(bool bOn) { bUseIncompatiblePathCreateInterface = bOn; } |
150 | void SetConnectMarker(const SdrObjConnection& rCon); |
151 | void HideConnectMarker(); |
152 | |
153 | // Attributes of the object that is in the process of being created |
154 | /* new interface src537 */ |
155 | void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const; |
156 | |
157 | bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll); |
158 | SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const; |
159 | void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr); |
160 | }; |
161 | |
162 | #endif // INCLUDED_SVX_SVDCRTV_HXX |
163 | |
164 | /* 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_EVENT_HXX |
21 | #define INCLUDED_VCL_EVENT_HXX |
22 | |
23 | #include <vcl/dllapi.h> |
24 | #include <tools/gen.hxx> |
25 | #include <vcl/keycod.hxx> |
26 | #include <vcl/settings.hxx> |
27 | #include <vcl/vclptr.hxx> |
28 | #include <vcl/outdev.hxx> |
29 | #include <vcl/window.hxx> |
30 | #include <optional> |
31 | |
32 | class CommandEvent; |
33 | |
34 | enum class TextDirectionality { |
35 | LeftToRight_TopToBottom, |
36 | RightToLeft_TopToBottom, |
37 | TopToBottom_RightToLeft, |
38 | BottomToTop_LeftToRight |
39 | }; |
40 | |
41 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) KeyEvent |
42 | { |
43 | private: |
44 | vcl::KeyCode maKeyCode; |
45 | sal_uInt16 mnRepeat; |
46 | sal_Unicode mnCharCode; |
47 | |
48 | public: |
49 | KeyEvent(); |
50 | KeyEvent( sal_Unicode nChar, const vcl::KeyCode& rKeyCode, |
51 | sal_uInt16 nRepeat = 0 ); |
52 | |
53 | sal_Unicode GetCharCode() const { return mnCharCode; } |
54 | const vcl::KeyCode& GetKeyCode() const { return maKeyCode; } |
55 | sal_uInt16 GetRepeat() const { return mnRepeat; } |
56 | |
57 | KeyEvent LogicalTextDirectionality (TextDirectionality eMode) const; |
58 | }; |
59 | |
60 | inline KeyEvent::KeyEvent() |
61 | { |
62 | mnCharCode = 0; |
63 | mnRepeat = 0; |
64 | } |
65 | |
66 | inline KeyEvent::KeyEvent( sal_Unicode nChar, const vcl::KeyCode& rKeyCode, |
67 | sal_uInt16 nRepeat ) : |
68 | maKeyCode( rKeyCode ) |
69 | |
70 | { |
71 | mnCharCode = nChar; |
72 | mnRepeat = nRepeat; |
73 | } |
74 | |
75 | |
76 | enum class MouseEventModifiers |
77 | { |
78 | NONE = 0, |
79 | // mouse move modifiers |
80 | SIMPLEMOVE = 0x0001, |
81 | DRAGMOVE = 0x0002, |
82 | DRAGCOPY = 0x0004, |
83 | ENTERWINDOW = 0x0010, |
84 | LEAVEWINDOW = 0x0020, |
85 | SYNTHETIC = 0x0040, |
86 | MODIFIERCHANGED = 0x0080, |
87 | // mouse up/down-button modifiers |
88 | SIMPLECLICK = 0x0100, |
89 | SELECT = 0x0200, |
90 | MULTISELECT = 0x0400, |
91 | RANGESELECT = 0x0800 |
92 | }; |
93 | namespace o3tl |
94 | { |
95 | template<> struct typed_flags<MouseEventModifiers> : is_typed_flags<MouseEventModifiers, 0xff7> {}; |
96 | } |
97 | |
98 | // Mouse buttons |
99 | #define MOUSE_LEFT(sal_uInt16(0x0001)) (sal_uInt16(0x0001)) |
100 | #define MOUSE_MIDDLE(sal_uInt16(0x0002)) (sal_uInt16(0x0002)) |
101 | #define MOUSE_RIGHT(sal_uInt16(0x0004)) (sal_uInt16(0x0004)) |
102 | |
103 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) MouseEvent |
104 | { |
105 | private: |
106 | Point maPos; |
107 | MouseEventModifiers mnMode; |
108 | sal_uInt16 mnClicks; |
109 | sal_uInt16 mnCode; |
110 | |
111 | // Set, if the document relative logic position are available |
112 | std::optional<Point> maLogicPosition; |
113 | |
114 | public: |
115 | explicit MouseEvent(); |
116 | explicit MouseEvent( const Point& rPos, sal_uInt16 nClicks = 1, |
117 | MouseEventModifiers nMode = MouseEventModifiers::NONE, sal_uInt16 nButtons = 0, |
118 | sal_uInt16 nModifier = 0 ); |
119 | |
120 | const Point& GetPosPixel() const { return maPos; } |
121 | MouseEventModifiers GetMode() const { return mnMode; } |
122 | |
123 | sal_uInt16 GetClicks() const { return mnClicks; } |
124 | |
125 | void setLogicPosition(Point aLogicPosition) |
126 | { |
127 | maLogicPosition = aLogicPosition; |
128 | } |
129 | |
130 | std::optional<Point> getLogicPosition() const |
131 | { |
132 | return maLogicPosition; |
133 | } |
134 | |
135 | bool IsEnterWindow() const |
136 | { return bool(mnMode & MouseEventModifiers::ENTERWINDOW); } |
137 | bool IsLeaveWindow() const |
138 | { return bool(mnMode & MouseEventModifiers::LEAVEWINDOW); } |
139 | bool IsSynthetic() const |
140 | { return bool(mnMode & MouseEventModifiers::SYNTHETIC); } |
141 | bool IsModifierChanged() const |
142 | { return bool(mnMode & MouseEventModifiers::MODIFIERCHANGED); } |
143 | |
144 | sal_uInt16 GetButtons() const |
145 | { return (mnCode & (MOUSE_LEFT(sal_uInt16(0x0001)) | MOUSE_MIDDLE(sal_uInt16(0x0002)) | MOUSE_RIGHT(sal_uInt16(0x0004)))); } |
146 | bool IsLeft() const |
147 | { return ((mnCode & MOUSE_LEFT(sal_uInt16(0x0001))) != 0); } |
148 | bool IsMiddle() const |
149 | { return ((mnCode & MOUSE_MIDDLE(sal_uInt16(0x0002))) != 0); } |
150 | bool IsRight() const |
151 | { return ((mnCode & MOUSE_RIGHT(sal_uInt16(0x0004))) != 0); } |
152 | |
153 | sal_uInt16 GetModifier() const |
154 | { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); } |
155 | bool IsShift() const |
156 | { return ((mnCode & KEY_SHIFT) != 0); } |
157 | bool IsMod1() const |
158 | { return ((mnCode & KEY_MOD1) != 0); } |
159 | bool IsMod2() const |
160 | { return ((mnCode & KEY_MOD2) != 0); } |
161 | bool IsMod3() const |
162 | { return ((mnCode & KEY_MOD3) != 0); } |
163 | }; |
164 | |
165 | inline MouseEvent::MouseEvent() |
166 | { |
167 | mnMode = MouseEventModifiers::NONE; |
168 | mnClicks = 0; |
169 | mnCode = 0; |
170 | } |
171 | |
172 | inline MouseEvent::MouseEvent( const Point& rPos, sal_uInt16 nClicks, |
173 | MouseEventModifiers nMode, |
174 | sal_uInt16 nButtons, sal_uInt16 nModifier ) : |
175 | maPos( rPos ) |
176 | { |
177 | mnClicks = nClicks; |
178 | mnMode = nMode; |
179 | mnCode = nButtons | nModifier; |
180 | } |
181 | |
182 | enum class HelpEventMode |
183 | { |
184 | NONE = 0x0000, |
185 | CONTEXT = 0x0001, |
186 | BALLOON = 0x0002, |
187 | QUICK = 0x0004 |
188 | }; |
189 | namespace o3tl |
190 | { |
191 | template<> struct typed_flags<HelpEventMode> : is_typed_flags<HelpEventMode, 0x07> {}; |
192 | } |
193 | |
194 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) HelpEvent |
195 | { |
196 | private: |
197 | Point maPos; |
198 | HelpEventMode mnMode; |
199 | bool mbKeyboardActivated; |
200 | |
201 | public: |
202 | explicit HelpEvent( const Point& rMousePos, HelpEventMode nHelpMode ); |
203 | |
204 | const Point& GetMousePosPixel() const { return maPos; } |
205 | HelpEventMode GetMode() const { return mnMode; } |
206 | bool KeyboardActivated() const { return mbKeyboardActivated; } |
207 | void SetKeyboardActivated( bool bKeyboard ) { mbKeyboardActivated = bKeyboard; } |
208 | }; |
209 | |
210 | inline HelpEvent::HelpEvent( const Point& rMousePos, HelpEventMode nHelpMode ) : |
211 | maPos( rMousePos ) |
212 | { |
213 | mnMode = nHelpMode; |
214 | mbKeyboardActivated = false; |
215 | } |
216 | |
217 | /// Event to pass information for UserDraw() handling eg. in comboboxes. |
218 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) UserDrawEvent |
219 | { |
220 | private: |
221 | /// Window that owns the user draw. |
222 | VclPtr<vcl::Window> mpWindow; |
223 | |
224 | /// RenderContext to which we should draw - can be a VirtualDevice or anything. |
225 | VclPtr<vcl::RenderContext> mpRenderContext; |
226 | |
227 | tools::Rectangle maOutRect; |
228 | sal_uInt16 mnItemId; |
229 | bool mbSelected; |
230 | |
231 | public: |
232 | UserDrawEvent(vcl::Window* pWindow, vcl::RenderContext* pRenderContext, |
233 | const tools::Rectangle& rOutRect, sal_uInt16 nId, bool bSelected = false) |
234 | : mpWindow(pWindow) |
235 | , mpRenderContext(pRenderContext) |
236 | , maOutRect( rOutRect ) |
237 | , mnItemId(nId) |
238 | , mbSelected(bSelected) |
239 | { |
240 | } |
241 | |
242 | vcl::Window* GetWindow() const { return mpWindow; } |
243 | vcl::RenderContext* GetRenderContext() const { return mpRenderContext; } |
244 | const tools::Rectangle& GetRect() const { return maOutRect; } |
245 | sal_uInt16 GetItemId() const { return mnItemId; } |
246 | bool IsSelected() const { return mbSelected; } |
247 | }; |
248 | |
249 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) TrackingEvent |
250 | { |
251 | private: |
252 | MouseEvent maMEvt; |
253 | TrackingEventFlags mnFlags; |
254 | |
255 | public: |
256 | explicit TrackingEvent( const MouseEvent&, |
257 | TrackingEventFlags nTrackFlags = TrackingEventFlags::NONE ); |
258 | |
259 | const MouseEvent& GetMouseEvent() const { return maMEvt; } |
260 | |
261 | bool IsTrackingRepeat() const |
262 | { return bool(mnFlags & TrackingEventFlags::Repeat); } |
263 | bool IsTrackingEnded() const |
264 | { return bool(mnFlags & TrackingEventFlags::End); } |
265 | bool IsTrackingCanceled() const |
266 | { return bool(mnFlags & TrackingEventFlags::Cancel); } |
267 | }; |
268 | |
269 | inline TrackingEvent::TrackingEvent( const MouseEvent& rMEvt, |
270 | TrackingEventFlags nTrackFlags ) : |
271 | maMEvt( rMEvt ) |
272 | { |
273 | mnFlags = nTrackFlags; |
274 | } |
275 | |
276 | |
277 | enum class MouseNotifyEvent |
278 | { |
279 | NONE = 0, |
280 | MOUSEBUTTONDOWN = 1, |
281 | MOUSEBUTTONUP = 2, |
282 | MOUSEMOVE = 3, |
283 | KEYINPUT = 4, |
284 | KEYUP = 5, |
285 | GETFOCUS = 6, |
286 | LOSEFOCUS = 7, |
287 | COMMAND = 8, |
288 | INPUTENABLE = 10 |
289 | }; |
290 | |
291 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) NotifyEvent |
292 | { |
293 | private: |
294 | VclPtr<vcl::Window> mpWindow; |
295 | void* mpData; |
296 | MouseNotifyEvent mnEventType; |
297 | |
298 | public: |
299 | NotifyEvent( MouseNotifyEvent nEventType, |
300 | vcl::Window* pWindow, |
301 | const void* pEvent = nullptr ); |
302 | |
303 | MouseNotifyEvent GetType() const { return mnEventType; } |
304 | vcl::Window* GetWindow() const { return mpWindow; } |
305 | void* GetData() const { return mpData; } |
306 | const KeyEvent* GetKeyEvent() const; |
307 | const MouseEvent* GetMouseEvent() const; |
308 | const CommandEvent* GetCommandEvent() const; |
309 | }; |
310 | |
311 | inline const KeyEvent* NotifyEvent::GetKeyEvent() const |
312 | { |
313 | if ( (mnEventType == MouseNotifyEvent::KEYINPUT) || (mnEventType == MouseNotifyEvent::KEYUP) ) |
314 | return static_cast<const KeyEvent*>(mpData); |
315 | else |
316 | return nullptr; |
317 | } |
318 | |
319 | inline const MouseEvent* NotifyEvent::GetMouseEvent() const |
320 | { |
321 | if ( (mnEventType >= MouseNotifyEvent::MOUSEBUTTONDOWN) && (mnEventType <= MouseNotifyEvent::MOUSEMOVE) ) |
322 | return static_cast<const MouseEvent*>(mpData); |
323 | else |
324 | return nullptr; |
325 | } |
326 | |
327 | inline const CommandEvent* NotifyEvent::GetCommandEvent() const |
328 | { |
329 | if ( mnEventType == MouseNotifyEvent::COMMAND ) |
330 | return static_cast<const CommandEvent*>(mpData); |
331 | else |
332 | return nullptr; |
333 | } |
334 | |
335 | |
336 | enum class DataChangedEventType { |
337 | NONE = 0, |
338 | SETTINGS = 1, |
339 | DISPLAY = 2, |
340 | FONTS = 4, |
341 | PRINTER = 5, |
342 | FONTSUBSTITUTION = 6 |
343 | }; |
344 | |
345 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) DataChangedEvent |
346 | { |
347 | private: |
348 | void* mpData; |
349 | AllSettingsFlags mnFlags; |
350 | DataChangedEventType mnType; |
351 | |
352 | public: |
353 | explicit DataChangedEvent( DataChangedEventType nType, |
354 | const void* pData = nullptr, |
355 | AllSettingsFlags nFlags = AllSettingsFlags::NONE ); |
356 | |
357 | DataChangedEventType GetType() const { return mnType; } |
358 | AllSettingsFlags GetFlags() const { return mnFlags; } |
359 | |
360 | const AllSettings* GetOldSettings() const; |
361 | }; |
362 | |
363 | inline DataChangedEvent::DataChangedEvent( DataChangedEventType nType, |
364 | const void* pData, |
365 | AllSettingsFlags nChangeFlags ) |
366 | { |
367 | mpData = const_cast<void*>(pData); |
368 | mnFlags = nChangeFlags; |
369 | mnType = nType; |
370 | } |
371 | |
372 | inline const AllSettings* DataChangedEvent::GetOldSettings() const |
373 | { |
374 | if ( mnType == DataChangedEventType::SETTINGS ) |
375 | return static_cast<const AllSettings*>(mpData); |
376 | else |
377 | return nullptr; |
378 | } |
379 | |
380 | #endif // INCLUDED_VCL_EVENT_HXX |
381 | |
382 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |