Bug Summary

File:home/maarten/src/libreoffice/core/sc/source/ui/drawfunc/futext.cxx
Warning:line 218, column 28
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name futext.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -isystem /usr/include/libxml2 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SC_DLLIMPLEMENTATION -D SC_INFO_OSVERSION="LINUX" -D SYSTEM_LIBXML -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/liborcus/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/mdds/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/i18n -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/common -I /home/maarten/src/libreoffice/core/external/clew/source/include -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/sc/source/core/inc -I /home/maarten/src/libreoffice/core/sc/source/filter/inc -I /home/maarten/src/libreoffice/core/sc/source/ui/inc -I /home/maarten/src/libreoffice/core/sc/inc -I /home/maarten/src/libreoffice/core/workdir/SdiTarget/sc/sdi -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/oovbaapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/sc/source/ui/drawfunc/futext.cxx

/home/maarten/src/libreoffice/core/sc/source/ui/drawfunc/futext.cxx

1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <svx/svddef.hxx>
21#include <svx/svdoutl.hxx>
22#include <editeng/outlobj.hxx>
23#include <svx/sdtaaitm.hxx>
24#include <svx/sdtacitm.hxx>
25#include <svx/svdotext.hxx>
26#include <svx/sdtagitm.hxx>
27#include <editeng/unolingu.hxx>
28#include <sfx2/bindings.hxx>
29#include <sfx2/dispatch.hxx>
30#include <sfx2/viewfrm.hxx>
31#include <svx/svxids.hrc>
32#include <editeng/eeitem.hxx>
33#include <svl/itemset.hxx>
34
35#include <futext.hxx>
36#include <drwlayer.hxx>
37#include <sc.hrc>
38#include <tabvwsh.hxx>
39#include <drawview.hxx>
40
41// maximum of mouse movement which allows to start Drag&Drop
42//! fusel,fuconstr,futext - combined!
43#define SC_MAXDRAGMOVE3 3
44
45static void lcl_InvalidateAttribs( SfxBindings& rBindings )
46{
47 rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT( 10000 + 9 ) );
48 rBindings.Invalidate( SID_ATTR_CHAR_POSTURE( 10000 + 8 ) );
49 rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE( 10000 + 14 ) );
50 rBindings.Invalidate( SID_ULINE_VAL_NONE(10000 + 1195) );
51 rBindings.Invalidate( SID_ULINE_VAL_SINGLE(10000 + 1196) );
52 rBindings.Invalidate( SID_ULINE_VAL_DOUBLE(10000 + 1197) );
53 rBindings.Invalidate( SID_ULINE_VAL_DOTTED(10000 + 1198) );
54 rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE( ((10000 + 1499) + 1) + 68 ) );
55 rBindings.Invalidate( SID_ATTR_CHAR_COLOR( 10000 + 17 ) );
56 rBindings.Invalidate( SID_ATTR_CHAR_BACK_COLOR( 10000 + 1153 ) );
57 rBindings.Invalidate( SID_ATTR_CHAR_FONT( 10000 + 7 ) );
58 rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT( 10000 + 15 ) );
59 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT( 10000 + 28 ) );
60 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT( 10000 + 29 ) );
61 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK( 10000 + 31 ) );
62 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER( 10000 + 30 ));
63 rBindings.Invalidate( SID_ALIGNLEFT((((((((((((((((((26000 + 200) + 20)) + 20)) + 20)) + 25)) + 22
)) + 20)) + 29)) + 20))+6)
);
64 rBindings.Invalidate( SID_ALIGNCENTERHOR((((((((((((((((((26000 + 200) + 20)) + 20)) + 20)) + 25)) + 22
)) + 20)) + 29)) + 20))+8)
);
65 rBindings.Invalidate( SID_ALIGNRIGHT((((((((((((((((((26000 + 200) + 20)) + 20)) + 20)) + 25)) + 22
)) + 20)) + 29)) + 20))+7)
);
66 rBindings.Invalidate( SID_ALIGNBLOCK((((((((((((((((((26000 + 200) + 20)) + 20)) + 20)) + 25)) + 22
)) + 20)) + 29)) + 20))+9)
);
67 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10( 10000 + 34 ) );
68 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15( 10000 + 35 ) );
69 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20( 10000 + 36 ) );
70 rBindings.Invalidate( SID_SET_SUPER_SCRIPT( 10000 + 294 ) );
71 rBindings.Invalidate( SID_SET_SUB_SCRIPT( 10000 + 295 ) );
72 rBindings.Invalidate( SID_HYPERLINK_GETLINK(10000 + 361) );
73 rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT( 10000 + 907 ) );
74 rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM( 10000 + 908 ) );
75 rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT( 10000 + 950 ) );
76 rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT( 10000 + 951 ) );
77 rBindings.Invalidate( SID_TABLE_VERT_NONE( 10000 + 1075 ) );
78 rBindings.Invalidate( SID_TABLE_VERT_CENTER( 10000 + 1074 ) );
79 rBindings.Invalidate( SID_TABLE_VERT_BOTTOM( 10000 + 1073 ) );
80 // pseudo slots for Format menu
81 rBindings.Invalidate( SID_ALIGN_ANY_LEFT( 10000 + 1002 ) );
82 rBindings.Invalidate( SID_ALIGN_ANY_HCENTER( 10000 + 1003 ) );
83 rBindings.Invalidate( SID_ALIGN_ANY_RIGHT( 10000 + 1004 ) );
84 rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED( 10000 + 1005 ) );
85 rBindings.Invalidate( SID_ATTR_CHAR_KERNING( 10000 + 18 ) );
86 rBindings.Invalidate( SID_SET_SUPER_SCRIPT( 10000 + 294 ) );
87 rBindings.Invalidate( SID_SET_SUB_SCRIPT( 10000 + 295 ) );
88 rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT( 10000 + 13 ) );
89 rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED( 10000 + 10 ) );
90}
91
92static void lcl_UpdateHyphenator( Outliner& rOutliner, const SdrObject* pObj )
93{
94 // use hyphenator only if hyphenation attribute is set
95 if ( pObj && pObj->GetMergedItem(EE_PARA_HYPHENATE).GetValue() ) {
96 css::uno::Reference<css::linguistic2::XHyphenator> xHyphenator( LinguMgr::GetHyphenator() );
97 rOutliner.SetHyphenator( xHyphenator );
98 }
99}
100
101FuText::FuText(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP,
102 SdrModel* pDoc, const SfxRequest& rReq)
103 : FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq)
104{
105}
106
107FuText::~FuText()
108{
109// StopEditMode(); // in Deactivate !
110}
111
112bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
113{
114 // remember button state for creation of own MouseEvents
115 SetMouseButtonCode(rMEvt.GetButtons());
116 bool bStraightEnter = true;
117
118 if ( pView->MouseButtonDown(rMEvt, pWindow) )
1
Assuming the condition is false
2
Taking false branch
119 return true; // event handled from SdrView
120
121 if ( pView->IsTextEdit() )
3
Assuming the condition is false
4
Taking false branch
122 {
123 if ( IsEditingANote() )
124 {
125 if( !IsSizingOrMovingNote(rMEvt) )
126 {
127 StopEditMode(); // Clicked outside, ending edit
128 bStraightEnter = false;
129 }
130 }
131 else
132 {
133 StopEditMode(); // Clicked outside, ending edit
134 pView->UnmarkAll();
135 bStraightEnter = false;
136 }
137 pView->SetCreateMode();
138 }
139
140 aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
141
142 if ( rMEvt.IsLeft() )
5
Calling 'MouseEvent::IsLeft'
8
Returning from 'MouseEvent::IsLeft'
9
Taking true branch
143 {
144 SdrHdl* pHdl = pView->PickHandle(aMDPos);
10
'pHdl' initialized here
145 const size_t nHdlNum = pView->GetHdlNum(pHdl);
146 if (pHdl != nullptr)
11
Assuming pointer value is null
12
Taking false branch
147 {
148 if (pView->HasMarkablePoints() && pView->IsPointMarkable(*pHdl))
149 {
150 bool bPointMarked=pView->IsPointMarked(*pHdl);
151
152 if ( rMEvt.IsShift() )
153 {
154 if (!bPointMarked)
155 {
156 pView->MarkPoint(*pHdl);
157 }
158 else
159 {
160 pView->UnmarkPoint(*pHdl);
161 }
162 }
163 else
164 {
165 if (!bPointMarked)
166 {
167 pView->UnmarkAllPoints();
168 pView->MarkPoint(*pHdl);
169 }
170 }
171 pHdl=pView->GetHdl(nHdlNum);
172 }
173 }
174
175 SdrPageView* pPV = nullptr;
176
177 if ( pHdl != nullptr || pView->IsMarkedHit(aMDPos) )
13
Assuming the condition is true
14
Taking true branch
178 {
179 SdrObject* pObj = (pHdl == nullptr) ?
15
'?' condition is true
180 pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT) :
181 nullptr;
182 if (pObj)
16
Assuming 'pObj' is null
17
Taking false branch
183 {
184 std::unique_ptr<SdrOutliner> pO = MakeOutliner();
185 lcl_UpdateHyphenator( *pO, pObj );
186
187 // vertical flag:
188 // deduced from slot ids only if text object has no content
189 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
190 bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL( 10000 + 905 ) );
191 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
192 if ( pOPO )
193 bVertical = pOPO->IsVertical(); // content wins
194 pO->SetVertical( bVertical );
195
196 //!?? the default values are not correct when result is without outliner ???!?
197 auto pOTemp = pO.get();
198 if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) )
199 {
200 // subscribe EditEngine-UndoManager
201 rViewShell.SetDrawTextUndo( &pOTemp->GetUndoManager() );
202
203 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
204 if ( pOLV->MouseButtonDown(rMEvt) )
205 return true; // Event to the Outliner
206 }
207 }
208 else
209 {
210 // disable tail & circular move for caption objects.
211 bool bDrag = false;
212 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
213 if( rMarkList.GetMarkCount() == 1 )
18
Assuming the condition is true
19
Taking true branch
214 {
215 SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
216 if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
20
Assuming the condition is true
21
Taking true branch
217 {
218 if(pHdl->GetKind() != SdrHdlKind::Poly && pHdl->GetKind() != SdrHdlKind::Circle)
22
Called C++ object pointer is null
219 bDrag = true;
220 }
221 else
222 bDrag = true; // different object
223 }
224 else
225 bDrag = true; // several objects
226
227 if ( bDrag )
228 {
229 aDragTimer.Start();
230 pView->BegDragObj(aMDPos, nullptr, pHdl);
231 }
232 }
233 }
234 else
235 {
236 if (pView->IsEditMode())
237 {
238 bool bPointMode=pView->HasMarkablePoints();
239
240 if (!rMEvt.IsShift())
241 {
242 if (bPointMode)
243 {
244 pView->UnmarkAllPoints();
245 }
246 else
247 {
248 pView->UnmarkAll();
249 }
250
251 pView->SetDragMode(SdrDragMode::Move);
252 SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
253 rBindings.Invalidate( SID_OBJECT_ROTATETypedWhichId<SfxBoolItem>( 10000 + 129 ) );
254 rBindings.Invalidate( SID_OBJECT_MIRROR( 10000 + 1093 ) );
255 }
256
257 if ( pView->MarkObj(aMDPos, -2, false, rMEvt.IsMod1()) )
258 {
259 aDragTimer.Start();
260
261 pHdl=pView->PickHandle(aMDPos);
262
263 if (pHdl!=nullptr)
264 {
265 pView->MarkPoint(*pHdl);
266 pHdl=pView->GetHdl(nHdlNum);
267 }
268
269 pView->BegDragObj(aMDPos, nullptr, pHdl);
270 }
271 else
272 {
273 if (bPointMode)
274 {
275 pView->BegMarkPoints(aMDPos);
276 }
277 else
278 {
279 pView->BegMarkObj(aMDPos);
280 }
281 }
282 }
283 else if (aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT((26000) + 81) )
284 {
285 // Edit notes -> create no new text objects
286 // and leave text mode
287 rViewShell.GetViewData().GetDispatcher().
288 Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
289 }
290 else
291 {
292 if (bStraightEnter)//Hack for that silly idea that creating text fields is inside the text routine
293 {
294 // create object
295 pView->BegCreateObj(aMDPos);
296 }
297 else if (SdrObject* pObj = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
298 {
299 pView->UnmarkAllObj();
300 ScViewData& rViewData = rViewShell.GetViewData();
301 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
302 pView->MarkObj(pObj,pPV);
303
304 pHdl=pView->PickHandle(aMDPos);
305 pView->BegDragObj(aMDPos, nullptr, pHdl);
306 return true;
307 }
308 }
309 }
310 }
311
312 if (!bIsInDragMode)
313 {
314 pWindow->CaptureMouse();
315// ForcePointer(&rMEvt);
316 lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
317 }
318
319 rViewShell.SetActivePointer(pView->GetPreferredPointer(
320 pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
321 if (!bStraightEnter)
322 {
323 pView->UnmarkAll();
324 ScViewData& rViewData = rViewShell.GetViewData();
325 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
326 }
327
328 return true;
329}
330
331bool FuText::MouseMove(const MouseEvent& rMEvt)
332{
333 rViewShell.SetActivePointer(pView->GetPreferredPointer(
334 pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
335
336 if (aDragTimer.IsActive() )
337 {
338 Point aOldPixel = pWindow->LogicToPixel( aMDPos );
339 Point aNewPixel = rMEvt.GetPosPixel();
340 if ( std::abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE3 ||
341 std::abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE3 )
342 aDragTimer.Stop();
343 }
344
345 Point aPix(rMEvt.GetPosPixel());
346 Point aPnt(pWindow->PixelToLogic(aPix));
347
348 if ( pView->MouseMove(rMEvt, pWindow) )
349 return true; // event handled from SdrView
350
351 if ( pView->IsAction() )
352 {
353 ForceScroll(aPix);
354 pView->MovAction(aPnt);
355 }
356
357 return false;
358}
359
360bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
361{
362 // remember button state for creation of own MouseEvents
363 SetMouseButtonCode(rMEvt.GetButtons());
364
365 if (aDragTimer.IsActive() )
366 {
367 aDragTimer.Stop();
368 }
369
370 lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
371
372 Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
373
374 if ( pView->MouseButtonUp(rMEvt, pWindow) )
375 return true; // Event evaluated by SdrView
376
377 if ( pView->IsDragObj() )
378 {
379 pView->EndDragObj( rMEvt.IsShift() );
380 pView->ForceMarkedToAnotherPage();
381 }
382 else if ( pView->IsCreateObj() )
383 {
384 if (rMEvt.IsLeft())
385 {
386 pView->EndCreateObj(SdrCreateCmd::ForceEnd);
387 if (aSfxRequest.GetSlot() == SID_DRAW_TEXT_MARQUEE( 10000 + 465 ))
388 {
389 // create marquee-object?
390 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
391 if (rMarkList.GetMark(0))
392 {
393 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
394
395 // set needed attributes for scrolling
396 SfxItemSet aItemSet( pDrDoc->GetItemPool(),
397 svl::Items<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST>{});
398
399 aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
400 aItemSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
401 aItemSet.Put( SdrTextAniKindItem( SdrTextAniKind::Slide ) );
402 aItemSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
403 aItemSet.Put( SdrTextAniCountItem( 1 ) );
404 aItemSet.Put( SdrTextAniAmountItem(
405 static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) );
406 pObj->SetMergedItemSetAndBroadcast(aItemSet);
407 }
408 }
409
410 // init object different when vertical writing
411 sal_uInt16 nSlotID(aSfxRequest.GetSlot());
412 bool bVertical = (SID_DRAW_TEXT_VERTICAL( 10000 + 905 ) == nSlotID);
413 if(bVertical)
414 {
415 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
416 if(rMarkList.GetMark(0))
417 {
418 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
419 if(auto pText = dynamic_cast<SdrTextObj*>( pObj))
420 {
421 SfxItemSet aSet(pDrDoc->GetItemPool());
422
423 pText->SetVerticalWriting(true);
424
425 aSet.Put(makeSdrTextAutoGrowWidthItem(true));
426 aSet.Put(makeSdrTextAutoGrowHeightItem(false));
427 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
428 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
429
430 pText->SetMergedItemSet(aSet);
431 }
432 }
433 }
434
435 SetInEditMode();
436
437 // leave mode when sole click (-> fuconstr)
438 if ( !pView->AreObjectsMarked() )
439 {
440 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
441
442 SfxDispatcher& rDisp = rViewShell.GetViewData().GetDispatcher();
443 if ( pView->AreObjectsMarked() )
444 rDisp.Execute(SID_OBJECT_SELECT( 10000 + 128 ), SfxCallMode::SLOT | SfxCallMode::RECORD);
445 else
446 rDisp.Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
447 }
448 }
449 }
450 else if ( pView->IsAction() )
451 {
452 pView->EndAction();
453 }
454 else if( !pView->IsAction() )
455 {
456 pWindow->ReleaseMouse();
457
458 if ( !pView->AreObjectsMarked() && rMEvt.GetClicks() < 2 )
459 {
460 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
461
462 SfxDispatcher& rDisp = rViewShell.GetViewData().GetDispatcher();
463 if ( pView->AreObjectsMarked() )
464 rDisp.Execute(SID_OBJECT_SELECT( 10000 + 128 ), SfxCallMode::SLOT | SfxCallMode::RECORD);
465 else
466 rDisp.Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
467 }
468 }
469
470 return false;
471}
472
473// switch mouse-pointer
474void FuText::ForcePointer(const MouseEvent* /* pMEvt */)
475{
476 rViewShell.SetActivePointer( aNewPointer );
477}
478
479// modify keyboard events
480// if a KeyEvent is being processed, then the return value is sal_True, else FALSE.
481bool FuText::KeyInput(const KeyEvent& rKEvt)
482{
483 bool bReturn = false;
484
485 if ( pView->KeyInput(rKEvt, pWindow) )
486 {
487 bReturn = true;
488 lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
489 }
490 else
491 {
492 bReturn = FuDraw::KeyInput(rKEvt);
493 }
494
495 return bReturn;
496}
497
498void FuText::Activate()
499{
500 pView->SetDragMode(SdrDragMode::Move);
501 SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
502 rBindings.Invalidate( SID_OBJECT_ROTATETypedWhichId<SfxBoolItem>( 10000 + 129 ) );
503 rBindings.Invalidate( SID_OBJECT_MIRROR( 10000 + 1093 ) );
504
505// instant set the edit mode
506// SetInEditMode();
507
508// if (!pTextObj)
509 {
510 // no text object in EditMode, therefore set CreateMode
511
512 pView->SetCurrentObj(OBJ_TEXT);
513
514 pView->SetCreateMode();
515 }
516
517 aNewPointer = PointerStyle::Text;
518
519 aOldPointer = pWindow->GetPointer();
520 rViewShell.SetActivePointer( aNewPointer );
521
522 FuConstruct::Activate();
523}
524
525void FuText::Deactivate()
526{
527 FuConstruct::Deactivate();
528 rViewShell.SetActivePointer( aOldPointer );
529 StopEditMode();
530}
531
532// switch object to Edit-Mode
533void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
534 bool bCursorToEnd, const KeyEvent* pInitialKey)
535{
536 /* It is possible to pass a special (unselected) object in pObj, e.g. the
537 caption object of a cell note. If pObj is 0, then the selected object
538 is used. The layer will be relocked in FuText::StopEditMode(). */
539 if ( pObj && (pObj->GetLayer() == SC_LAYER_INTERN) )
540 pView->UnlockInternalLayer();
541
542 if ( !pObj && pView->AreObjectsMarked() )
543 {
544 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
545 if (rMarkList.GetMarkCount() == 1)
546 {
547 SdrMark* pMark = rMarkList.GetMark(0);
548 pObj = pMark->GetMarkedSdrObj();
549 }
550 }
551
552 if ( !pObj )
553 return;
554
555 sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
556
557 if (!(nSdrObjKind == OBJ_TEXT ||
558 nSdrObjKind == OBJ_TITLETEXT ||
559 nSdrObjKind == OBJ_OUTLINETEXT ||
560 dynamic_cast<const SdrTextObj*>( pObj) != nullptr))
561 return;
562
563 SdrPageView* pPV = pView->GetSdrPageView();
564
565 if ( !pObj->HasTextEdit() )
566 return;
567
568 std::unique_ptr<SdrOutliner> pO = MakeOutliner();
569 lcl_UpdateHyphenator( *pO, pObj );
570
571 // vertical flag:
572 // deduced from slot ids only if text object has no content
573
574 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
575 bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL( 10000 + 905 ) );
576 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
577 if ( pOPO )
578 bVertical = pOPO->IsVertical(); // content wins
579 pO->SetVertical( bVertical );
580
581 //!?? without returned Outliner the defaults are not correct ???!?
582 auto pOTemp = pO.get();
583 if ( !pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) )
584 return;
585
586 // Toggle out of paste mode if we are in it, otherwise
587 // pressing return in this object will instead go to the
588 // sheet and be considered an overwrite-cell instruction
589 rViewShell.GetViewData().SetPasteMode(ScPasteFlags::NONE);
590 rViewShell.UpdateCopySourceOverlay();
591
592 // EditEngine-UndoManager anmelden
593 rViewShell.SetDrawTextUndo( &pOTemp->GetUndoManager() );
594
595 pView->SetEditMode();
596
597 // set text cursor to click position or to end,
598 // pass initial key event to outliner view
599 if ( !(pMousePixel || bCursorToEnd || pInitialKey) )
600 return;
601
602 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
603 if (pOLV)
604 {
605 if ( pMousePixel )
606 {
607 MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT(sal_uInt16(0x0001)), 0 );
608 pOLV->MouseButtonDown(aEditEvt);
609 pOLV->MouseButtonUp(aEditEvt);
610 }
611 else if ( bCursorToEnd )
612 {
613 ESelection aNewSelection(EE_PARA_NOT_FOUND((sal_Int32) 0x7FFFFFFF), EE_INDEX_NOT_FOUND((sal_Int32) 0x7FFFFFFF), EE_PARA_NOT_FOUND((sal_Int32) 0x7FFFFFFF), EE_INDEX_NOT_FOUND((sal_Int32) 0x7FFFFFFF));
614 pOLV->SetSelection(aNewSelection);
615 }
616
617 if ( pInitialKey )
618 pOLV->PostKeyEvent( *pInitialKey );
619 }
620}
621
622// Create default drawing objects via keyboard
623SdrObjectUniquePtr FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
624{
625 // case SID_DRAW_TEXT:
626 // case SID_DRAW_TEXT_VERTICAL:
627 // case SID_DRAW_TEXT_MARQUEE:
628 // case SID_DRAW_NOTEEDIT:
629
630 SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
631 *pDrDoc,
632 pView->GetCurrentObjInventor(),
633 pView->GetCurrentObjIdentifier()));
634
635 if(pObj)
636 {
637 if(auto pText = dynamic_cast<SdrTextObj*>( pObj.get() ))
638 {
639 pText->SetLogicRect(rRectangle);
640
641 // don't set default text, start edit mode instead
642 // String aText(ScResId(STR_CAPTION_DEFAULT_TEXT));
643 // pText->SetText(aText);
644
645 bool bVertical = (SID_DRAW_TEXT_VERTICAL( 10000 + 905 ) == nID);
646 bool bMarquee = (SID_DRAW_TEXT_MARQUEE( 10000 + 465 ) == nID);
647
648 pText->SetVerticalWriting(bVertical);
649
650 if(bVertical)
651 {
652 SfxItemSet aSet(pDrDoc->GetItemPool());
653
654 aSet.Put(makeSdrTextAutoGrowWidthItem(true));
655 aSet.Put(makeSdrTextAutoGrowHeightItem(false));
656 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
657 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
658
659 pText->SetMergedItemSet(aSet);
660 }
661
662 if(bMarquee)
663 {
664 SfxItemSet aSet(pDrDoc->GetItemPool(), svl::Items<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST>{});
665
666 aSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
667 aSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
668 aSet.Put( SdrTextAniKindItem( SdrTextAniKind::Slide ) );
669 aSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
670 aSet.Put( SdrTextAniCountItem( 1 ) );
671 aSet.Put( SdrTextAniAmountItem( static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) );
672
673 pObj->SetMergedItemSetAndBroadcast(aSet);
674 }
675
676 SetInEditMode( pObj.get() ); // start edit mode
677 }
678 else
679 {
680 OSL_FAIL("Object is NO text 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/futext.cxx"
":" "680" ": "), "%s", "Object is NO text object"); } } while
(false)
;
681 }
682 }
683
684 return pObj;
685}
686
687/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

/home/maarten/src/libreoffice/core/include/vcl/event.hxx

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
32class CommandEvent;
33
34enum class TextDirectionality {
35 LeftToRight_TopToBottom,
36 RightToLeft_TopToBottom,
37 TopToBottom_RightToLeft,
38 BottomToTop_LeftToRight
39};
40
41class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) KeyEvent
42{
43private:
44 vcl::KeyCode maKeyCode;
45 sal_uInt16 mnRepeat;
46 sal_Unicode mnCharCode;
47
48public:
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
60inline KeyEvent::KeyEvent()
61{
62 mnCharCode = 0;
63 mnRepeat = 0;
64}
65
66inline 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
76enum 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};
93namespace 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
103class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) MouseEvent
104{
105private:
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
114public:
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); }
6
Assuming the condition is true
7
Returning the value 1, which participates in a condition later
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
165inline MouseEvent::MouseEvent()
166{
167 mnMode = MouseEventModifiers::NONE;
168 mnClicks = 0;
169 mnCode = 0;
170}
171
172inline 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
182enum class HelpEventMode
183{
184 NONE = 0x0000,
185 CONTEXT = 0x0001,
186 BALLOON = 0x0002,
187 QUICK = 0x0004
188};
189namespace o3tl
190{
191 template<> struct typed_flags<HelpEventMode> : is_typed_flags<HelpEventMode, 0x07> {};
192}
193
194class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) HelpEvent
195{
196private:
197 Point maPos;
198 HelpEventMode mnMode;
199 bool mbKeyboardActivated;
200
201public:
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
210inline 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.
218class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) UserDrawEvent
219{
220private:
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
231public:
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
249class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) TrackingEvent
250{
251private:
252 MouseEvent maMEvt;
253 TrackingEventFlags mnFlags;
254
255public:
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
269inline TrackingEvent::TrackingEvent( const MouseEvent& rMEvt,
270 TrackingEventFlags nTrackFlags ) :
271 maMEvt( rMEvt )
272{
273 mnFlags = nTrackFlags;
274}
275
276
277enum 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
291class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) NotifyEvent
292{
293private:
294 VclPtr<vcl::Window> mpWindow;
295 void* mpData;
296 MouseNotifyEvent mnEventType;
297
298public:
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
311inline 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
319inline 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
327inline 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
336enum class DataChangedEventType {
337 NONE = 0,
338 SETTINGS = 1,
339 DISPLAY = 2,
340 FONTS = 4,
341 PRINTER = 5,
342 FONTSUBSTITUTION = 6
343};
344
345class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) DataChangedEvent
346{
347private:
348 void* mpData;
349 AllSettingsFlags mnFlags;
350 DataChangedEventType mnType;
351
352public:
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
363inline 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
372inline 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: */