File: | home/maarten/src/libreoffice/core/sd/source/ui/view/drviews4.cxx |
Warning: | line 646, column 38 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 <com/sun/star/drawing/XDrawPagesSupplier.hpp> | ||||||||||||||
21 | |||||||||||||||
22 | #include <DrawViewShell.hxx> | ||||||||||||||
23 | #include <vcl/svapp.hxx> | ||||||||||||||
24 | #include <vcl/weld.hxx> | ||||||||||||||
25 | |||||||||||||||
26 | #include <svl/intitem.hxx> | ||||||||||||||
27 | #include <svl/stritem.hxx> | ||||||||||||||
28 | #include <svl/urlbmk.hxx> | ||||||||||||||
29 | #include <svx/svdpagv.hxx> | ||||||||||||||
30 | #include <editeng/eeitem.hxx> | ||||||||||||||
31 | #include <editeng/flditem.hxx> | ||||||||||||||
32 | #include <svx/svxids.hrc> | ||||||||||||||
33 | #include <svx/ruler.hxx> | ||||||||||||||
34 | #include <svx/globl3d.hxx> | ||||||||||||||
35 | #include <editeng/outliner.hxx> | ||||||||||||||
36 | #include <sfx2/ipclient.hxx> | ||||||||||||||
37 | #include <sfx2/dispatch.hxx> | ||||||||||||||
38 | #include <svx/svdopath.hxx> | ||||||||||||||
39 | #include <sfx2/viewfrm.hxx> | ||||||||||||||
40 | #include <editeng/editview.hxx> | ||||||||||||||
41 | #include <vcl/cursor.hxx> | ||||||||||||||
42 | #include <vcl/commandevent.hxx> | ||||||||||||||
43 | |||||||||||||||
44 | #include <app.hrc> | ||||||||||||||
45 | #include <strings.hrc> | ||||||||||||||
46 | |||||||||||||||
47 | #include <DrawDocShell.hxx> | ||||||||||||||
48 | #include <drawdoc.hxx> | ||||||||||||||
49 | #include <Window.hxx> | ||||||||||||||
50 | #include <fupoor.hxx> | ||||||||||||||
51 | #include <sdmod.hxx> | ||||||||||||||
52 | #include <Ruler.hxx> | ||||||||||||||
53 | #include <sdresid.hxx> | ||||||||||||||
54 | #include <sdpage.hxx> | ||||||||||||||
55 | #include <slideshow.hxx> | ||||||||||||||
56 | #include <sdpopup.hxx> | ||||||||||||||
57 | #include <drawview.hxx> | ||||||||||||||
58 | #include <svx/bmpmask.hxx> | ||||||||||||||
59 | #include <LayerTabBar.hxx> | ||||||||||||||
60 | |||||||||||||||
61 | #include <svx/svditer.hxx> | ||||||||||||||
62 | |||||||||||||||
63 | #include <navigatr.hxx> | ||||||||||||||
64 | #include <memory> | ||||||||||||||
65 | |||||||||||||||
66 | namespace sd { | ||||||||||||||
67 | |||||||||||||||
68 | #define PIPETTE_RANGE0 0 | ||||||||||||||
69 | |||||||||||||||
70 | using namespace ::com::sun::star::uno; | ||||||||||||||
71 | using namespace ::com::sun::star::drawing; | ||||||||||||||
72 | |||||||||||||||
73 | void DrawViewShell::DeleteActualPage() | ||||||||||||||
74 | { | ||||||||||||||
75 | mpDrawView->SdrEndTextEdit(); | ||||||||||||||
76 | |||||||||||||||
77 | try | ||||||||||||||
78 | { | ||||||||||||||
79 | Reference<XDrawPagesSupplier> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW ); | ||||||||||||||
80 | Reference<XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW ); | ||||||||||||||
81 | sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind); | ||||||||||||||
82 | SdPage* pPage = nullptr; | ||||||||||||||
83 | std::vector<Reference<XDrawPage>> pagesToDelete; | ||||||||||||||
84 | |||||||||||||||
85 | GetView()->BegUndo(SdResId(STR_UNDO_DELETEPAGESreinterpret_cast<char const *>("STR_UNDO_DELETEPAGES" "\004" u8"Delete slides"))); | ||||||||||||||
86 | |||||||||||||||
87 | for (sal_uInt16 i = 0; i < nPageCount; i++) | ||||||||||||||
88 | { | ||||||||||||||
89 | pPage = GetDoc()->GetSdPage(i, mePageKind); | ||||||||||||||
90 | if(pPage->IsSelected()) | ||||||||||||||
91 | { | ||||||||||||||
92 | Reference< XDrawPage > xPage( xPages->getByIndex( maTabControl->GetPagePos(pPage->getPageId()) ), UNO_QUERY_THROW ); | ||||||||||||||
93 | pagesToDelete.push_back(xPage); | ||||||||||||||
94 | } | ||||||||||||||
95 | } | ||||||||||||||
96 | for (auto &xPage: pagesToDelete) | ||||||||||||||
97 | { | ||||||||||||||
98 | xPages->remove(xPage); | ||||||||||||||
99 | } | ||||||||||||||
100 | |||||||||||||||
101 | GetView()->EndUndo(); | ||||||||||||||
102 | } | ||||||||||||||
103 | catch( Exception& ) | ||||||||||||||
104 | { | ||||||||||||||
105 | OSL_FAIL("SelectionManager::DeleteSelectedMasterPages(), exception caught!")do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sd/source/ui/view/drviews4.cxx" ":" "105" ": "), "%s", "SelectionManager::DeleteSelectedMasterPages(), exception caught!" ); } } while (false); | ||||||||||||||
106 | } | ||||||||||||||
107 | } | ||||||||||||||
108 | |||||||||||||||
109 | void DrawViewShell::DeleteActualLayer() | ||||||||||||||
110 | { | ||||||||||||||
111 | if(!GetLayerTabControl()) // #i87182# | ||||||||||||||
112 | { | ||||||||||||||
113 | OSL_ENSURE(false, "No LayerTabBar (!)")do { if (true && (!(false))) { sal_detail_logFormat(( SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sd/source/ui/view/drviews4.cxx" ":" "113" ": "), "%s", "No LayerTabBar (!)"); } } while (false ); | ||||||||||||||
114 | return; | ||||||||||||||
115 | } | ||||||||||||||
116 | |||||||||||||||
117 | SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin(); | ||||||||||||||
118 | sal_uInt16 nId = GetLayerTabControl()->GetCurPageId(); | ||||||||||||||
119 | const OUString& rName = GetLayerTabControl()->GetLayerName(nId); | ||||||||||||||
120 | if(LayerTabBar::IsRealNameOfStandardLayer(rName)) | ||||||||||||||
121 | { | ||||||||||||||
122 | assert(false && "Standard layer may not be deleted.")(static_cast <bool> (false && "Standard layer may not be deleted." ) ? void (0) : __assert_fail ("false && \"Standard layer may not be deleted.\"" , "/home/maarten/src/libreoffice/core/sd/source/ui/view/drviews4.cxx" , 122, __extension__ __PRETTY_FUNCTION__)); | ||||||||||||||
123 | return; | ||||||||||||||
124 | } | ||||||||||||||
125 | const OUString& rDisplayName(GetLayerTabControl()->GetPageText(nId)); | ||||||||||||||
126 | OUString aString(SdResId(STR_ASK_DELETE_LAYERreinterpret_cast<char const *>("STR_ASK_DELETE_LAYER" "\004" u8"Are you sure you want to delete the level \"$\"?\nNote: All objects on this level will be deleted!" ))); | ||||||||||||||
127 | |||||||||||||||
128 | // replace placeholder | ||||||||||||||
129 | aString = aString.replaceFirst("$", rDisplayName); | ||||||||||||||
130 | |||||||||||||||
131 | std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), | ||||||||||||||
132 | VclMessageType::Question, VclButtonsType::YesNo, | ||||||||||||||
133 | aString)); | ||||||||||||||
134 | if (xQueryBox->run() == RET_YES) | ||||||||||||||
135 | { | ||||||||||||||
136 | const SdrLayer* pLayer = rAdmin.GetLayer(rName); | ||||||||||||||
137 | mpDrawView->DeleteLayer( pLayer->GetName() ); | ||||||||||||||
138 | |||||||||||||||
139 | /* in order to redraw TabBar and Window; should be initiated later on by | ||||||||||||||
140 | a hint from Joe (as by a change if the layer order). */ | ||||||||||||||
141 | // ( View::Notify() --> ViewShell::ResetActualLayer() ) | ||||||||||||||
142 | |||||||||||||||
143 | mbIsLayerModeActive = false; // so that ChangeEditMode() does something | ||||||||||||||
144 | ChangeEditMode(GetEditMode(), true); | ||||||||||||||
145 | } | ||||||||||||||
146 | } | ||||||||||||||
147 | |||||||||||||||
148 | bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin) | ||||||||||||||
149 | { | ||||||||||||||
150 | bool bRet = false; | ||||||||||||||
151 | |||||||||||||||
152 | if ( !IsInputLocked() || ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) ) | ||||||||||||||
153 | { | ||||||||||||||
154 | if(KEY_RETURN == rKEvt.GetKeyCode().GetCode() | ||||||||||||||
155 | && rKEvt.GetKeyCode().IsMod1() | ||||||||||||||
156 | && GetView()->IsTextEdit()) | ||||||||||||||
157 | { | ||||||||||||||
158 | // this should be used for cursor travelling. | ||||||||||||||
159 | SdPage* pActualPage = GetActualPage(); | ||||||||||||||
160 | const SdrMarkList& rMarkList = GetView()->GetMarkedObjectList(); | ||||||||||||||
161 | SdrTextObj* pCandidate = nullptr; | ||||||||||||||
162 | |||||||||||||||
163 | if(pActualPage && 1 == rMarkList.GetMarkCount()) | ||||||||||||||
164 | { | ||||||||||||||
165 | SdrMark* pMark = rMarkList.GetMark(0); | ||||||||||||||
166 | |||||||||||||||
167 | // remember which object was the text in edit mode | ||||||||||||||
168 | SdrObject* pOldObj = pMark->GetMarkedSdrObj(); | ||||||||||||||
169 | |||||||||||||||
170 | // end text edit now | ||||||||||||||
171 | GetView()->SdrEndTextEdit(); | ||||||||||||||
172 | |||||||||||||||
173 | // look for a new candidate, a successor of pOldObj | ||||||||||||||
174 | SdrObjListIter aIter(pActualPage, SdrIterMode::DeepNoGroups); | ||||||||||||||
175 | bool bDidVisitOldObject(false); | ||||||||||||||
176 | |||||||||||||||
177 | while(aIter.IsMore() && !pCandidate) | ||||||||||||||
178 | { | ||||||||||||||
179 | SdrObject* pObj = aIter.Next(); | ||||||||||||||
180 | |||||||||||||||
181 | if(auto pSdrTextObj = dynamic_cast<SdrTextObj *>( pObj )) | ||||||||||||||
182 | { | ||||||||||||||
183 | SdrInventor nInv(pObj->GetObjInventor()); | ||||||||||||||
184 | sal_uInt16 nKnd(pObj->GetObjIdentifier()); | ||||||||||||||
185 | |||||||||||||||
186 | if(SdrInventor::Default == nInv && | ||||||||||||||
187 | (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd) | ||||||||||||||
188 | && bDidVisitOldObject) | ||||||||||||||
189 | { | ||||||||||||||
190 | pCandidate = pSdrTextObj; | ||||||||||||||
191 | } | ||||||||||||||
192 | |||||||||||||||
193 | if(pObj == pOldObj) | ||||||||||||||
194 | { | ||||||||||||||
195 | bDidVisitOldObject = true; | ||||||||||||||
196 | } | ||||||||||||||
197 | } | ||||||||||||||
198 | } | ||||||||||||||
199 | } | ||||||||||||||
200 | |||||||||||||||
201 | if(pCandidate) | ||||||||||||||
202 | { | ||||||||||||||
203 | // set the new candidate to text edit mode | ||||||||||||||
204 | GetView()->UnMarkAll(); | ||||||||||||||
205 | GetView()->MarkObj(pCandidate, GetView()->GetSdrPageView()); | ||||||||||||||
206 | |||||||||||||||
207 | GetViewFrame()->GetDispatcher()->Execute( | ||||||||||||||
208 | SID_ATTR_CHAR( 10000 + 6 ), SfxCallMode::ASYNCHRON); | ||||||||||||||
209 | } | ||||||||||||||
210 | else | ||||||||||||||
211 | { | ||||||||||||||
212 | // insert a new page with the same page layout | ||||||||||||||
213 | GetViewFrame()->GetDispatcher()->Execute( | ||||||||||||||
214 | SID_INSERTPAGE_QUICK(27000 +352), SfxCallMode::ASYNCHRON); | ||||||||||||||
215 | } | ||||||||||||||
216 | } | ||||||||||||||
217 | else | ||||||||||||||
218 | { | ||||||||||||||
219 | bRet = ViewShell::KeyInput(rKEvt, pWin); | ||||||||||||||
220 | //If object is marked , the corresponding entry is set true , else | ||||||||||||||
221 | //the corresponding entry is set false . | ||||||||||||||
222 | if(KEY_TAB == rKEvt.GetKeyCode().GetCode()) | ||||||||||||||
223 | { | ||||||||||||||
224 | FreshNavigatrTree(); | ||||||||||||||
225 | } | ||||||||||||||
226 | } | ||||||||||||||
227 | } | ||||||||||||||
228 | |||||||||||||||
229 | return bRet; | ||||||||||||||
230 | } | ||||||||||||||
231 | |||||||||||||||
232 | /** | ||||||||||||||
233 | * Start with Drag from ruler (helper lines, origin) | ||||||||||||||
234 | */ | ||||||||||||||
235 | void DrawViewShell::StartRulerDrag ( | ||||||||||||||
236 | const Ruler& rRuler, | ||||||||||||||
237 | const MouseEvent& rMEvt) | ||||||||||||||
238 | { | ||||||||||||||
239 | GetActiveWindow()->CaptureMouse(); | ||||||||||||||
240 | |||||||||||||||
241 | Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel()); | ||||||||||||||
242 | |||||||||||||||
243 | if ( rRuler.GetExtraRect().IsInside(rMEvt.GetPosPixel()) ) | ||||||||||||||
244 | { | ||||||||||||||
245 | mpDrawView->BegSetPageOrg(aWPos); | ||||||||||||||
246 | mbIsRulerDrag = true; | ||||||||||||||
247 | } | ||||||||||||||
248 | else | ||||||||||||||
249 | { | ||||||||||||||
250 | // #i34536# if no guide-lines are visible yet, that show them | ||||||||||||||
251 | if( ! mpDrawView->IsHlplVisible()) | ||||||||||||||
252 | mpDrawView->SetHlplVisible(); | ||||||||||||||
253 | |||||||||||||||
254 | SdrHelpLineKind eKind; | ||||||||||||||
255 | |||||||||||||||
256 | if ( rMEvt.IsMod1() ) | ||||||||||||||
257 | eKind = SdrHelpLineKind::Point; | ||||||||||||||
258 | else if ( rRuler.IsHorizontal() ) | ||||||||||||||
259 | eKind = SdrHelpLineKind::Horizontal; | ||||||||||||||
260 | else | ||||||||||||||
261 | eKind = SdrHelpLineKind::Vertical; | ||||||||||||||
262 | |||||||||||||||
263 | mpDrawView->BegDragHelpLine(aWPos, eKind); | ||||||||||||||
264 | mbIsRulerDrag = true; | ||||||||||||||
265 | } | ||||||||||||||
266 | } | ||||||||||||||
267 | |||||||||||||||
268 | void DrawViewShell::FreshNavigatrTree() | ||||||||||||||
269 | { | ||||||||||||||
270 | SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( SID_NAVIGATOR(10000 + 366) ); | ||||||||||||||
271 | if( pWindow ) | ||||||||||||||
272 | { | ||||||||||||||
273 | SdNavigatorWin* pNavWin = static_cast<SdNavigatorWin*>( pWindow->GetContextWindow( SD_MOD()( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule ::Draw)) ) ) ); | ||||||||||||||
274 | if( pNavWin ) | ||||||||||||||
275 | pNavWin->FreshTree( GetDoc() ); | ||||||||||||||
276 | } | ||||||||||||||
277 | } | ||||||||||||||
278 | |||||||||||||||
279 | void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt, | ||||||||||||||
280 | ::sd::Window* pWin) | ||||||||||||||
281 | { | ||||||||||||||
282 | mbMouseButtonDown = true; | ||||||||||||||
283 | mbMouseSelecting = false; | ||||||||||||||
284 | |||||||||||||||
285 | // We have to check if a context menu is shown and we have an UI | ||||||||||||||
286 | // active inplace client. In that case we have to ignore the mouse | ||||||||||||||
287 | // button down event. Otherwise we would crash (context menu has been | ||||||||||||||
288 | // opened by inplace client and we would deactivate the inplace client, | ||||||||||||||
289 | // the context menu is closed by VCL asynchronously which in the end | ||||||||||||||
290 | // would work on deleted objects or the context menu has no parent anymore) | ||||||||||||||
291 | SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); | ||||||||||||||
292 | bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); | ||||||||||||||
293 | |||||||||||||||
294 | if ( bIsOleActive && PopupMenu::IsInExecute() ) | ||||||||||||||
295 | return; | ||||||||||||||
296 | |||||||||||||||
297 | if ( IsInputLocked() ) | ||||||||||||||
298 | return; | ||||||||||||||
299 | |||||||||||||||
300 | ViewShell::MouseButtonDown(rMEvt, pWin); | ||||||||||||||
301 | |||||||||||||||
302 | //If object is marked , the corresponding entry is set true , | ||||||||||||||
303 | //else the corresponding entry is set false . | ||||||||||||||
304 | FreshNavigatrTree(); | ||||||||||||||
305 | if (mbPipette) | ||||||||||||||
306 | { | ||||||||||||||
307 | SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); | ||||||||||||||
308 | SvxBmpMask* pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; | ||||||||||||||
309 | if (pBmpMask) | ||||||||||||||
310 | pBmpMask->PipetteClicked(); | ||||||||||||||
311 | } | ||||||||||||||
312 | } | ||||||||||||||
313 | |||||||||||||||
314 | void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) | ||||||||||||||
315 | { | ||||||||||||||
316 | if ( IsMouseButtonDown() ) | ||||||||||||||
317 | mbMouseSelecting = true; | ||||||||||||||
318 | |||||||||||||||
319 | if ( IsInputLocked() ) | ||||||||||||||
320 | return; | ||||||||||||||
321 | |||||||||||||||
322 | if ( mpDrawView->IsAction() ) | ||||||||||||||
323 | { | ||||||||||||||
324 | ::tools::Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel()); | ||||||||||||||
325 | |||||||||||||||
326 | if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) ) | ||||||||||||||
327 | { | ||||||||||||||
328 | bool bInsideOtherWindow = false; | ||||||||||||||
329 | |||||||||||||||
330 | if (mpContentWindow) | ||||||||||||||
331 | { | ||||||||||||||
332 | aOutputArea = ::tools::Rectangle(Point(0,0), | ||||||||||||||
333 | mpContentWindow->GetOutputSizePixel()); | ||||||||||||||
334 | |||||||||||||||
335 | Point aPos = mpContentWindow->GetPointerPosPixel(); | ||||||||||||||
336 | if ( aOutputArea.IsInside(aPos) ) | ||||||||||||||
337 | bInsideOtherWindow = true; | ||||||||||||||
338 | } | ||||||||||||||
339 | |||||||||||||||
340 | if (! GetActiveWindow()->HasFocus ()) | ||||||||||||||
341 | { | ||||||||||||||
342 | GetActiveWindow()->ReleaseMouse (); | ||||||||||||||
343 | mpDrawView->BrkAction (); | ||||||||||||||
344 | return; | ||||||||||||||
345 | } | ||||||||||||||
346 | else if ( bInsideOtherWindow ) | ||||||||||||||
347 | { | ||||||||||||||
348 | GetActiveWindow()->ReleaseMouse(); | ||||||||||||||
349 | pWin->CaptureMouse (); | ||||||||||||||
350 | } | ||||||||||||||
351 | } | ||||||||||||||
352 | else if ( pWin != GetActiveWindow() ) | ||||||||||||||
353 | pWin->CaptureMouse(); | ||||||||||||||
354 | } | ||||||||||||||
355 | |||||||||||||||
356 | // Since the next MouseMove may execute a IsSolidDraggingNow() in | ||||||||||||||
357 | // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor | ||||||||||||||
358 | // is needed it is necessary to set it here. | ||||||||||||||
359 | if (GetDoc()) | ||||||||||||||
360 | { | ||||||||||||||
361 | ConfigureAppBackgroundColor(); | ||||||||||||||
362 | mpDrawView->SetApplicationBackgroundColor( mnAppBackgroundColor ); | ||||||||||||||
363 | } | ||||||||||||||
364 | |||||||||||||||
365 | ViewShell::MouseMove(rMEvt, pWin); | ||||||||||||||
366 | |||||||||||||||
367 | if( !mbMousePosFreezed ) | ||||||||||||||
368 | maMousePos = rMEvt.GetPosPixel(); | ||||||||||||||
369 | |||||||||||||||
370 | ::tools::Rectangle aRect; | ||||||||||||||
371 | |||||||||||||||
372 | if ( mbIsRulerDrag ) | ||||||||||||||
373 | { | ||||||||||||||
374 | Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos); | ||||||||||||||
375 | mpDrawView->MovAction(aLogPos); | ||||||||||||||
376 | } | ||||||||||||||
377 | |||||||||||||||
378 | if ( mpDrawView->IsAction() ) | ||||||||||||||
379 | { | ||||||||||||||
380 | mpDrawView->TakeActionRect(aRect); | ||||||||||||||
381 | aRect = GetActiveWindow()->LogicToPixel(aRect); | ||||||||||||||
382 | } | ||||||||||||||
383 | else | ||||||||||||||
384 | { | ||||||||||||||
385 | aRect = ::tools::Rectangle(maMousePos, maMousePos); | ||||||||||||||
386 | } | ||||||||||||||
387 | |||||||||||||||
388 | ShowMousePosInfo(aRect, pWin); | ||||||||||||||
389 | |||||||||||||||
390 | SvxBmpMask* pBmpMask = nullptr; | ||||||||||||||
391 | if (mbPipette && GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())) | ||||||||||||||
392 | { | ||||||||||||||
393 | SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); | ||||||||||||||
394 | pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; | ||||||||||||||
395 | } | ||||||||||||||
396 | |||||||||||||||
397 | if (!pBmpMask) | ||||||||||||||
398 | return; | ||||||||||||||
399 | |||||||||||||||
400 | const long nStartX = maMousePos.X() - PIPETTE_RANGE0; | ||||||||||||||
401 | const long nEndX = maMousePos.X() + PIPETTE_RANGE0; | ||||||||||||||
402 | const long nStartY = maMousePos.Y() - PIPETTE_RANGE0; | ||||||||||||||
403 | const long nEndY = maMousePos.Y() + PIPETTE_RANGE0; | ||||||||||||||
404 | long nRed = 0; | ||||||||||||||
405 | long nGreen = 0; | ||||||||||||||
406 | long nBlue = 0; | ||||||||||||||
407 | const double fDiv = ( ( PIPETTE_RANGE0 << 1 ) + 1 ) * ( ( PIPETTE_RANGE0 << 1 ) + 1 ); | ||||||||||||||
408 | |||||||||||||||
409 | for ( long nY = nStartY; nY <= nEndY; nY++ ) | ||||||||||||||
410 | { | ||||||||||||||
411 | for( long nX = nStartX; nX <= nEndX; nX++ ) | ||||||||||||||
412 | { | ||||||||||||||
413 | const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) ); | ||||||||||||||
414 | |||||||||||||||
415 | nRed += aCol.GetRed(); | ||||||||||||||
416 | nGreen += aCol.GetGreen(); | ||||||||||||||
417 | nBlue += aCol.GetBlue(); | ||||||||||||||
418 | } | ||||||||||||||
419 | } | ||||||||||||||
420 | |||||||||||||||
421 | pBmpMask->SetColor( Color( static_cast<sal_uInt8>( nRed / fDiv + .5 ), | ||||||||||||||
422 | static_cast<sal_uInt8>( nGreen / fDiv + .5 ), | ||||||||||||||
423 | static_cast<sal_uInt8>( nBlue / fDiv + .5 ) ) ); | ||||||||||||||
424 | } | ||||||||||||||
425 | |||||||||||||||
426 | void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) | ||||||||||||||
427 | { | ||||||||||||||
428 | mbMouseButtonDown = false; | ||||||||||||||
429 | |||||||||||||||
430 | if ( !IsInputLocked() ) | ||||||||||||||
431 | { | ||||||||||||||
432 | bool bIsSetPageOrg = mpDrawView->IsSetPageOrg(); | ||||||||||||||
433 | |||||||||||||||
434 | if (mbIsRulerDrag) | ||||||||||||||
435 | { | ||||||||||||||
436 | ::tools::Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel()); | ||||||||||||||
437 | |||||||||||||||
438 | if (aOutputArea.IsInside(rMEvt.GetPosPixel())) | ||||||||||||||
439 | { | ||||||||||||||
440 | mpDrawView->EndAction(); | ||||||||||||||
441 | |||||||||||||||
442 | if (bIsSetPageOrg) | ||||||||||||||
443 | GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSETTypedWhichId<SfxPointItem>( 10000 + 79 )); | ||||||||||||||
444 | } | ||||||||||||||
445 | else if (rMEvt.IsLeft() && bIsSetPageOrg) | ||||||||||||||
446 | { | ||||||||||||||
447 | mpDrawView->BrkAction(); | ||||||||||||||
448 | SdPage* pPage = static_cast<SdPage*>( mpDrawView->GetSdrPageView()->GetPage() ); | ||||||||||||||
449 | Point aOrg(pPage->GetLeftBorder(), pPage->GetUpperBorder()); | ||||||||||||||
450 | mpDrawView->GetSdrPageView()->SetPageOrigin(aOrg); | ||||||||||||||
451 | GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSETTypedWhichId<SfxPointItem>( 10000 + 79 )); | ||||||||||||||
452 | } | ||||||||||||||
453 | else | ||||||||||||||
454 | { | ||||||||||||||
455 | mpDrawView->BrkAction(); | ||||||||||||||
456 | } | ||||||||||||||
457 | |||||||||||||||
458 | GetActiveWindow()->ReleaseMouse(); | ||||||||||||||
459 | mbIsRulerDrag = false; | ||||||||||||||
460 | } | ||||||||||||||
461 | else | ||||||||||||||
462 | ViewShell::MouseButtonUp(rMEvt, pWin); | ||||||||||||||
463 | //If object is marked , the corresponding entry is set true , | ||||||||||||||
464 | //else the corresponding entry is set false . | ||||||||||||||
465 | FreshNavigatrTree(); | ||||||||||||||
466 | } | ||||||||||||||
467 | mbMouseSelecting = false; | ||||||||||||||
468 | } | ||||||||||||||
469 | |||||||||||||||
470 | void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) | ||||||||||||||
471 | { | ||||||||||||||
472 | // The command event is send to the window after a possible context | ||||||||||||||
473 | // menu from an inplace client is closed. Now we have the chance to | ||||||||||||||
474 | // deactivate the inplace client without any problem regarding parent | ||||||||||||||
475 | // windows and code on the stack. | ||||||||||||||
476 | SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); | ||||||||||||||
477 | bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); | ||||||||||||||
| |||||||||||||||
478 | if ( bIsOleActive
| ||||||||||||||
479 | { | ||||||||||||||
480 | // Deactivate OLE object | ||||||||||||||
481 | mpDrawView->UnmarkAll(); | ||||||||||||||
482 | SelectionHasChanged(); | ||||||||||||||
483 | return; | ||||||||||||||
484 | } | ||||||||||||||
485 | |||||||||||||||
486 | if ( IsInputLocked() ) | ||||||||||||||
487 | return; | ||||||||||||||
488 | |||||||||||||||
489 | if( GetView() &&GetView()->getSmartTags().Command(rCEvt) ) | ||||||||||||||
490 | return; | ||||||||||||||
491 | |||||||||||||||
492 | const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase())); | ||||||||||||||
493 | |||||||||||||||
494 | if( rCEvt.GetCommand() == CommandEventId::PasteSelection && !bNativeShow ) | ||||||||||||||
495 | { | ||||||||||||||
496 | TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) ); | ||||||||||||||
497 | |||||||||||||||
498 | if( aDataHelper.GetTransferable().is() ) | ||||||||||||||
499 | { | ||||||||||||||
500 | Point aPos; | ||||||||||||||
501 | sal_Int8 nDnDAction = DND_ACTION_COPYcss::datatransfer::dnd::DNDConstants::ACTION_COPY; | ||||||||||||||
502 | |||||||||||||||
503 | if( GetActiveWindow() ) | ||||||||||||||
504 | aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ); | ||||||||||||||
505 | |||||||||||||||
506 | if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, false ) ) | ||||||||||||||
507 | { | ||||||||||||||
508 | INetBookmark aINetBookmark( "", "" ); | ||||||||||||||
509 | |||||||||||||||
510 | if( ( aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) && | ||||||||||||||
511 | aDataHelper.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) || | ||||||||||||||
512 | ( aDataHelper.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) && | ||||||||||||||
513 | aDataHelper.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) || | ||||||||||||||
514 | ( aDataHelper.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) && | ||||||||||||||
515 | aDataHelper.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) | ||||||||||||||
516 | { | ||||||||||||||
517 | InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), "" ); | ||||||||||||||
518 | } | ||||||||||||||
519 | } | ||||||||||||||
520 | } | ||||||||||||||
521 | } | ||||||||||||||
522 | else if( rCEvt.GetCommand() == CommandEventId::ContextMenu && !bNativeShow && | ||||||||||||||
523 | pWin != nullptr && !mpDrawView->IsAction() && !SD_MOD()( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule ::Draw)) )->GetWaterCan() ) | ||||||||||||||
524 | { | ||||||||||||||
525 | OUString aPopupId; // Resource name for popup menu | ||||||||||||||
526 | |||||||||||||||
527 | // is there a snap object under the cursor? | ||||||||||||||
528 | SdrPageView* pPV; | ||||||||||||||
529 | Point aMPos = pWin->PixelToLogic( maMousePos ); | ||||||||||||||
530 | sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( | ||||||||||||||
531 | Size(FuPoor::HITPIX, 0 ) ).Width()); | ||||||||||||||
532 | sal_uInt16 nHelpLine; | ||||||||||||||
533 | // for glue points | ||||||||||||||
534 | SdrObject* pObj = nullptr; | ||||||||||||||
535 | sal_uInt16 nPickId = 0; | ||||||||||||||
536 | // for field command | ||||||||||||||
537 | OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); | ||||||||||||||
538 | const SvxFieldItem* pFldItem = nullptr; | ||||||||||||||
539 | if( pOLV ) | ||||||||||||||
540 | pFldItem = pOLV->GetFieldAtSelection(); | ||||||||||||||
541 | |||||||||||||||
542 | // helper line | ||||||||||||||
543 | if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) | ||||||||||||||
544 | { | ||||||||||||||
545 | ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel()); | ||||||||||||||
546 | return; | ||||||||||||||
547 | } | ||||||||||||||
548 | // is glue point under cursor marked? | ||||||||||||||
549 | else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) && | ||||||||||||||
550 | mpDrawView->IsGluePointMarked( pObj, nPickId ) ) | ||||||||||||||
551 | { | ||||||||||||||
552 | aPopupId = "gluepoint"; | ||||||||||||||
553 | } | ||||||||||||||
554 | // field command? | ||||||||||||||
555 | else if( pFldItem && (nullptr != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || | ||||||||||||||
556 | nullptr != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) || | ||||||||||||||
557 | nullptr != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || | ||||||||||||||
558 | nullptr != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) ) ) | ||||||||||||||
559 | { | ||||||||||||||
560 | LanguageType eLanguage( LANGUAGE_SYSTEMLanguageType(0x0000) ); | ||||||||||||||
561 | |||||||||||||||
562 | // Format popup with outliner language, if possible | ||||||||||||||
563 | if( pOLV->GetOutliner() ) | ||||||||||||||
564 | { | ||||||||||||||
565 | ESelection aSelection( pOLV->GetSelection() ); | ||||||||||||||
566 | eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos ); | ||||||||||||||
567 | } | ||||||||||||||
568 | |||||||||||||||
569 | //fdo#44998 if the outliner has captured the mouse events release the lock | ||||||||||||||
570 | //so the SdFieldPopup can get them | ||||||||||||||
571 | pOLV->ReleaseMouse(); | ||||||||||||||
572 | ScopedVclPtrInstance<SdFieldPopup> aFieldPopup( pFldItem->GetField(), eLanguage ); | ||||||||||||||
573 | |||||||||||||||
574 | if ( rCEvt.IsMouseEvent() ) | ||||||||||||||
575 | aMPos = rCEvt.GetMousePosPixel(); | ||||||||||||||
576 | else | ||||||||||||||
577 | aMPos = Point( 20, 20 ); | ||||||||||||||
578 | aFieldPopup->Execute( pWin, aMPos ); | ||||||||||||||
579 | |||||||||||||||
580 | std::unique_ptr<SvxFieldData> pField(aFieldPopup->GetField()); | ||||||||||||||
581 | if( pField ) | ||||||||||||||
582 | { | ||||||||||||||
583 | SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); | ||||||||||||||
584 | // select field, so that it will be deleted on insert | ||||||||||||||
585 | ESelection aSel = pOLV->GetSelection(); | ||||||||||||||
586 | bool bSel = true; | ||||||||||||||
587 | if( aSel.nStartPos == aSel.nEndPos ) | ||||||||||||||
588 | { | ||||||||||||||
589 | bSel = false; | ||||||||||||||
590 | aSel.nEndPos++; | ||||||||||||||
591 | } | ||||||||||||||
592 | pOLV->SetSelection( aSel ); | ||||||||||||||
593 | |||||||||||||||
594 | pOLV->InsertField( aFieldItem ); | ||||||||||||||
595 | |||||||||||||||
596 | // reset selection back to original state | ||||||||||||||
597 | if( !bSel ) | ||||||||||||||
598 | aSel.nEndPos--; | ||||||||||||||
599 | pOLV->SetSelection( aSel ); | ||||||||||||||
600 | } | ||||||||||||||
601 | } | ||||||||||||||
602 | else | ||||||||||||||
603 | { | ||||||||||||||
604 | // is something selected? | ||||||||||||||
605 | if (mpDrawView->AreObjectsMarked() && | ||||||||||||||
606 | mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) | ||||||||||||||
607 | { | ||||||||||||||
608 | pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); | ||||||||||||||
609 | if( HasCurrentFunction(SID_BEZIER_EDIT( 10000 + 126 )) && (dynamic_cast< SdrPathObj * >( pObj ) != nullptr ) ) | ||||||||||||||
610 | { | ||||||||||||||
611 | aPopupId = "bezier"; | ||||||||||||||
612 | } | ||||||||||||||
613 | else | ||||||||||||||
614 | { | ||||||||||||||
615 | if( mpDrawView->GetTextEditObject() ) | ||||||||||||||
616 | { | ||||||||||||||
617 | OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView(); | ||||||||||||||
618 | Point aPos(rCEvt.GetMousePosPixel()); | ||||||||||||||
619 | |||||||||||||||
620 | if ( pOutlinerView
| ||||||||||||||
621 | { | ||||||||||||||
622 | if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) || | ||||||||||||||
623 | ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) ) | ||||||||||||||
624 | { | ||||||||||||||
625 | // Popup for Online-Spelling now handled by DrawDocShell | ||||||||||||||
626 | Link<SpellCallbackInfo&,void> aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback)::tools::detail::makeLink( ::tools::detail::castTo<DrawDocShell *>(GetDocSh()), &DrawDocShell::LinkStubOnlineSpellCallback ); | ||||||||||||||
627 | |||||||||||||||
628 | if( !rCEvt.IsMouseEvent() ) | ||||||||||||||
629 | { | ||||||||||||||
630 | aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() ); | ||||||||||||||
631 | } | ||||||||||||||
632 | // While showing the spell context menu | ||||||||||||||
633 | // we lock the input so that another | ||||||||||||||
634 | // context menu can not be opened during | ||||||||||||||
635 | // that time (crash #i43235#). In order | ||||||||||||||
636 | // to not lock the UI completely we | ||||||||||||||
637 | // first release the mouse. | ||||||||||||||
638 | GetActiveWindow()->ReleaseMouse(); | ||||||||||||||
639 | LockInput(); | ||||||||||||||
640 | pOutlinerView->ExecuteSpellPopup(aPos, &aLink); | ||||||||||||||
641 | pOutlinerView->GetEditView().Invalidate(); | ||||||||||||||
642 | UnlockInput(); | ||||||||||||||
643 | } | ||||||||||||||
644 | else | ||||||||||||||
645 | { | ||||||||||||||
646 | if( (pObj->GetObjInventor() == SdrInventor::Default) && (pObj->GetObjIdentifier() == OBJ_TABLE) ) | ||||||||||||||
| |||||||||||||||
647 | { | ||||||||||||||
648 | aPopupId = "table"; | ||||||||||||||
649 | } | ||||||||||||||
650 | else | ||||||||||||||
651 | { | ||||||||||||||
652 | aPopupId = "drawtext"; | ||||||||||||||
653 | } | ||||||||||||||
654 | } | ||||||||||||||
655 | } | ||||||||||||||
656 | } | ||||||||||||||
657 | else | ||||||||||||||
658 | { | ||||||||||||||
659 | SdrInventor nInv = pObj->GetObjInventor(); | ||||||||||||||
660 | sal_uInt16 nId = pObj->GetObjIdentifier(); | ||||||||||||||
661 | |||||||||||||||
662 | if (nInv == SdrInventor::Default) | ||||||||||||||
663 | { | ||||||||||||||
664 | switch ( nId ) | ||||||||||||||
665 | { | ||||||||||||||
666 | case OBJ_OUTLINETEXT: | ||||||||||||||
667 | case OBJ_CAPTION: | ||||||||||||||
668 | case OBJ_TITLETEXT: | ||||||||||||||
669 | case OBJ_TEXT: | ||||||||||||||
670 | aPopupId = "textbox"; | ||||||||||||||
671 | break; | ||||||||||||||
672 | |||||||||||||||
673 | case OBJ_PATHLINE: | ||||||||||||||
674 | case OBJ_PLIN: | ||||||||||||||
675 | aPopupId = "curve"; | ||||||||||||||
676 | break; | ||||||||||||||
677 | |||||||||||||||
678 | case OBJ_FREELINE: | ||||||||||||||
679 | case OBJ_EDGE: | ||||||||||||||
680 | aPopupId = "connector"; | ||||||||||||||
681 | break; | ||||||||||||||
682 | |||||||||||||||
683 | case OBJ_LINE: | ||||||||||||||
684 | aPopupId = "line"; | ||||||||||||||
685 | break; | ||||||||||||||
686 | |||||||||||||||
687 | case OBJ_MEASURE: | ||||||||||||||
688 | aPopupId = "measure"; | ||||||||||||||
689 | break; | ||||||||||||||
690 | |||||||||||||||
691 | case OBJ_RECT: | ||||||||||||||
692 | case OBJ_CIRC: | ||||||||||||||
693 | case OBJ_FREEFILL: | ||||||||||||||
694 | case OBJ_PATHFILL: | ||||||||||||||
695 | case OBJ_POLY: | ||||||||||||||
696 | case OBJ_SECT: | ||||||||||||||
697 | case OBJ_CARC: | ||||||||||||||
698 | case OBJ_CCUT: | ||||||||||||||
699 | case OBJ_CUSTOMSHAPE: | ||||||||||||||
700 | aPopupId = "draw"; | ||||||||||||||
701 | break; | ||||||||||||||
702 | |||||||||||||||
703 | case OBJ_GRUP: | ||||||||||||||
704 | aPopupId = "group"; | ||||||||||||||
705 | break; | ||||||||||||||
706 | |||||||||||||||
707 | case OBJ_GRAF: | ||||||||||||||
708 | aPopupId = "graphic"; | ||||||||||||||
709 | break; | ||||||||||||||
710 | |||||||||||||||
711 | case OBJ_OLE2: | ||||||||||||||
712 | aPopupId = "oleobject"; | ||||||||||||||
713 | break; | ||||||||||||||
714 | case OBJ_MEDIA: | ||||||||||||||
715 | aPopupId = "media"; | ||||||||||||||
716 | break; | ||||||||||||||
717 | case OBJ_TABLE: | ||||||||||||||
718 | aPopupId = "table"; | ||||||||||||||
719 | break; | ||||||||||||||
720 | } | ||||||||||||||
721 | } | ||||||||||||||
722 | else if( nInv == SdrInventor::E3d ) | ||||||||||||||
723 | { | ||||||||||||||
724 | if( nId == E3D_SCENE_ID ) | ||||||||||||||
725 | { | ||||||||||||||
726 | if( !mpDrawView->IsGroupEntered() ) | ||||||||||||||
727 | aPopupId = "3dscene"; | ||||||||||||||
728 | else | ||||||||||||||
729 | aPopupId = "3dscene2"; | ||||||||||||||
730 | } | ||||||||||||||
731 | else | ||||||||||||||
732 | aPopupId = "3dobject"; | ||||||||||||||
733 | } | ||||||||||||||
734 | else if( nInv == SdrInventor::FmForm ) | ||||||||||||||
735 | { | ||||||||||||||
736 | aPopupId = "form"; | ||||||||||||||
737 | } | ||||||||||||||
738 | } | ||||||||||||||
739 | } | ||||||||||||||
740 | } | ||||||||||||||
741 | |||||||||||||||
742 | // multiple selection | ||||||||||||||
743 | else if (mpDrawView->AreObjectsMarked() && | ||||||||||||||
744 | mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 ) | ||||||||||||||
745 | { | ||||||||||||||
746 | aPopupId = "multiselect"; | ||||||||||||||
747 | } | ||||||||||||||
748 | |||||||||||||||
749 | // nothing selected | ||||||||||||||
750 | else | ||||||||||||||
751 | { | ||||||||||||||
752 | aPopupId = "page"; | ||||||||||||||
753 | } | ||||||||||||||
754 | } | ||||||||||||||
755 | // show Popup-Menu | ||||||||||||||
756 | if (!aPopupId.isEmpty()) | ||||||||||||||
757 | { | ||||||||||||||
758 | GetActiveWindow()->ReleaseMouse(); | ||||||||||||||
759 | |||||||||||||||
760 | if(rCEvt.IsMouseEvent()) | ||||||||||||||
761 | GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId ); | ||||||||||||||
762 | else | ||||||||||||||
763 | { | ||||||||||||||
764 | //don't open contextmenu at mouse position if not opened via mouse | ||||||||||||||
765 | |||||||||||||||
766 | //middle of the window if nothing is marked | ||||||||||||||
767 | Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2 | ||||||||||||||
768 | ,GetActiveWindow()->GetSizePixel().Height()/2); | ||||||||||||||
769 | |||||||||||||||
770 | //middle of the bounding rect if something is marked | ||||||||||||||
771 | if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 ) | ||||||||||||||
772 | { | ||||||||||||||
773 | ::tools::Rectangle aMarkRect; | ||||||||||||||
774 | mpDrawView->GetMarkedObjectList().TakeBoundRect(nullptr,aMarkRect); | ||||||||||||||
775 | aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() ); | ||||||||||||||
776 | |||||||||||||||
777 | //move the point into the visible window area | ||||||||||||||
778 | if( aMenuPos.X() < 0 ) | ||||||||||||||
779 | aMenuPos.setX( 0 ); | ||||||||||||||
780 | if( aMenuPos.Y() < 0 ) | ||||||||||||||
781 | aMenuPos.setY( 0 ); | ||||||||||||||
782 | if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() ) | ||||||||||||||
783 | aMenuPos.setX( GetActiveWindow()->GetSizePixel().Width() ); | ||||||||||||||
784 | if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() ) | ||||||||||||||
785 | aMenuPos.setY( GetActiveWindow()->GetSizePixel().Height() ); | ||||||||||||||
786 | } | ||||||||||||||
787 | |||||||||||||||
788 | //open context menu at that point | ||||||||||||||
789 | GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId, GetActiveWindow(), &aMenuPos ); | ||||||||||||||
790 | } | ||||||||||||||
791 | mbMousePosFreezed = false; | ||||||||||||||
792 | } | ||||||||||||||
793 | } | ||||||||||||||
794 | else | ||||||||||||||
795 | { | ||||||||||||||
796 | ViewShell::Command(rCEvt, pWin); | ||||||||||||||
797 | } | ||||||||||||||
798 | } | ||||||||||||||
799 | |||||||||||||||
800 | void DrawViewShell::ShowMousePosInfo(const ::tools::Rectangle& rRect, | ||||||||||||||
801 | ::sd::Window const * pWin) | ||||||||||||||
802 | { | ||||||||||||||
803 | if (mbHasRulers && pWin ) | ||||||||||||||
804 | { | ||||||||||||||
805 | RulerLine pHLines[2]; | ||||||||||||||
806 | RulerLine pVLines[2]; | ||||||||||||||
807 | long nHOffs = 0; | ||||||||||||||
808 | long nVOffs = 0; | ||||||||||||||
809 | sal_uInt16 nCnt; | ||||||||||||||
810 | |||||||||||||||
811 | if (mpHorizontalRuler) | ||||||||||||||
812 | mpHorizontalRuler->SetLines(); | ||||||||||||||
813 | |||||||||||||||
814 | if (mpVerticalRuler) | ||||||||||||||
815 | mpVerticalRuler->SetLines(); | ||||||||||||||
816 | |||||||||||||||
817 | if (mpHorizontalRuler) | ||||||||||||||
818 | { | ||||||||||||||
819 | nHOffs = mpHorizontalRuler->GetNullOffset() + | ||||||||||||||
820 | mpHorizontalRuler->GetPageOffset(); | ||||||||||||||
821 | } | ||||||||||||||
822 | |||||||||||||||
823 | if (mpVerticalRuler) | ||||||||||||||
824 | { | ||||||||||||||
825 | nVOffs = mpVerticalRuler->GetNullOffset() + | ||||||||||||||
826 | mpVerticalRuler->GetPageOffset(); | ||||||||||||||
827 | } | ||||||||||||||
828 | |||||||||||||||
829 | nCnt = 1; | ||||||||||||||
830 | pHLines[0].nPos = rRect.Left() - nHOffs; | ||||||||||||||
831 | pVLines[0].nPos = rRect.Top() - nVOffs; | ||||||||||||||
832 | |||||||||||||||
833 | if ( rRect.Right() != rRect.Left() || rRect.Bottom() != rRect.Top() ) | ||||||||||||||
834 | { | ||||||||||||||
835 | pHLines[1].nPos = rRect.Right() - nHOffs; | ||||||||||||||
836 | pVLines[1].nPos = rRect.Bottom() - nVOffs; | ||||||||||||||
837 | nCnt++; | ||||||||||||||
838 | } | ||||||||||||||
839 | |||||||||||||||
840 | if (mpHorizontalRuler) | ||||||||||||||
841 | mpHorizontalRuler->SetLines(nCnt, pHLines); | ||||||||||||||
842 | if (mpVerticalRuler) | ||||||||||||||
843 | mpVerticalRuler->SetLines(nCnt, pVLines); | ||||||||||||||
844 | } | ||||||||||||||
845 | |||||||||||||||
846 | // display with coordinates in StatusBar | ||||||||||||||
847 | 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/drviews4.cxx" ":" "847" ": "), "OSL_ASSERT: %s", "GetViewShell()!=nullptr" ); } } while (false); | ||||||||||||||
848 | if ( GetViewShell()->GetUIActiveClient() ) | ||||||||||||||
849 | return; | ||||||||||||||
850 | |||||||||||||||
851 | SfxItemSet aSet( | ||||||||||||||
852 | GetPool(), | ||||||||||||||
853 | svl::Items< | ||||||||||||||
854 | SID_CONTEXT(5000 + 310), SID_CONTEXT(5000 + 310), | ||||||||||||||
855 | SID_ATTR_POSITIONTypedWhichId<SfxPointItem>( 10000 + 223 ), SID_ATTR_SIZETypedWhichId<SvxSizeItem>( 10000 + 224 )>{}); | ||||||||||||||
856 | |||||||||||||||
857 | GetStatusBarState(aSet); | ||||||||||||||
858 | |||||||||||||||
859 | aSet.Put( SfxStringItem( SID_CONTEXT(5000 + 310), mpDrawView->GetStatusText() ) ); | ||||||||||||||
860 | |||||||||||||||
861 | SfxBindings& rBindings = GetViewFrame()->GetBindings(); | ||||||||||||||
862 | rBindings.SetState(aSet); | ||||||||||||||
863 | rBindings.Invalidate(SID_CONTEXT(5000 + 310)); | ||||||||||||||
864 | rBindings.Invalidate(SID_ATTR_POSITIONTypedWhichId<SfxPointItem>( 10000 + 223 )); | ||||||||||||||
865 | rBindings.Invalidate(SID_ATTR_SIZETypedWhichId<SvxSizeItem>( 10000 + 224 )); | ||||||||||||||
866 | } | ||||||||||||||
867 | |||||||||||||||
868 | void DrawViewShell::LockInput() | ||||||||||||||
869 | { | ||||||||||||||
870 | mnLockCount++; | ||||||||||||||
871 | } | ||||||||||||||
872 | |||||||||||||||
873 | void DrawViewShell::UnlockInput() | ||||||||||||||
874 | { | ||||||||||||||
875 | DBG_ASSERT( mnLockCount, "Input for this shell is not locked!" )do { if (true && (!(mnLockCount))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.tools"), ("/home/maarten/src/libreoffice/core/sd/source/ui/view/drviews4.cxx" ":" "875" ": "), "%s", "Input for this shell is not locked!" ); } } while (false); | ||||||||||||||
876 | if ( mnLockCount ) | ||||||||||||||
877 | mnLockCount--; | ||||||||||||||
878 | } | ||||||||||||||
879 | |||||||||||||||
880 | void DrawViewShell::ShowSnapLineContextMenu ( | ||||||||||||||
881 | SdrPageView& rPageView, | ||||||||||||||
882 | const sal_uInt16 nSnapLineIndex, | ||||||||||||||
883 | const Point& rMouseLocation) | ||||||||||||||
884 | { | ||||||||||||||
885 | const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]); | ||||||||||||||
886 | ScopedVclPtrInstance<PopupMenu> pMenu; | ||||||||||||||
887 | |||||||||||||||
888 | if (rHelpLine.GetKind() == SdrHelpLineKind::Point) | ||||||||||||||
889 | { | ||||||||||||||
890 | pMenu->InsertItem( | ||||||||||||||
891 | SID_SET_SNAPITEM(27000 +77), | ||||||||||||||
892 | SdResId(STR_POPUP_EDIT_SNAPPOINTreinterpret_cast<char const *>("STR_POPUP_EDIT_SNAPPOINT" "\004" u8"Edit Snap Point..."))); | ||||||||||||||
893 | pMenu->InsertSeparator(); | ||||||||||||||
894 | pMenu->InsertItem( | ||||||||||||||
895 | SID_DELETE_SNAPITEM(27000 +108), | ||||||||||||||
896 | SdResId(STR_POPUP_DELETE_SNAPPOINTreinterpret_cast<char const *>("STR_POPUP_DELETE_SNAPPOINT" "\004" u8"Delete Snap Point"))); | ||||||||||||||
897 | } | ||||||||||||||
898 | else | ||||||||||||||
899 | { | ||||||||||||||
900 | pMenu->InsertItem( | ||||||||||||||
901 | SID_SET_SNAPITEM(27000 +77), | ||||||||||||||
902 | SdResId(STR_POPUP_EDIT_SNAPLINEreinterpret_cast<char const *>("STR_POPUP_EDIT_SNAPLINE" "\004" u8"Edit Snap Line..."))); | ||||||||||||||
903 | pMenu->InsertSeparator(); | ||||||||||||||
904 | pMenu->InsertItem( | ||||||||||||||
905 | SID_DELETE_SNAPITEM(27000 +108), | ||||||||||||||
906 | SdResId(STR_POPUP_DELETE_SNAPLINEreinterpret_cast<char const *>("STR_POPUP_DELETE_SNAPLINE" "\004" u8"Delete Snap Line"))); | ||||||||||||||
907 | } | ||||||||||||||
908 | |||||||||||||||
909 | pMenu->RemoveDisabledEntries(false); | ||||||||||||||
910 | |||||||||||||||
911 | const sal_uInt16 nResult = pMenu->Execute( | ||||||||||||||
912 | GetActiveWindow(), | ||||||||||||||
913 | ::tools::Rectangle(rMouseLocation, Size(10,10)), | ||||||||||||||
914 | PopupMenuFlags::ExecuteDown); | ||||||||||||||
915 | switch (nResult) | ||||||||||||||
916 | { | ||||||||||||||
917 | case SID_SET_SNAPITEM(27000 +77): | ||||||||||||||
918 | { | ||||||||||||||
919 | SfxUInt32Item aHelpLineItem (ID_VAL_INDEX(27000 +246), nSnapLineIndex); | ||||||||||||||
920 | const SfxPoolItem* aArguments[] = {&aHelpLineItem, nullptr}; | ||||||||||||||
921 | GetViewFrame()->GetDispatcher()->Execute( | ||||||||||||||
922 | SID_SET_SNAPITEM(27000 +77), | ||||||||||||||
923 | SfxCallMode::SLOT, | ||||||||||||||
924 | aArguments); | ||||||||||||||
925 | } | ||||||||||||||
926 | break; | ||||||||||||||
927 | |||||||||||||||
928 | case SID_DELETE_SNAPITEM(27000 +108): | ||||||||||||||
929 | { | ||||||||||||||
930 | rPageView.DeleteHelpLine(nSnapLineIndex); | ||||||||||||||
931 | } | ||||||||||||||
932 | break; | ||||||||||||||
933 | |||||||||||||||
934 | default: | ||||||||||||||
935 | break; | ||||||||||||||
936 | } | ||||||||||||||
937 | } | ||||||||||||||
938 | |||||||||||||||
939 | } // end of namespace sd | ||||||||||||||
940 | |||||||||||||||
941 | /* 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_SD_SOURCE_UI_INC_DRAWVIEWSHELL_HXX |
21 | #define INCLUDED_SD_SOURCE_UI_INC_DRAWVIEWSHELL_HXX |
22 | |
23 | #include <memory> |
24 | #include "ViewShell.hxx" |
25 | #include "tools/AsynchronousCall.hxx" |
26 | #include "TabControl.hxx" |
27 | #include <glob.hxx> |
28 | #include <pres.hxx> |
29 | #include <unotools/caserotate.hxx> |
30 | #include <unotools/options.hxx> |
31 | #include <sddllapi.h> |
32 | |
33 | namespace svx::sidebar { class SelectionChangeHandler; } |
34 | namespace com::sun::star::lang { class XEventListener; } |
35 | namespace com::sun::star::scanner { class XScannerManager2; } |
36 | |
37 | class Outliner; |
38 | class SdPage; |
39 | class SdStyleSheet; |
40 | class SdrExternalToolEdit; |
41 | class TabBar; |
42 | class SdrObject; |
43 | class SdrPageView; |
44 | class TransferableDataHelper; |
45 | class TransferableClipboardListener; |
46 | class AbstractSvxNameDialog; |
47 | class SdrLayer; |
48 | class SvxClipboardFormatItem; |
49 | struct ESelection; |
50 | class AbstractSvxObjectNameDialog; |
51 | |
52 | namespace sd { |
53 | |
54 | class DrawView; |
55 | class LayerTabBar; |
56 | class Ruler; |
57 | class AnnotationManager; |
58 | class ViewOverlayManager; |
59 | |
60 | #define CHECK_RANGE(nMin, nValue, nMax)((nValue >= nMin) && (nValue <= nMax)) ((nValue >= nMin) && (nValue <= nMax)) |
61 | |
62 | /** Base class of the stacked shells that provide graphical views to |
63 | Draw and Impress documents and editing functionality. In contrast |
64 | to this other stacked shells are responsible for showing an |
65 | overview over several slides or a textual |
66 | overview over the text in an Impress document (OutlineViewShell). |
67 | */ |
68 | class SAL_DLLPUBLIC_RTTI__attribute__ ((type_visibility("default"))) DrawViewShell |
69 | : public ViewShell, |
70 | public SfxListener, |
71 | public utl::ConfigurationListener |
72 | { |
73 | public: |
74 | SFX_DECL_INTERFACE(SD_IF_SDDRAWVIEWSHELL)static SfxInterface* pInterface; static SfxInterface* GetStaticInterface (); static SfxInterfaceId GetInterfaceId() {return SFX_INTERFACE_SD_START + SfxInterfaceId(3);} static void RegisterInterface(const SfxModule * pMod=nullptr); virtual SfxInterface* GetInterface() const override ; |
75 | |
76 | private: |
77 | /// SfxInterface initializer. |
78 | static void InitInterface_Impl(); |
79 | |
80 | public: |
81 | /** Create a new stackable shell that may take some information |
82 | (e.g. the frame view) from the given previous shell. |
83 | @param ePageKind |
84 | This parameter gives the initial page kind that the new shell |
85 | will show. |
86 | @param pFrameView |
87 | The frame view that makes it possible to pass information from |
88 | one view shell to the next. |
89 | */ |
90 | DrawViewShell ( |
91 | ViewShellBase& rViewShellBase, |
92 | vcl::Window* pParentWindow, |
93 | PageKind ePageKind, |
94 | FrameView* pFrameView); |
95 | |
96 | virtual ~DrawViewShell() override; |
97 | |
98 | virtual void Init (bool bIsMainViewShell) override; |
99 | |
100 | virtual void Shutdown() override; |
101 | |
102 | void PrePaint() override; |
103 | virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override; |
104 | |
105 | /** Arrange and resize the GUI elements like rulers, sliders, and |
106 | buttons as well as the actual document view according to the size of |
107 | the enclosing window and current sizes of buttons, rulers, and |
108 | sliders. |
109 | */ |
110 | virtual void ArrangeGUIElements() override; |
111 | |
112 | void HidePage(); |
113 | |
114 | virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override; |
115 | virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) override; |
116 | virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override; |
117 | virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) override; |
118 | virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin) override; |
119 | bool IsMouseButtonDown() const { return mbMouseButtonDown; } |
120 | bool IsMouseSelecting() const { return mbMouseSelecting; } |
121 | |
122 | virtual void Resize() override; |
123 | |
124 | void ShowMousePosInfo(const ::tools::Rectangle& rRect, ::sd::Window const * pWin); |
125 | |
126 | virtual void ChangeEditMode (EditMode eMode, bool bIsLayerModeActive); |
127 | |
128 | virtual void SetZoom( long nZoom ) override; |
129 | virtual void SetZoomRect( const ::tools::Rectangle& rZoomRect ) override; |
130 | |
131 | void InsertURLField(const OUString& rURL, const OUString& rText, const OUString& rTarget); |
132 | void InsertURLButton(const OUString& rURL, const OUString& rText, const OUString& rTarget, |
133 | const Point* pPos); |
134 | |
135 | void SelectionHasChanged(); |
136 | void ModelHasChanged(); |
137 | virtual void Activate(bool bIsMDIActivate) override; |
138 | virtual void Deactivate(bool IsMDIActivate) override; |
139 | virtual void UIActivating( SfxInPlaceClient* ) override; |
140 | virtual void UIDeactivated( SfxInPlaceClient* ) override; |
141 | OUString GetSelectionText( bool bCompleteWords ); |
142 | bool HasSelection( bool bText ) const; |
143 | |
144 | //If we are editing a PresObjKind::Outline return the Outliner and fill rSel |
145 | //with the current selection |
146 | ::Outliner* GetOutlinerForMasterPageOutlineTextObj(ESelection &rSel); |
147 | |
148 | void ExecCtrl(SfxRequest& rReq); |
149 | void GetCtrlState(SfxItemSet& rSet); |
150 | void GetDrawAttrState(SfxItemSet& rSet); |
151 | void GetMenuState(SfxItemSet& rSet); |
152 | void GetTableMenuState(SfxItemSet& rSet); |
153 | /** Set the items of the given item set that are related to |
154 | switching the editing mode to the correct values. |
155 | <p>This function also sets the states of the mode buttons |
156 | (those at the upper right corner) accordingly.</p> |
157 | */ |
158 | void GetModeSwitchingMenuState (SfxItemSet &rSet); |
159 | void GetAttrState(SfxItemSet& rSet); |
160 | void GetSnapItemState(SfxItemSet& rSet); |
161 | |
162 | void SetPageProperties (SfxRequest& rReq); |
163 | void GetPageProperties(SfxItemSet& rSet); |
164 | void GetMarginProperties(SfxItemSet& rSet); |
165 | |
166 | void GetState (SfxItemSet& rSet); |
167 | void Execute (SfxRequest& rReq); |
168 | |
169 | void ExecStatusBar(SfxRequest& rReq); |
170 | void GetStatusBarState(SfxItemSet& rSet); |
171 | |
172 | void ExecOptionsBar(SfxRequest& rReq); |
173 | void GetOptionsBarState(SfxItemSet& rSet); |
174 | |
175 | void ExecRuler(SfxRequest& rReq); |
176 | void GetRulerState(SfxItemSet& rSet); |
177 | |
178 | void ExecFormText(SfxRequest& rReq); |
179 | void GetFormTextState(SfxItemSet& rSet); |
180 | |
181 | void ExecAnimationWin(SfxRequest& rReq); |
182 | void GetAnimationWinState(SfxItemSet& rSet); |
183 | |
184 | void ExecNavigatorWin(SfxRequest& rReq); |
185 | void GetNavigatorWinState(SfxItemSet& rSet); |
186 | |
187 | void ExecutePropPanelAttr (SfxRequest const & rReq); |
188 | void GetStatePropPanelAttr(SfxItemSet& rSet); |
189 | |
190 | void ExecEffectWin(SfxRequest& rReq); |
191 | |
192 | void Update3DWindow(); |
193 | void AssignFrom3DWindow(); |
194 | |
195 | void ExecGallery(SfxRequest const & rReq); |
196 | |
197 | void ExecBmpMask( SfxRequest const & rReq ); |
198 | void GetBmpMaskState( SfxItemSet& rSet ); |
199 | |
200 | void ExecIMap( SfxRequest const & rReq ); |
201 | void GetIMapState( SfxItemSet& rSet ); |
202 | |
203 | void FuTemporary(SfxRequest& rReq); |
204 | void FuPermanent(SfxRequest& rReq); |
205 | void FuSupport(SfxRequest& rReq); |
206 | void FuDeleteSelectedObjects(); |
207 | void FuSupportRotate(SfxRequest const & rReq); |
208 | void FuTable(SfxRequest& rReq); |
209 | |
210 | void AttrExec (SfxRequest& rReq); |
211 | void AttrState (SfxItemSet& rSet); |
212 | |
213 | void ExecGoToNextPage (SfxRequest& rReq); |
214 | void GetStateGoToNextPage (SfxItemSet& rSet); |
215 | |
216 | void ExecGoToPreviousPage (SfxRequest& rReq); |
217 | void GetStateGoToPreviousPage (SfxItemSet& rSet); |
218 | |
219 | void ExecGoToFirstPage (SfxRequest& rReq); |
220 | void GetStateGoToFirstPage (SfxItemSet& rSet); |
221 | |
222 | void ExecGoToLastPage (SfxRequest& rReq); |
223 | void GetStateGoToLastPage (SfxItemSet& rSet); |
224 | |
225 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) void ExecChar(SfxRequest& rReq); |
226 | |
227 | void ExecuteAnnotation (SfxRequest const & rRequest); |
228 | void GetAnnotationState (SfxItemSet& rItemSet); |
229 | |
230 | void StartRulerDrag (const Ruler& rRuler, const MouseEvent& rMEvt); |
231 | |
232 | virtual bool PrepareClose( bool bUI = true ) override; |
233 | |
234 | PageKind GetPageKind() const { return mePageKind; } |
235 | void SetPageKind( PageKind ePageKind ) { mePageKind = ePageKind; } |
236 | const Point& GetMousePos() const { return maMousePos; } |
237 | void SetMousePosFreezed( bool bIn ) { mbMousePosFreezed = bIn; } |
238 | |
239 | EditMode GetEditMode() const { return meEditMode; } |
240 | virtual SdPage* GetActualPage() override { return mpActualPage; } |
241 | |
242 | /// inherited from sd::ViewShell |
243 | virtual SdPage* getCurrentPage() const override; |
244 | |
245 | void ResetActualPage(); |
246 | void ResetActualLayer(); |
247 | bool SwitchPage(sal_uInt16 nPage); |
248 | bool IsSwitchPageAllowed() const; |
249 | |
250 | /** |
251 | * Mark the desired page as selected (1), deselected (0), toggle (2). |
252 | * nPage refers to the page in question. |
253 | */ |
254 | bool SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect); |
255 | bool IsSelected(sal_uInt16 nPage); |
256 | bool IsVisible(sal_uInt16 nPage); |
257 | |
258 | void GotoBookmark(const OUString& rBookmark); |
259 | //Realize multi-selection of objects, If object is marked, the |
260 | //corresponding entry is set true, else the corresponding entry is set |
261 | //false. |
262 | void FreshNavigatrTree(); |
263 | void MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin); |
264 | |
265 | virtual void ReadFrameViewData(FrameView* pView) override; |
266 | virtual void WriteFrameViewData() override; |
267 | |
268 | virtual ErrCode DoVerb(long nVerb) override; |
269 | virtual bool ActivateObject(SdrOle2Obj* pObj, long nVerb) override; |
270 | |
271 | void SetZoomOnPage( bool bZoom ) { mbZoomOnPage = bZoom; } |
272 | bool IsZoomOnPage() const { return mbZoomOnPage; } |
273 | static void CheckLineTo (SfxRequest& rReq); |
274 | void SetChildWindowState( SfxItemSet& rSet ); |
275 | |
276 | void UpdateIMapDlg( SdrObject* pObj ); |
277 | |
278 | void LockInput(); |
279 | void UnlockInput(); |
280 | bool IsInputLocked() const { return mnLockCount > 0; } |
281 | |
282 | sal_uInt16 GetCurPagePos() const { return maTabControl->GetCurPagePos(); } |
283 | |
284 | /** Show controls of the UI or hide them, depending on the given flag. |
285 | Do not call this method directly. Call the method at ViewShellBase |
286 | instead. |
287 | */ |
288 | virtual void ShowUIControls (bool bVisible) override; |
289 | |
290 | void ScannerEvent(); |
291 | |
292 | bool IsLayerModeActive() const { return mbIsLayerModeActive;} |
293 | |
294 | virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper, |
295 | ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ) override; |
296 | virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper, |
297 | ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ) override; |
298 | |
299 | virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override; |
300 | virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override; |
301 | |
302 | virtual void VisAreaChanged(const ::tools::Rectangle& rRect) override; |
303 | |
304 | /** Create an accessible object representing the specified window. |
305 | @param pWindow |
306 | The returned object makes the document displayed in this window |
307 | accessible. |
308 | @return |
309 | Returns an <type>AccessibleDrawDocumentView</type> object. |
310 | */ |
311 | virtual css::uno::Reference<css::accessibility::XAccessible> |
312 | CreateAccessibleDocumentView (::sd::Window* pWindow) override; |
313 | |
314 | /** Return the number of layers managed by the layer tab control. This |
315 | will usually differ from the number of layers managed by the layer |
316 | administrator. |
317 | @return |
318 | The number of layers managed by the layer tab control. The |
319 | returned value is independent of whether the layer mode is |
320 | currently active and the tab control is visible. |
321 | */ |
322 | int GetTabLayerCount() const; |
323 | |
324 | /** Return the numerical id of the currently active layer as seen by the |
325 | layer tab control. |
326 | @return |
327 | The returned id is a number between zero (inclusive) and the |
328 | number of layers as returned by the |
329 | <member>GetTabLayerCount</member> method (exclusive). |
330 | */ |
331 | int GetActiveTabLayerIndex() const; |
332 | |
333 | /** Set the active layer at the layer tab control and update the control |
334 | accordingly to reflect the change on screen. |
335 | @param nId |
336 | The id is expected to be a number between zero (inclusive) and |
337 | the number of layers as returned by the |
338 | <member>GetTabLayerCount</member> method (exclusive). Note that |
339 | Invalid values are ignored. No exception is thrown in that case. |
340 | */ |
341 | void SetActiveTabLayerIndex (int nId); |
342 | |
343 | /** Return a pointer to the tab control for pages. |
344 | */ |
345 | TabControl& GetPageTabControl() { return *maTabControl; } |
346 | |
347 | /** Return a pointer to the tab control for layers. |
348 | */ |
349 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) LayerTabBar* GetLayerTabControl(); // export for unit test |
350 | |
351 | /** Renames the given slide using an SvxNameDialog |
352 | |
353 | @param nPageId the index of the page in the SdTabControl. |
354 | @param rName the new name of the slide. |
355 | |
356 | @return false, if the new name is invalid for some reason. |
357 | |
358 | <p>Implemented in <code>drviews8.cxx</code>.</p> |
359 | */ |
360 | bool RenameSlide( sal_uInt16 nPageId, const OUString & rName ); |
361 | |
362 | /** modifies the given layer with the given values */ |
363 | void ModifyLayer( SdrLayer* pLayer, const OUString& rLayerName, const OUString& rLayerTitle, const OUString& rLayerDesc, bool bIsVisible, bool bIsLocked, bool bIsPrintable ); |
364 | |
365 | virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override; |
366 | |
367 | DrawView* GetDrawView() const { return mpDrawView.get(); } |
368 | |
369 | /** Relocation to a new parent window is not supported for DrawViewShell |
370 | objects so this method always returns <FALSE/>. |
371 | */ |
372 | virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) override; |
373 | |
374 | OUString const & GetSidebarContextName() const; |
375 | |
376 | bool IsInSwitchPage() const { return mbIsInSwitchPage; } |
377 | |
378 | //move this method to ViewShell. |
379 | //void NotifyAccUpdate(); |
380 | protected: |
381 | std::unique_ptr<DrawView> mpDrawView; |
382 | SdPage* mpActualPage; |
383 | ::tools::Rectangle maMarkRect; |
384 | Point maMousePos; |
385 | bool mbMousePosFreezed; |
386 | VclPtr<TabControl> maTabControl; |
387 | EditMode meEditMode; |
388 | PageKind mePageKind; |
389 | bool mbZoomOnPage; |
390 | bool mbIsRulerDrag; |
391 | sal_uLong mnLockCount; |
392 | bool mbReadOnly; |
393 | static bool mbPipette; |
394 | |
395 | DECL_LINK( ClipboardChanged, TransferableDataHelper*, void )static void LinkStubClipboardChanged(void *, TransferableDataHelper *); void ClipboardChanged(TransferableDataHelper*); |
396 | DECL_LINK( TabSplitHdl, TabBar *, void )static void LinkStubTabSplitHdl(void *, TabBar *); void TabSplitHdl (TabBar *); |
397 | DECL_LINK( NameObjectHdl, AbstractSvxObjectNameDialog&, bool )static bool LinkStubNameObjectHdl(void *, AbstractSvxObjectNameDialog &); bool NameObjectHdl(AbstractSvxObjectNameDialog&); |
398 | DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog&, bool )static bool LinkStubRenameSlideHdl(void *, AbstractSvxNameDialog &); bool RenameSlideHdl(AbstractSvxNameDialog&); |
399 | |
400 | void DeleteActualPage(); |
401 | void DeleteActualLayer(); |
402 | |
403 | virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin) override; |
404 | virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin) override; |
405 | virtual void UpdateHRuler() override; |
406 | virtual void UpdateVRuler() override; |
407 | virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) override; |
408 | |
409 | void SetupPage( Size const &rSize, long nLeft, long nRight, long nUpper, long nLower, |
410 | bool bSize, bool bMargin, bool bScaleAll ); |
411 | |
412 | void GetMenuStateSel(SfxItemSet& rSet); |
413 | |
414 | private: |
415 | /** This flag controls whether the layer mode is active, i.e. the layer |
416 | dialog is visible. |
417 | */ |
418 | bool mbIsLayerModeActive; |
419 | |
420 | /** This item contains the clipboard formats of the current clipboard |
421 | content that are supported both by that content and by the |
422 | DrawViewShell. |
423 | */ |
424 | ::std::unique_ptr<SvxClipboardFormatItem> mpCurrentClipboardFormats; |
425 | |
426 | /** On some occasions it is necessary to make SwitchPage calls |
427 | asynchronously. |
428 | */ |
429 | tools::AsynchronousCall maAsynchronousSwitchPageCall; |
430 | |
431 | /** This flag is used to prevent nested calls to SwitchPage(). |
432 | */ |
433 | bool mbIsInSwitchPage; |
434 | |
435 | RotateTransliteration m_aRotateCase; |
436 | |
437 | /** Listen for selection changes and broadcast context changes for the sidebar. |
438 | */ |
439 | ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; |
440 | |
441 | void Construct (DrawDocShell* pDocSh, PageKind ePageKind); |
442 | |
443 | /** Depending on the given request create a new page or duplicate an |
444 | existing one. See ViewShell::CreateOrDuplicatePage() for more |
445 | information. |
446 | */ |
447 | virtual SdPage* CreateOrDuplicatePage ( |
448 | SfxRequest& rRequest, |
449 | PageKind ePageKind, |
450 | SdPage* pPage, |
451 | const sal_Int32 nInsertPosition = -1) override; |
452 | |
453 | void DuplicateSelectedSlides (SfxRequest& rRequest); |
454 | |
455 | css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager; |
456 | css::uno::Reference< css::lang::XEventListener > mxScannerListener; |
457 | rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr; |
458 | bool mbPastePossible; |
459 | bool mbMouseButtonDown; |
460 | bool mbMouseSelecting; |
461 | |
462 | virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint) override; |
463 | |
464 | /** Stop a running slide show. |
465 | */ |
466 | void StopSlideShow(); |
467 | |
468 | /** Show the context menu for snap lines and points. Because snap lines |
469 | can not be selected the index of the snap line/point for which the |
470 | popup menu is opened has to be passed to the processing slot |
471 | handlers. This can be done only by manually showing the popup menu. |
472 | @param rPageView |
473 | The page view is used to access the help lines. |
474 | @param nSnapLineIndex |
475 | Index of the snap line or snap point for which to show the |
476 | context menu. |
477 | @param rMouseLocation |
478 | The mouse location defines the location at which to display the |
479 | context menu. |
480 | */ |
481 | void ShowSnapLineContextMenu ( |
482 | SdrPageView& rPageView, |
483 | const sal_uInt16 nSnapLineIndex, |
484 | const Point& rMouseLocation); |
485 | |
486 | using ViewShell::Notify; |
487 | |
488 | ::std::unique_ptr< AnnotationManager > mpAnnotationManager; |
489 | ::std::unique_ptr< ViewOverlayManager > mpViewOverlayManager; |
490 | |
491 | std::vector<std::unique_ptr<SdrExternalToolEdit>> m_ExternalEdits; |
492 | |
493 | virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, ConfigurationHints ) override; |
494 | |
495 | void ConfigureAppBackgroundColor( svtools::ColorConfig* pColorConfig = nullptr ); |
496 | |
497 | // The colour of the area behind the slide (used to be called "Wiese") |
498 | Color mnAppBackgroundColor; |
499 | }; |
500 | |
501 | /// Merge the background properties together and deposit the result in rMergeAttr |
502 | void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool bMasterPage, SfxItemSet& rMergedAttr); |
503 | |
504 | } // end of namespace sd |
505 | |
506 | #endif |
507 | |
508 | /* 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_SVDMRKV_HXX |
21 | #define INCLUDED_SVX_SVDMRKV_HXX |
22 | |
23 | #include <svx/svdmark.hxx> |
24 | #include <svx/svdhdl.hxx> |
25 | #include <svx/svdsnpv.hxx> |
26 | #include <svx/svdtypes.hxx> |
27 | #include <svx/svxdllapi.h> |
28 | #include <o3tl/typed_flags_set.hxx> |
29 | #include <basegfx/range/b2drectangle.hxx> |
30 | |
31 | |
32 | class SfxViewShell; |
33 | |
34 | // The following is not yet implemented, or just partially: |
35 | enum class SdrSearchOptions |
36 | { |
37 | NONE = 0x0000, |
38 | DEEP = 0x0001, /* recursive into group objects */ |
39 | ALSOONMASTER = 0x0002, /* MasterPages are also scanned */ |
40 | WHOLEPAGE = 0x0004, /* Not just the ObjList of PageView */ |
41 | TESTMARKABLE = 0x0008, /* just markable objects/points/handles/... */ |
42 | TESTMACRO = 0x0010, /* Just objects with macro */ |
43 | TESTTEXTEDIT = 0x0020, /* Just TextEdit-enabled objects */ |
44 | MARKED = 0x0040, /* Just marked objects/points/... */ |
45 | PASS2BOUND = 0x0080, /* In case of empty search results, then 2nd. try with BoundRectHit */ |
46 | BEFOREMARK = 0x0100, /* if one marked one found, ignore all behind that */ |
47 | |
48 | IMPISMASTER = 0x0200, /* MasterPage is being searched right now */ |
49 | PICKMARKABLE = TESTMARKABLE, |
50 | PICKTEXTEDIT = DEEP | TESTMARKABLE | TESTTEXTEDIT, |
51 | PICKMACRO = DEEP | ALSOONMASTER | WHOLEPAGE | TESTMACRO, |
52 | }; |
53 | namespace o3tl |
54 | { |
55 | template<> struct typed_flags<SdrSearchOptions> : is_typed_flags<SdrSearchOptions, 0x03ff> {}; |
56 | } |
57 | |
58 | enum class SdrHitKind |
59 | { |
60 | NONE, // No hit |
61 | Object, // Hit |
62 | Handle, // Marking handle |
63 | HelpLine, // Reference line |
64 | Gluepoint, // Glue point |
65 | TextEdit, // Open OutlinerView was hit |
66 | TextEditObj, // Object for SdrBeginTextEdit (Textbereich) |
67 | UrlField, // Field in TextObj was hit (while it is currently not edited) |
68 | Macro, // Object for BegMacroObj |
69 | MarkedObject, // Marked object (e.g. for dragging) |
70 | UnmarkedObject, // non-marked Object (e.g. for marking) |
71 | Cell // hit on a cell inside a table shape (outside of the cells text area) |
72 | }; |
73 | |
74 | enum class SdrViewEditMode { |
75 | Edit, // Also known as arrow or pointer mode |
76 | Create, // Tool for object creation |
77 | GluePointEdit // Glue point editing mode |
78 | }; |
79 | |
80 | /** options for ImpGetDescriptionString() */ |
81 | enum class ImpGetDescriptionOptions |
82 | { |
83 | NONE = 0, |
84 | POINTS = 1, |
85 | GLUEPOINTS = 2, |
86 | }; |
87 | |
88 | class ImplMarkingOverlay; |
89 | class MarkingSubSelectionOverlay; |
90 | |
91 | class SVXCORE_DLLPUBLIC__attribute__ ((visibility("default"))) SdrMarkView : public SdrSnapView |
92 | { |
93 | friend class SdrPageView; |
94 | |
95 | // #114409#-3 Migrate selections |
96 | std::unique_ptr<ImplMarkingOverlay> mpMarkObjOverlay; |
97 | std::unique_ptr<ImplMarkingOverlay> mpMarkPointsOverlay; |
98 | std::unique_ptr<ImplMarkingOverlay> mpMarkGluePointsOverlay; |
99 | |
100 | std::unique_ptr<MarkingSubSelectionOverlay> mpMarkingSubSelectionOverlay; |
101 | |
102 | protected: |
103 | SdrObject* mpMarkedObj; // If not just one object ( i.e. More than one object ) is marked. |
104 | SdrPageView* mpMarkedPV; // If all marked objects are situated on the same PageView. |
105 | |
106 | Point maRef1; // Persistent - Rotation center / axis of reflection |
107 | Point maRef2; // Persistent |
108 | SdrHdlList maHdlList; |
109 | |
110 | sdr::ViewSelection maSdrViewSelection; |
111 | |
112 | std::vector<basegfx::B2DRectangle> maSubSelectionList; |
113 | tools::Rectangle maMarkedObjRect; |
114 | tools::Rectangle maMarkedPointsRect; |
115 | tools::Rectangle maMarkedGluePointsRect; |
116 | |
117 | static constexpr sal_uInt16 mnFrameHandlesLimit = 50; |
118 | |
119 | SdrDragMode meDragMode; // Persistent |
120 | SdrViewEditMode meEditMode; // Persistent |
121 | SdrViewEditMode meEditMode0; // Persistent |
122 | |
123 | bool mbDesignMode : 1; // DesignMode for SdrUnoObj |
124 | bool mbForceFrameHandles : 1; // Persistent - FrameDrag also for single objects |
125 | bool mbPlusHdlAlways : 1; // Persistent |
126 | bool mbInsPolyPoint : 1; // at this time InsPolyPointDragging |
127 | bool mbMarkedObjRectDirty : 1; |
128 | bool mbMrkPntDirty : 1; |
129 | bool mbMarkedPointsRectsDirty : 1; |
130 | |
131 | // flag to completely disable handles at the view |
132 | bool mbMarkHandlesHidden : 1; |
133 | |
134 | // Helper to get a possible GridOffset from SdrObject |
135 | bool getPossibleGridOffsetForSdrObject( |
136 | basegfx::B2DVector& rOffset, |
137 | const SdrObject* pObj, |
138 | const SdrPageView* pPV) const; |
139 | |
140 | // Helper to get a possible GridOffset from Position |
141 | bool getPossibleGridOffsetForPosition( |
142 | basegfx::B2DVector& rOffset, |
143 | const basegfx::B2DPoint& rPoint, |
144 | const SdrPageView* pPV) const; |
145 | |
146 | private: |
147 | SVX_DLLPRIVATE__attribute__ ((visibility("hidden"))) void ImpSetPointsRects() const; |
148 | void UndirtyMrkPnt() const; |
149 | |
150 | void SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const SfxViewShell* pOtherShell); |
151 | |
152 | protected: |
153 | virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; |
154 | virtual void ModelHasChanged() override; // Is called by the PaintView |
155 | virtual void SetMarkHandles(SfxViewShell* pOtherShell); // maHdlList - fill (List of handles) |
156 | void SetMarkRects(); // Rects at the PageViews |
157 | void CheckMarked(); // Scan MarkList after Del and Lock Layer ... |
158 | void AddDragModeHdl(SdrDragMode eMode); |
159 | virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; |
160 | virtual bool RequestHelp(const HelpEvent& rHEvt) override; |
161 | |
162 | // add custom handles (used by other apps, e.g. AnchorPos) |
163 | virtual void AddCustomHdl(); |
164 | |
165 | void ForceRefToMarked(); |
166 | void ForceUndirtyMrkPnt() const { if (mbMrkPntDirty) UndirtyMrkPnt(); } |
167 | |
168 | virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const; |
169 | SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList const * pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj) const; |
170 | SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList const * pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const; |
171 | bool ImpIsFrameHandles() const; |
172 | OUString ImpGetDescriptionString(const char* pStrCacheID, ImpGetDescriptionOptions nOpt=ImpGetDescriptionOptions::NONE) const; |
173 | |
174 | // Generates a string including degrees symbol, from an angel specification in 1/100deg |
175 | bool ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark); |
176 | virtual bool MarkPoints(const tools::Rectangle* pRect, bool bUnmark); |
177 | bool MarkGluePoints(const tools::Rectangle* pRect, bool bUnmark); |
178 | |
179 | void SetMoveOutside(bool bOn); |
180 | bool MarkableObjectsExceed( int n ) const; |
181 | |
182 | protected: |
183 | // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView |
184 | SdrMarkView( |
185 | SdrModel& rSdrModel, |
186 | OutputDevice* pOut); |
187 | |
188 | virtual ~SdrMarkView() override; |
189 | |
190 | public: |
191 | virtual bool IsAction() const override; |
192 | virtual void MovAction(const Point& rPnt) override; |
193 | virtual void EndAction() override; |
194 | virtual void BckAction() override; |
195 | virtual void BrkAction() override; |
196 | virtual void TakeActionRect(tools::Rectangle& rRect) const override; |
197 | |
198 | virtual void ClearPageView() override; |
199 | virtual void HideSdrPage() override; |
200 | bool IsObjMarkable(SdrObject const * pObj, SdrPageView const * pPV) const; |
201 | |
202 | // Returns sal_True if objects, points or glue points are selected by drawing a frame |
203 | // (as long as the frame is drawn). |
204 | bool IsMarking() const { return IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); } |
205 | |
206 | // Marking objects by drawing of a selection frame |
207 | void BegMarkObj(const Point& rPnt, bool bUnmark = false); |
208 | void MovMarkObj(const Point& rPnt); |
209 | bool EndMarkObj(); |
210 | void BrkMarkObj(); |
211 | bool IsMarkObj() const { return (nullptr != mpMarkObjOverlay); } |
212 | |
213 | // DragModes: SDRDRAG_CREATE,SdrDragMode::Move,SdrDragMode::Resize,SdrDragMode::Rotate,SdrDragMode::Mirror,SdrDragMode::Shear,SdrDragMode::Crook |
214 | // Move==Resize |
215 | // The interface might maybe be changed in the future because of Ortho-Drag |
216 | void SetDragMode(SdrDragMode eMode); |
217 | SdrDragMode GetDragMode() const { return meDragMode; } |
218 | void SetFrameHandles(bool bOn); |
219 | bool IsFrameHandles() const { return mbForceFrameHandles; } |
220 | |
221 | // returns true if number of markable objects is greater than 1 |
222 | bool HasMultipleMarkableObjects() const { return MarkableObjectsExceed(1); }; |
223 | |
224 | void SetEditMode(SdrViewEditMode eMode); |
225 | SdrViewEditMode GetEditMode() const { return meEditMode; } |
226 | |
227 | void SetEditMode(bool bOn) { SetEditMode(bOn?SdrViewEditMode::Edit:SdrViewEditMode::Create); } |
228 | bool IsEditMode() const { return meEditMode==SdrViewEditMode::Edit; } |
229 | void SetCreateMode(bool bOn) { SetEditMode(bOn?SdrViewEditMode::Create:SdrViewEditMode::Edit); } |
230 | bool IsCreateMode() const { return meEditMode==SdrViewEditMode::Create; } |
231 | void SetGluePointEditMode(bool bOn) { SetEditMode(bOn?SdrViewEditMode::GluePointEdit:meEditMode0); } |
232 | bool IsGluePointEditMode() const { return meEditMode==SdrViewEditMode::GluePointEdit; } |
233 | |
234 | void SetDesignMode(bool bOn = true); |
235 | bool IsDesignMode() const { return mbDesignMode; } |
236 | |
237 | void SetFrameDragSingles(bool bOn=true) { SetFrameHandles(bOn); } |
238 | bool IsFrameDragSingles() const { return IsFrameHandles(); } |
239 | |
240 | bool HasMarkableObj() const { return MarkableObjectsExceed(0); }; |
241 | |
242 | |
243 | // migrate selections |
244 | |
245 | protected: |
246 | // all available changing methods |
247 | SdrMarkList& GetMarkedObjectListWriteAccess() { return maSdrViewSelection.GetMarkedObjectListWriteAccess(); } |
248 | |
249 | public: |
250 | // all available const methods for read access to selection |
251 | const SdrMarkList& GetMarkedObjectList() const { return maSdrViewSelection.GetMarkedObjectList(); } |
252 | // returns SAL_MAX_SIZE if not found |
253 | size_t TryToFindMarkedObject(const SdrObject* pObj) const { return GetMarkedObjectList().FindObject(pObj); } |
254 | SdrPageView* GetSdrPageViewOfMarkedByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetPageView(); } |
255 | SdrMark* GetSdrMarkByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum); } |
256 | SdrObject* GetMarkedObjectByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetMarkedSdrObj(); } |
257 | size_t GetMarkedObjectCount() const { return GetMarkedObjectList().GetMarkCount(); } |
258 | void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); } |
259 | bool AreObjectsMarked() const { return 0 != GetMarkedObjectList().GetMarkCount(); } |
260 | OUString const & GetDescriptionOfMarkedObjects() const { return GetMarkedObjectList().GetMarkDescription(); } |
261 | OUString const & GetDescriptionOfMarkedPoints() const { return GetMarkedObjectList().GetPointMarkDescription(); } |
262 | OUString const & GetDescriptionOfMarkedGluePoints() const { return GetMarkedObjectList().GetGluePointMarkDescription(); } |
263 | |
264 | // Get a list of all those links which are connected to marked nodes, |
265 | // but which are not marked themselves. |
266 | const SdrMarkList& GetEdgesOfMarkedNodes() const { return maSdrViewSelection.GetEdgesOfMarkedNodes(); } |
267 | const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const { return maSdrViewSelection.GetMarkedEdgesOfMarkedNodes(); } |
268 | const std::vector<SdrObject*>& GetTransitiveHullOfMarkedObjects() const { return maSdrViewSelection.GetAllMarkedObjects(); } |
269 | |
270 | |
271 | // mechanism to complete disable handles at the view. Handles will be hidden and deleted |
272 | // when set, no new ones created, no interaction allowed. Handles will be recreated and shown |
273 | // when reset. Default is false. |
274 | void hideMarkHandles(); |
275 | void showMarkHandles(); |
276 | bool areMarkHandlesHidden() const { return mbMarkHandlesHidden; } |
277 | |
278 | bool IsMarkedHit(const Point& rPnt, short nTol=-2) const { return IsMarkedObjHit(rPnt,nTol); } |
279 | bool IsMarkedObjHit(const Point& rPnt, short nTol=-2) const; |
280 | |
281 | SdrHdl* PickHandle(const Point& rPnt) const; |
282 | |
283 | // Pick: Supported options for nOptions are: |
284 | // SdrSearchOptions::DEEP SdrSearchOptions::ALSOONMASTER SdrSearchOptions::TESTMARKABLE SdrSearchOptions::TESTTEXTEDIT |
285 | // SdrSearchOptions::MARKED |
286 | // SdrSearchOptions::WHOLEPAGE |
287 | SdrObject* PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect=nullptr) const; |
288 | SdrObject* PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions=SdrSearchOptions::NONE) const; |
289 | bool MarkObj(const Point& rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false); |
290 | |
291 | // Pick: Supported options for nOptions are SdrSearchOptions::PASS2BOUND |
292 | bool PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const; |
293 | |
294 | // Selects the most upper of the marked objects (O1) and scans from there |
295 | // towards bottom direction, selecting the first non-marked object (O2). |
296 | // In case of success the marking of O1 is deleted, a marking is created at |
297 | // O2 and TRUE is returned. With the parameter bPrev=sal_True the scan |
298 | // direction is turned to the other direction. |
299 | bool MarkNextObj(bool bPrev=false); |
300 | |
301 | // Selects the most upper of the marked objects which is hit by rPnt/nTol |
302 | // and scans from there to bottom direction, selecting the first non-marked |
303 | // object (O2). In case of success the marking of O1 is deleted, a marking |
304 | // is created at O2 and sal_True is returned. With the parameter |
305 | // bPrev=sal_True the scan direction is turned to the other direction. |
306 | bool MarkNextObj(const Point& rPnt, short nTol, bool bPrev); |
307 | |
308 | // Mark all objects within a rectangular area |
309 | // Just objects are marked which are inclosed completely |
310 | void MarkObj(const tools::Rectangle& rRect, bool bUnmark); |
311 | void MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark = false, bool bDoNoSetMarkHdl = false, |
312 | std::vector<basegfx::B2DRectangle> const & rSubSelections = std::vector<basegfx::B2DRectangle>()); |
313 | void MarkAllObj(SdrPageView* pPV=nullptr); // pPage=NULL => all displayed pages |
314 | void UnmarkAllObj(SdrPageView const * pPV=nullptr); // pPage=NULL => all displayed pages |
315 | |
316 | // This function is time-consuming intensive, as the MarkList has to be scanned. |
317 | bool IsObjMarked(SdrObject const * pObj) const; |
318 | void UnMarkAll(SdrPageView const * pPV=nullptr) { UnmarkAllObj(pPV); } |
319 | |
320 | // Request/set the size of the marking handles. Declaration in Pixel. |
321 | // The value is meant to be the edge length ( link length ). |
322 | // Pair values are round up to impair values: 3->3, 4->5, 5->5, 6->7, 7->7, ... |
323 | // Default value is 7, minimum value is 3 Pixels. |
324 | sal_uInt16 GetMarkHdlSizePixel() const; |
325 | void SetMarkHdlSizePixel(sal_uInt16 nSiz); |
326 | |
327 | virtual bool HasMarkablePoints() const; |
328 | virtual sal_Int32 GetMarkablePointCount() const; |
329 | virtual bool HasMarkedPoints() const; |
330 | |
331 | // There might be points which can't be marked: |
332 | bool IsPointMarkable(const SdrHdl& rHdl) const; |
333 | virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark=false); |
334 | |
335 | /** should only be used from outside svx for special ui elements */ |
336 | bool MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark); |
337 | |
338 | bool UnmarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,true); } |
339 | bool IsPointMarked(const SdrHdl& rHdl) const { ForceUndirtyMrkPnt(); return rHdl.IsSelected(); } |
340 | bool MarkAllPoints() { return MarkPoints(nullptr,false); } |
341 | bool UnmarkAllPoints() { return MarkPoints(nullptr,true); } |
342 | |
343 | // Selects the first marked point (P1) which is hit by rPnt |
344 | // and from there it searches the first non-marked point(P2). |
345 | // In case of success the marking of |
346 | // P1 is deleted, a mark is set at P2. |
347 | void MarkNextPoint(); |
348 | |
349 | // Search for the number of the suitable handle. In case of empty search result, |
350 | // SAL_MAX_SIZE is returned. |
351 | size_t GetHdlNum(SdrHdl const * pHdl) const { return maHdlList.GetHdlNum(pHdl); } |
352 | SdrHdl* GetHdl(size_t nHdlNum) const { return maHdlList.GetHdl(nHdlNum); } |
353 | const SdrHdlList& GetHdlList() const { return maHdlList; } |
354 | |
355 | // Draw a selection frame for marking of points. |
356 | // This routine will just be started in case that HasMarkablePoints() returns sal_True. |
357 | bool BegMarkPoints(const Point& rPnt, bool bUnmark = false); |
358 | void MovMarkPoints(const Point& rPnt); |
359 | bool EndMarkPoints(); |
360 | void BrkMarkPoints(); |
361 | bool IsMarkPoints() const { return (nullptr != mpMarkPointsOverlay); } |
362 | |
363 | // Select that additional handles are displayed permanently. |
364 | void SetPlusHandlesAlwaysVisible(bool bOn); |
365 | bool IsPlusHandlesAlwaysVisible() const { return mbPlusHdlAlways; } |
366 | |
367 | bool HasMarkableGluePoints() const; |
368 | bool HasMarkedGluePoints() const; |
369 | |
370 | // A gluepoint is clearly identified by the SdrObject |
371 | // (to which it belongs) as well as by a sal_uInt16 nId (as each SdrObject may consist of |
372 | // several glue points. Here at the View there is an additional |
373 | // SdrPageView, which should be defined correctly always. |
374 | // Alternatively a gluepoint may be characterized by a SdrHdl. |
375 | // In this case the SdrHdl instance consists of all required information. |
376 | // And in this case, the glue point are always is marked by enforcement |
377 | // (Handlers are just situated at marked gluepoints ) |
378 | // Attention: With each change of the glue point status the handle list is re-calculated. |
379 | // All previously saved SdrHdl* became invalid by this, the same with the point IDs! |
380 | bool PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16& rnId, SdrPageView*& rpPV) const; |
381 | bool MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, bool bUnmark); |
382 | void UnmarkGluePoint(const SdrObject* pObj, sal_uInt16 nId) { MarkGluePoint(pObj,nId,true); } |
383 | bool IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const; |
384 | |
385 | // Get the Hdl (handle) of a marked GluePoint. Non-marked |
386 | // GluePoints don`t have handles |
387 | SdrHdl* GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const; |
388 | |
389 | // Mark all points within this rectangular (View coordinates) |
390 | bool MarkAllGluePoints() { return MarkGluePoints(nullptr,false); } |
391 | bool UnmarkAllGluePoints() { return MarkGluePoints(nullptr,true); } |
392 | |
393 | // Selects the first marked point (P1) which is hit by rPnt |
394 | // and from there it searches the first non-marked point(P2). |
395 | // In case of success the marking of |
396 | // P1 is deleted, a mark is set at P2. |
397 | void MarkNextGluePoint(); |
398 | |
399 | // Draw a selection frame for glue point marking. |
400 | // This routine will just be started in case that HasMarkablePoints() returns sal_True. |
401 | // The GlueEditMode sal_True is disregarded. |
402 | // bool BegMarkGluePoints(const Point& rPnt, OutputDevice* pOut); |
403 | bool BegMarkGluePoints(const Point& rPnt, bool bUnmark = false); |
404 | void MovMarkGluePoints(const Point& rPnt); |
405 | void EndMarkGluePoints(); |
406 | void BrkMarkGluePoints(); |
407 | bool IsMarkGluePoints() const { return (nullptr != mpMarkGluePointsOverlay); } |
408 | |
409 | // bRestraintPaint=sal_False causes the handles not to be drawn immediately. |
410 | // AdjustMarkHdl is just called in case of changes; usually this causes an Invalidate |
411 | // At the end of a redraw the handles are drawn automatically. |
412 | // The purpose is to avoid unnecessary flickering. -> This does not yet work, that's why sal_True! |
413 | void AdjustMarkHdl(SfxViewShell* pOtherShell = nullptr); //HMHBOOL bRestraintPaint=sal_True); |
414 | |
415 | const tools::Rectangle& GetMarkedObjRect() const; // SnapRects of Objects, without line width |
416 | tools::Rectangle GetMarkedObjBoundRect() const; // incl. line width, overlapping rags, ... |
417 | const tools::Rectangle& GetMarkedPointsRect() const; // Enclosing rectangle of all marked points |
418 | const tools::Rectangle& GetMarkedGluePointsRect() const; // Enclosing rectangle of all marked glue points |
419 | const tools::Rectangle& GetAllMarkedRect() const { return GetMarkedObjRect(); } |
420 | tools::Rectangle GetAllMarkedBoundRect() const { return GetMarkedObjBoundRect(); } |
421 | |
422 | // Will be always called, if the list of marked objects might be changed. |
423 | // If you override this method, be sure that you call the |
424 | // methods of the base class! |
425 | virtual void MarkListHasChanged(); |
426 | |
427 | // Entering (Editing) of a maybe marked object group. If there are several |
428 | // object groups marked, the most upper group is selected. After that |
429 | // all member objects of the group are directly accessible. All other |
430 | // objects may not be processed in the meantime (until the next |
431 | // LeaveGroup()). With markings which overlaps pages, every page is processed |
432 | // separately. The method returns sal_True, if at least one group was entered. |
433 | void EnterMarkedGroup(); |
434 | |
435 | // Rotation center point and start point of the axis of reflection, respectively |
436 | const Point& GetRef1() const { return maRef1; } |
437 | void SetRef1(const Point& rPt); |
438 | |
439 | // End point of the axis of reflection |
440 | const Point& GetRef2() const { return maRef2; } |
441 | void SetRef2(const Point& rPt); |
442 | /// Get access to the view shell owning this draw view, if any. |
443 | virtual SfxViewShell* GetSfxViewShell() const; |
444 | }; |
445 | |
446 | |
447 | // - Hit tolerances: |
448 | // It has to be declared in logical coordinates. So please translate the |
449 | // wanted pixel value with PixelToLogic in Logical values. |
450 | // Taking as example a logical value of 100: |
451 | // - For a horizontal hairline (Object with height 0), the generated data is +/-100, i.e. |
452 | // a vertical area of 200 logical units is sensitive. |
453 | // - For a polygon, a rectangular of the size (200,200) is generated and a |
454 | // touch test between Poly and this Rect is processed. |
455 | // - Objects which respond SdrObject::HasEdit()==TRUE ( e.g. a text frame ), |
456 | // are specially treated: An additional sensitive area with a width of |
457 | // 2*Tol (200 units for this example) is created around the object. |
458 | // When an object is directly hit, the Edit method is called. |
459 | // In opposite, a hit in the surrounding sensitive area enables Dragging. |
460 | |
461 | |
462 | #endif // INCLUDED_SVX_SVDMRKV_HXX |
463 | |
464 | /* 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_SD_SOURCE_UI_INC_VIEWSHELL_HXX |
21 | #define INCLUDED_SD_SOURCE_UI_INC_VIEWSHELL_HXX |
22 | |
23 | #include <rtl/ref.hxx> |
24 | |
25 | #include <sfx2/viewsh.hxx> |
26 | #include <vcl/prntypes.hxx> |
27 | #include <vcl/scrbar.hxx> |
28 | #include <o3tl/deleter.hxx> |
29 | #include <pres.hxx> |
30 | #include "View.hxx" |
31 | #include "fupoor.hxx" |
32 | #include <sddllapi.h> |
33 | |
34 | #include <memory> |
35 | |
36 | class SdPage; |
37 | class SvxRuler; |
38 | class SdrOle2Obj; // for the ones, who have undefined parts of SVDRAW |
39 | class SdDrawDocument; |
40 | |
41 | namespace weld |
42 | { |
43 | class Window; |
44 | } |
45 | |
46 | namespace com::sun::star::drawing { class XDrawSubController; } |
47 | |
48 | namespace sd { |
49 | |
50 | class DrawDocShell; |
51 | class FrameView; |
52 | class LayerTabBar; |
53 | class ViewShellBase; |
54 | class Window; |
55 | class WindowUpdater; |
56 | class ZoomList; |
57 | |
58 | #undef OUTPUT_DRAWMODE_COLOR |
59 | #undef OUTPUT_DRAWMODE_CONTRAST |
60 | |
61 | const DrawModeFlags OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default; |
62 | const DrawModeFlags OUTPUT_DRAWMODE_GRAYSCALE |
63 | = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill |
64 | | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap |
65 | | DrawModeFlags::GrayGradient; |
66 | const DrawModeFlags OUTPUT_DRAWMODE_BLACKWHITE |
67 | = DrawModeFlags::BlackLine | DrawModeFlags::BlackText |
68 | | DrawModeFlags::WhiteFill | DrawModeFlags::GrayBitmap |
69 | | DrawModeFlags::WhiteGradient; |
70 | const DrawModeFlags OUTPUT_DRAWMODE_CONTRAST |
71 | = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill |
72 | | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient; |
73 | |
74 | /** Base class of the stacked shell hierarchy. |
75 | |
76 | <p>Despite its name this class is not a descendant of SfxViewShell |
77 | but of SfxShell. Its name expresses the fact that it acts like a |
78 | view shell. Being a stacked shell rather than being an actual view shell |
79 | there can be several instances of this class that |
80 | <ul> |
81 | <li>all are based on the same view shell and thus show the same |
82 | document and share common view functionality and</li> |
83 | <li>are all visible at the same time and live in the same |
84 | frame.</li> |
85 | <ul></p> |
86 | |
87 | <p>This class replaces the former ViewShell class.</p> |
88 | */ |
89 | class SAL_DLLPUBLIC_RTTI__attribute__ ((type_visibility("default"))) ViewShell |
90 | : public SfxShell |
91 | { |
92 | public: |
93 | enum ShellType { |
94 | ST_NONE, |
95 | ST_DRAW, // The Draw application. |
96 | ST_IMPRESS, // Main view of the Impress application. |
97 | ST_NOTES, |
98 | ST_HANDOUT, |
99 | ST_OUTLINE, |
100 | ST_SLIDE_SORTER, |
101 | ST_PRESENTATION, |
102 | ST_SIDEBAR |
103 | }; |
104 | static const int MAX_HSPLIT_CNT = 1; |
105 | static const int MAX_VSPLIT_CNT = 1; |
106 | static const int MIN_SCROLLBAR_SIZE = 50; |
107 | |
108 | |
109 | ViewShell ( |
110 | vcl::Window* pParentWindow, |
111 | ViewShellBase& rViewShellBase); |
112 | virtual ~ViewShell() override; |
113 | |
114 | /** The Init method has to be called from the outside directly |
115 | after a new object of this class has been created. It can be |
116 | used for that part of the initialisation that can be run only |
117 | after the creation of the new object is finished. This |
118 | includes registration as listener at event broadcasters. |
119 | |
120 | Derived classes should call this method at the head of their |
121 | Init() methods. |
122 | @param bIsMainViewShell |
123 | This flag tells the Init() method whether the new ViewShell will |
124 | be the main view shell. |
125 | */ |
126 | virtual void Init (bool bIsMainViewShell); |
127 | |
128 | /** The Exit() method has to be called before the destructor so that the |
129 | view shell is still a valid object and can safely call methods that |
130 | rely on that. |
131 | */ |
132 | void Exit(); |
133 | |
134 | void Cancel(); |
135 | |
136 | /** Return the window that is the parent of all controls of this view |
137 | shell. This may or may not be the window of the frame. |
138 | */ |
139 | vcl::Window* GetParentWindow() const { return mpParentWindow; } |
140 | |
141 | sd::Window* GetContentWindow() const; |
142 | |
143 | ::sd::View* GetView() const { return mpView; } |
144 | inline SdrView* GetDrawView() const; |
145 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) DrawDocShell* GetDocSh() const; |
146 | |
147 | SdDrawDocument* GetDoc() const; |
148 | |
149 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) SfxViewFrame* GetViewFrame() const; |
150 | |
151 | /** The active window is usually the mpContentWindow. When there is a |
152 | show running then the active window is a ShowWindow. |
153 | */ |
154 | ::sd::Window* GetActiveWindow() const { return mpActiveWindow;} |
155 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) weld::Window* GetFrameWeld() const; |
156 | |
157 | /** Set the active window. When the shell is displayed in the center |
158 | pane then the window of the ViewShellBase is also set to the given |
159 | window. |
160 | */ |
161 | void SetActiveWindow (::sd::Window* pWindow); |
162 | |
163 | /** Return the rectangle that encloses all windows of the view. That |
164 | excludes the controls in the frame like rulers, scroll bars, tab |
165 | bar, and buttons. |
166 | @return |
167 | The rectangle is returned in screen coordinates, i.e. pixel |
168 | values relative to the upper left corner of the screen?. |
169 | */ |
170 | const ::tools::Rectangle& GetAllWindowRect(); |
171 | |
172 | // Mouse- & Key-Events |
173 | virtual void PrePaint(); |
174 | virtual void Paint (const ::tools::Rectangle& rRect, ::sd::Window* pWin); |
175 | virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin); |
176 | virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin); |
177 | virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin); |
178 | virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin); |
179 | virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin); |
180 | bool RequestHelp( const HelpEvent& rEvt ); |
181 | bool Notify( NotifyEvent const & rNEvt, ::sd::Window* pWin ); |
182 | |
183 | bool HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin); |
184 | |
185 | void SetUIUnit(FieldUnit eUnit); |
186 | void SetDefTabHRuler( sal_uInt16 nDefTab ); |
187 | |
188 | const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId); |
189 | |
190 | bool HasRuler() const { return mbHasRulers;} |
191 | void SetRuler(bool bRuler); |
192 | // Hides horizontal, vertical scrollbar as well as scrollbox |
193 | void SetScrollBarsVisible(bool bVisible); |
194 | |
195 | /** Set internal values of all scroll bars that determine thumb size and |
196 | position. The external values like size and position of the scroll |
197 | bar controls are not modified. |
198 | */ |
199 | virtual void UpdateScrollBars(); |
200 | void Scroll(long nX, long nY); |
201 | void ScrollLines(long nX, long nY); |
202 | virtual void SetZoom(long nZoom); |
203 | long GetZoom() const; |
204 | virtual void SetZoomRect(const ::tools::Rectangle& rZoomRect); |
205 | void InitWindows(const Point& rViewOrigin, const Size& rViewSize, |
206 | const Point& rWinPos, bool bUpdate = false); |
207 | void InvalidateWindows(); |
208 | /** This method is still used by the OutlineViewShell to update the |
209 | model according to the content of the outline view. This in turn |
210 | updates the previews in the slide sorter. |
211 | */ |
212 | virtual void UpdatePreview (SdPage* pPage); |
213 | |
214 | void DrawMarkRect(const ::tools::Rectangle& rRect) const; |
215 | |
216 | void ExecReq( SfxRequest &rReq ); |
217 | |
218 | ZoomList* GetZoomList() { return mpZoomList.get();} |
219 | |
220 | FrameView* GetFrameView() { return mpFrameView; } |
221 | /** Setting a frame view triggers ReadFrameViewData() for the new |
222 | frame. |
223 | @param pFrameView |
224 | The new frame view that replaces the old one. |
225 | */ |
226 | void SetFrameView (FrameView* pFrameView); |
227 | virtual void ReadFrameViewData(FrameView* pView); |
228 | virtual void WriteFrameViewData(); |
229 | void WriteUserData(); |
230 | void ReadUserData(); |
231 | |
232 | virtual bool ActivateObject(SdrOle2Obj* pObj, long nVerb); |
233 | |
234 | /** @returns |
235 | current or selected page or 0. This method |
236 | will fail in master page mode. |
237 | |
238 | @deprecated, please use getCurrentPage(); |
239 | */ |
240 | virtual SdPage* GetActualPage() = 0; |
241 | |
242 | /** @returns |
243 | current or selected page or 0. |
244 | */ |
245 | virtual SdPage* getCurrentPage() const = 0; |
246 | |
247 | const rtl::Reference<FuPoor>& GetOldFunction() const { return mxOldFunction; } |
248 | bool HasOldFunction() const { return mxOldFunction.is(); } |
249 | const rtl::Reference<FuPoor>& GetCurrentFunction() const { return mxCurrentFunction; } |
250 | bool HasCurrentFunction( sal_uInt16 nSID ) { return mxCurrentFunction.is() && (mxCurrentFunction->GetSlotID() == nSID ); } |
251 | bool HasCurrentFunction() const { return mxCurrentFunction.is(); } |
252 | |
253 | void SetCurrentFunction(const rtl::Reference<FuPoor>& xFunction); |
254 | void SetOldFunction(const rtl::Reference<FuPoor>& xFunction); |
255 | void DeactivateCurrentFunction( bool bPermanent = false ); |
256 | |
257 | void SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize, |
258 | long nLeft, long nRight, long nUpper, long nLower, |
259 | bool bScaleAll, Orientation eOrient, sal_uInt16 nPaperBin, |
260 | bool bBackgroundFullSize ); |
261 | |
262 | void SetStartShowWithDialog( bool bIn ) { mbStartShowWithDialog = bIn; } |
263 | bool IsStartShowWithDialog() const { return mbStartShowWithDialog; } |
264 | |
265 | sal_uInt16 GetPrintedHandoutPageNum() const { return mnPrintedHandoutPageNum; } |
266 | void SetPrintedHandoutPageNum (sal_uInt16 nPageNumber) {mnPrintedHandoutPageNum=nPageNumber; } |
267 | |
268 | sal_uInt16 GetPrintedHandoutPageCount() const { return mnPrintedHandoutPageCount; } |
269 | void SetPrintedHandoutPageCount (sal_uInt16 nPageCount) {mnPrintedHandoutPageCount=nPageCount; } |
270 | |
271 | virtual bool PrepareClose( bool bUI = true ); |
272 | |
273 | void GetMenuState(SfxItemSet& rSet); |
274 | |
275 | virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper, |
276 | ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ); |
277 | virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper, |
278 | ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ); |
279 | |
280 | virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ); |
281 | virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ); |
282 | |
283 | /** this method is called when the visible area of the view from this viewshell is changed */ |
284 | virtual void VisAreaChanged(const ::tools::Rectangle& rRect); |
285 | |
286 | /** Create an accessible object representing the specified window. |
287 | Override this method to provide view mode specific objects. The |
288 | default implementation returns an empty reference. |
289 | @param pWindow |
290 | Make the document displayed in this window accessible. |
291 | @return |
292 | This default implementation returns an empty reference. |
293 | */ |
294 | virtual css::uno::Reference<css::accessibility::XAccessible> |
295 | CreateAccessibleDocumentView (::sd::Window* pWindow); |
296 | |
297 | virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc ); |
298 | void SwitchActiveViewFireFocus( ); |
299 | // Move these two methods from DrawViewShell to enable slide show view |
300 | void NotifyAccUpdate(); |
301 | void fireSwitchCurrentPage(sal_Int32 pageIndex); |
302 | void SetWinViewPos(const Point& rWinPos); |
303 | Point const & GetWinViewPos() const; |
304 | Point const & GetViewOrigin() const; |
305 | |
306 | /** Return the window updater of this view shell. |
307 | @return |
308 | In rare circumstances the returned pointer may be <null/>, |
309 | i.e. when no memory is available anymore. |
310 | */ |
311 | ::sd::WindowUpdater* GetWindowUpdater() const; |
312 | |
313 | /** Return the border that is drawn around the actual document view. |
314 | The border contains typically rulers and scroll bars. |
315 | */ |
316 | SvBorder GetBorder(); |
317 | |
318 | /** Notify the view shell that its parent window has been resized. |
319 | The ViewShell places and resizes its UI elements accordingly. |
320 | The new size can be obtained from the parent window. |
321 | */ |
322 | virtual void Resize(); |
323 | |
324 | /** Set position and size of the GUI elements that are controlled by |
325 | the view shell like rulers and scroll bars as well as the actual |
326 | document view according to the position and size that were given |
327 | with the last Resize() call. |
328 | */ |
329 | virtual void ArrangeGUIElements(); |
330 | |
331 | // virtual void OuterResizePixel(const Point &rPos, const Size &rSize); |
332 | // virtual void InnerResizePixel(const Point &rPos, const Size &rSize); |
333 | |
334 | // Exported for unit test |
335 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) ViewShellBase& GetViewShellBase() const; |
336 | |
337 | /** Return <TRUE/> when the called view shell is the main sub shell of |
338 | its ViewShellBase object, i.e. is display in the center pane. This |
339 | convenience function is equivalent to comparing the this pointer to |
340 | the result of ViewShellBase::GetViewShell(PT_CENTER). |
341 | */ |
342 | bool IsMainViewShell() const; |
343 | |
344 | /** Set or reset the flag that indicates whether the called shell is the |
345 | one displayed in the center pane. By default this flag is set to |
346 | <FALSE/>. For the main view shell it thus has to be set to <TRUE/>. |
347 | */ |
348 | void SetIsMainViewShell (bool bIsMainViewShell); |
349 | |
350 | /** Return a sub controller that implements the view shell specific |
351 | part of the DrawController. |
352 | */ |
353 | virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() = 0; |
354 | |
355 | /** Return the type of the shell. |
356 | */ |
357 | SD_DLLPUBLIC__attribute__ ((visibility("default"))) ShellType GetShellType() const; //Export for unit test |
358 | |
359 | /** This method is more or less an alias to Deactivate(). It is called |
360 | before an object of this class is taken from the stack of view |
361 | shells. |
362 | |
363 | <p>When this method is not called before a view shell is taken from |
364 | a stack then the Deactivate() call from the SFX as a response to |
365 | RemoveSubShell() comes too late when the view shell is not on the |
366 | stack anymore.</p> |
367 | */ |
368 | virtual void Shutdown(); |
369 | |
370 | /** This function is called from the underlying ViewShellBase |
371 | object to handle a verb execution request. |
372 | */ |
373 | virtual ErrCode DoVerb (long nVerb); |
374 | |
375 | virtual void UIActivating( SfxInPlaceClient* ); |
376 | virtual void UIDeactivated( SfxInPlaceClient* ); |
377 | |
378 | /** Show controls of the UI or hide them, depending on the given flag. |
379 | As a result the border is adapted. |
380 | */ |
381 | virtual void ShowUIControls (bool bVisible); |
382 | bool IsPageFlipMode() const; |
383 | |
384 | /** Set the given window as new parent window. This is not possible for |
385 | all views, so the return value tells the caller if the relocation |
386 | was successful. |
387 | */ |
388 | virtual bool RelocateToParentWindow (vcl::Window* pParentWindow); |
389 | |
390 | /** Depending on the given request create a new page or duplicate an |
391 | existing one. A new page is created behind the given slide. |
392 | @param rRequest |
393 | The request as passed to an Execute() method. Its arguments are |
394 | evaluated. Its slot id determines whether to create or |
395 | duplicate a slide. |
396 | @param pPage |
397 | This page is either duplicated or becomes the predecessor of the |
398 | new slide. If NULL a duplication request is ignored. A new |
399 | slide is inserted as first slide. |
400 | @param nInsertPosition |
401 | When -1 (the default) then insert after pPage. Otherwise insert |
402 | before the given index (of a standard page). |
403 | @return |
404 | The new slide is returned. If for some reason a new page can |
405 | not be created then NULL is returned. |
406 | */ |
407 | virtual SdPage* CreateOrDuplicatePage ( |
408 | SfxRequest& rRequest, |
409 | PageKind ePageKind, |
410 | SdPage* pPage, |
411 | const sal_Int32 nInsertPosition = -1); |
412 | |
413 | /// Allows adjusting the point or mark of the selection to a document coordinate. |
414 | void SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark); |
415 | /// Gets the current selection |
416 | css::uno::Reference<css::datatransfer::XTransferable> GetSelectionTransferrable() const; |
417 | /// Allows starting or ending a graphic move or resize action. |
418 | void SetGraphicMm100Position(bool bStart, const Point& rPosition); |
419 | |
420 | class Implementation; |
421 | |
422 | protected: |
423 | /** must be called in the beginning of each subclass d'tor. |
424 | disposes and clears both current and old function. */ |
425 | void DisposeFunctions(); |
426 | |
427 | friend class ViewShellBase; |
428 | |
429 | /** Window inside the rulers and scroll bars that shows a view of the |
430 | document. |
431 | */ |
432 | |
433 | VclPtr<sd::Window> mpContentWindow; |
434 | |
435 | /// Horizontal scroll bar for the current slide is displayed when needed. |
436 | VclPtr<ScrollBar> mpHorizontalScrollBar; |
437 | /// Vertical scroll bar for whole document is always visible. |
438 | VclPtr<ScrollBar> mpVerticalScrollBar; |
439 | /// Horizontal ruler is not shown by default. |
440 | VclPtr<SvxRuler> mpHorizontalRuler; |
441 | /// Vertical ruler is not shown by default. |
442 | VclPtr<SvxRuler> mpVerticalRuler; |
443 | /// Filler of the little square enclosed by the two scroll bars. |
444 | VclPtr<ScrollBarBox> mpScrollBarBox; |
445 | /// Layer tab bar. |
446 | VclPtr<LayerTabBar> mpLayerTabBar; |
447 | |
448 | /// This flag controls whether the rulers are visible. |
449 | bool mbHasRulers; |
450 | |
451 | /// The active window. |
452 | VclPtr< ::sd::Window> mpActiveWindow; |
453 | ::sd::View* mpView; |
454 | FrameView* mpFrameView; |
455 | |
456 | rtl::Reference<FuPoor> mxCurrentFunction; |
457 | rtl::Reference<FuPoor> mxOldFunction; |
458 | std::unique_ptr<ZoomList> mpZoomList; |
459 | |
460 | Point maViewPos; |
461 | Size maViewSize; |
462 | Size maScrBarWH; |
463 | |
464 | bool mbStartShowWithDialog; // presentation is started by dialog |
465 | sal_uInt16 mnPrintedHandoutPageNum; // Page number of the handout page that is to be printed. |
466 | sal_uInt16 mnPrintedHandoutPageCount; // Page count of the handout pages that are to be printed. |
467 | |
468 | //af bool bPrintDirectSelected; // Print only selected objects in direct print |
469 | //afString sPageRange; // pagerange if selected objects in direct print |
470 | |
471 | /** Area covered by all windows, i.e. the area of the parent window |
472 | without the controls at the borders like rulers, scroll bars, tab |
473 | bar, buttons. |
474 | This rectangle may be set in window coordinates (i.e. pixel values |
475 | relative to the parent window). It is transformed by every call to |
476 | GetAllWindowRectangle() into screen coordinates (relative to the |
477 | upper left corner of the screen. |
478 | */ |
479 | ::tools::Rectangle maAllWindowRectangle; |
480 | |
481 | /// The type of the shell. Returned by GetShellType(). |
482 | ShellType meShellType; |
483 | |
484 | std::unique_ptr<Implementation, o3tl::default_delete<Implementation>> mpImpl; |
485 | |
486 | // Support methods for centralized UNDO/REDO |
487 | virtual SfxUndoManager* ImpGetUndoManager() const; |
488 | void ImpGetUndoStrings(SfxItemSet &rSet) const; |
489 | void ImpGetRedoStrings(SfxItemSet &rSet) const; |
490 | void ImpSidUndo(SfxRequest& rReq); |
491 | void ImpSidRedo(SfxRequest& rReq); |
492 | |
493 | DECL_LINK( HScrollHdl, ScrollBar *, void )static void LinkStubHScrollHdl(void *, ScrollBar *); void HScrollHdl (ScrollBar *); |
494 | DECL_LINK( VScrollHdl, ScrollBar *, void )static void LinkStubVScrollHdl(void *, ScrollBar *); void VScrollHdl (ScrollBar *); |
495 | |
496 | // virtual scroll handler, here, derivative classes can add themselves here |
497 | virtual void VirtHScrollHdl(ScrollBar* pHScroll); |
498 | virtual void VirtVScrollHdl(ScrollBar* pVScroll); |
499 | |
500 | // virtual functions ruler handling |
501 | virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin); |
502 | virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin); |
503 | virtual void UpdateHRuler(); |
504 | virtual void UpdateVRuler(); |
505 | |
506 | virtual void Activate(bool IsMDIActivate) override; |
507 | virtual void Deactivate(bool IsMDIActivate) override; |
508 | |
509 | virtual void SetZoomFactor( const Fraction &rZoomX, |
510 | const Fraction &rZoomY ); |
511 | |
512 | /** |
513 | This must be called after the ctor, but before anything else. |
514 | It's the part of construction that is dependent |
515 | on showing the top-level window. |
516 | |
517 | Showing a window with a11y enabled causes various callbacks |
518 | to be triggered. |
519 | |
520 | Due to the "virtual methods are not virtual during constructors" |
521 | problem, this is a disaster to call from the ctor |
522 | |
523 | i.e. construct calls Show, and if a11y is enabled this |
524 | reenters the not-fully constructed object and calls |
525 | CreateAccessibleDocumentView, so if construct is called |
526 | from the ctor then if a derived class is constructed the base-case |
527 | CreateAccessibleDocumentView is used, not the derived |
528 | CreateAccessibleDocumentView. i.e. run smoketest under a11y with |
529 | debugging assertions enabled |
530 | */ |
531 | void doShow(); |
532 | |
533 | private: |
534 | VclPtr<vcl::Window> mpParentWindow; |
535 | /** This window updater is used to keep all relevant windows up to date |
536 | with reference to the digit language used to display digits in text |
537 | shapes. |
538 | */ |
539 | ::std::unique_ptr< ::sd::WindowUpdater> mpWindowUpdater; |
540 | |
541 | /** Code common to all constructors. It generally is a bad idea |
542 | to call this function from outside a constructor. |
543 | */ |
544 | void construct(); |
545 | |
546 | /** Create the rulers. |
547 | */ |
548 | void SetupRulers(); |
549 | }; |
550 | |
551 | SdrView* ViewShell::GetDrawView() const |
552 | { |
553 | return static_cast<SdrView*>(mpView); |
554 | } |
555 | |
556 | } // end of namespace sd |
557 | |
558 | #endif |
559 | |
560 | /* 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_SVDEDXV_HXX |
21 | #define INCLUDED_SVX_SVDEDXV_HXX |
22 | |
23 | #include <rtl/ref.hxx> |
24 | #include <svl/languageoptions.hxx> |
25 | #include <svx/svxdllapi.h> |
26 | #include <svx/svdglev.hxx> |
27 | #include <svx/selectioncontroller.hxx> |
28 | #include <editeng/editview.hxx> |
29 | #include <memory> |
30 | |
31 | class SdrOutliner; |
32 | class OutlinerView; |
33 | class EditStatus; |
34 | class EditFieldInfo; |
35 | class ImpSdrEditPara; |
36 | struct PasteOrDropInfos; |
37 | class SdrUndoManager; |
38 | class TextChainCursorManager; |
39 | |
40 | namespace com::sun::star::uno { |
41 | class Any; |
42 | } |
43 | |
44 | namespace sdr { |
45 | class SelectionController; |
46 | } |
47 | |
48 | enum class SdrEndTextEditKind |
49 | { |
50 | Unchanged, // textobject unchanged |
51 | Changed, // textobject changed |
52 | Deleted, // textobject implicitly deleted |
53 | ShouldBeDeleted // for writer: textobject should be deleted |
54 | }; |
55 | |
56 | // - general edit for objectspecific properties |
57 | // - textedit for all drawobjects, inherited from SdrTextObj |
58 | // - macromode |
59 | |
60 | |
61 | class SVXCORE_DLLPUBLIC__attribute__ ((visibility("default"))) SdrObjEditView : public SdrGlueEditView, public EditViewCallbacks |
62 | { |
63 | friend class SdrPageView; |
64 | friend class ImpSdrEditPara; |
65 | |
66 | // Now derived from EditViewCallbacks and overriding these callbacks to |
67 | // allow own EditText visualization |
68 | virtual void EditViewInvalidate(const tools::Rectangle& rRect) override; |
69 | virtual void EditViewSelectionChange() override; |
70 | virtual OutputDevice& EditViewOutputDevice() const override; |
71 | virtual void EditViewInputContext(const InputContext& rInputContext) override; |
72 | virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override; |
73 | |
74 | // The OverlayObjects used for visualizing active TextEdit (currently |
75 | // using TextEditOverlayObject, but not limited to it |
76 | sdr::overlay::OverlayObjectList maTEOverlayGroup; |
77 | |
78 | protected: |
79 | // TextEdit |
80 | tools::WeakReference<SdrTextObj> |
81 | mxTextEditObj; // current object in TextEdit |
82 | SdrPageView* pTextEditPV; |
83 | std::unique_ptr<SdrOutliner> pTextEditOutliner; // outliner for the TextEdit |
84 | OutlinerView* pTextEditOutlinerView; // current view of the outliners |
85 | VclPtr<vcl::Window> pTextEditWin; // matching window to pTextEditOutlinerView |
86 | vcl::Cursor* pTextEditCursorBuffer; // to restore the cursor in each window |
87 | SdrObject* pMacroObj; |
88 | SdrPageView* pMacroPV; |
89 | VclPtr<vcl::Window> pMacroWin; |
90 | |
91 | tools::Rectangle aTextEditArea; |
92 | tools::Rectangle aMinTextEditArea; |
93 | Link<EditFieldInfo*,void> aOldCalcFieldValueLink; // for call the old handler |
94 | Point aMacroDownPos; |
95 | |
96 | sal_uInt16 nMacroTol; |
97 | |
98 | bool bTextEditDontDelete : 1; // do not delete outliner and view of SdrEndTextEdit (f. spellchecking) |
99 | bool bTextEditOnlyOneView : 1; // a single OutlinerView (f. spellchecking) |
100 | bool bTextEditNewObj : 1; // current edited object was just recreated |
101 | bool bQuickTextEditMode : 1; // persistent(->CrtV). Default=TRUE |
102 | bool bMacroDown : 1; |
103 | |
104 | rtl::Reference< sdr::SelectionController > mxSelectionController; |
105 | rtl::Reference< sdr::SelectionController > mxLastSelectionController; |
106 | |
107 | private: |
108 | SfxUndoManager* mpOldTextEditUndoManager; |
109 | |
110 | protected: |
111 | // central method to get an SdrUndoManager for enhanced TextEdit. Default will |
112 | // try to return a dynamic_casted GetModel()->GetSdrUndoManager(). Applications |
113 | // which want to use this feature will need to override this virtual method, |
114 | // provide their document UndoManager and derive it from SdrUndoManager. |
115 | virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const; |
116 | |
117 | void ImpMoveCursorAfterChainingEvent(TextChainCursorManager *pCursorManager); |
118 | TextChainCursorManager *ImpHandleMotionThroughBoxesKeyInput(const KeyEvent& rKEvt, bool *bOutHandled); |
119 | |
120 | |
121 | OutlinerView* ImpFindOutlinerView(vcl::Window const * pWin) const; |
122 | |
123 | // Create a new OutlinerView at the heap and initialize all required parameters. |
124 | // pTextEditObj, pTextEditPV and pTextEditOutliner have to be initialized |
125 | OutlinerView* ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView, SfxViewShell* pViewShell = nullptr) const; |
126 | void ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::Rectangle& rRect, OutputDevice& rTargetDevice) const; |
127 | void ImpInvalidateOutlinerView(OutlinerView const & rOutlView) const; |
128 | |
129 | // Chaining |
130 | void ImpChainingEventHdl(); |
131 | DECL_LINK(ImpAfterCutOrPasteChainingEventHdl, LinkParamNone*, void)static void LinkStubImpAfterCutOrPasteChainingEventHdl(void * , LinkParamNone*); void ImpAfterCutOrPasteChainingEventHdl(LinkParamNone *); |
132 | |
133 | |
134 | // Check if the whole text is selected. |
135 | // Still returns sal_True if there is no text present. |
136 | bool ImpIsTextEditAllSelected() const; |
137 | void ImpMakeTextCursorAreaVisible(); |
138 | |
139 | // handler for AutoGrowing text with active Outliner |
140 | DECL_LINK(ImpOutlinerStatusEventHdl, EditStatus&, void)static void LinkStubImpOutlinerStatusEventHdl(void *, EditStatus &); void ImpOutlinerStatusEventHdl(EditStatus&); |
141 | DECL_LINK(ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, void)static void LinkStubImpOutlinerCalcFieldValueHdl(void *, EditFieldInfo *); void ImpOutlinerCalcFieldValueHdl(EditFieldInfo*); |
142 | |
143 | // link for EndTextEditHdl |
144 | DECL_LINK(EndTextEditHdl, SdrUndoManager*, void)static void LinkStubEndTextEditHdl(void *, SdrUndoManager*); void EndTextEditHdl(SdrUndoManager*); |
145 | |
146 | void ImpMacroUp(const Point& rUpPos); |
147 | void ImpMacroDown(const Point& rDownPos); |
148 | |
149 | DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos*, void )static void LinkStubBeginPasteOrDropHdl(void *, PasteOrDropInfos *); void BeginPasteOrDropHdl(PasteOrDropInfos*); |
150 | DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos*, void )static void LinkStubEndPasteOrDropHdl(void *, PasteOrDropInfos *); void EndPasteOrDropHdl(PasteOrDropInfos*); |
151 | |
152 | protected: |
153 | // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView |
154 | SdrObjEditView( |
155 | SdrModel& rSdrModel, |
156 | OutputDevice* pOut); |
157 | |
158 | virtual ~SdrObjEditView() override; |
159 | |
160 | public: |
161 | |
162 | // used to call the old ImpPaintOutlinerView. Will be replaced when the |
163 | // outliner will be displayed on the overlay in edit mode. |
164 | void TextEditDrawing(SdrPaintWindow& rPaintWindow); |
165 | |
166 | // Actionhandling for macromode |
167 | virtual bool IsAction() const override; |
168 | virtual void MovAction(const Point& rPnt) override; |
169 | virtual void EndAction() override; |
170 | virtual void BrkAction() override; |
171 | virtual void BckAction() override; |
172 | virtual void TakeActionRect(tools::Rectangle& rRect) const override; |
173 | |
174 | SdrPageView* ShowSdrPage(SdrPage* pPage) override; |
175 | void HideSdrPage() override; |
176 | |
177 | virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; |
178 | virtual void ModelHasChanged() override; |
179 | |
180 | |
181 | // TextEdit over an outliner |
182 | |
183 | // QuickTextEditMode = edit the text straight after selection. Default=TRUE. Persistent. |
184 | void SetQuickTextEditMode(bool bOn) { bQuickTextEditMode=bOn; } |
185 | bool IsQuickTextEditMode() const { return bQuickTextEditMode; } |
186 | |
187 | // Start the TextEditMode. If pWin==NULL, use the first window, which is logged at the View. |
188 | // The cursor of the currently edited window is stored with SdrBeginTextEdit() |
189 | // and restored with SdrEndTextEdit(). |
190 | // The app has to ensure, that the BegEdit of the window logged cursor is still valid, |
191 | // when SdrEndTextEdit is called. |
192 | // With the parameter pEditOutliner, the app has the possibility to specify his own outliner, |
193 | // which is used for editing. After the SdrBeginTextEdit call, the outliner belongs to |
194 | // SdrObjEditView, and is also later destroyed by this via delete (if bDontDeleteOutliner=sal_False). |
195 | // Afterwards the SdrObjEditView sets the modflag (EditEngine/Outliner) at this instance and also the |
196 | // StatusEventHdl. |
197 | // Similarly a specific OutlinerView can be specified. |
198 | |
199 | virtual bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = nullptr, vcl::Window* pWin = nullptr, bool bIsNewObj = false, |
200 | SdrOutliner* pGivenOutliner = nullptr, OutlinerView* pGivenOutlinerView = nullptr, |
201 | bool bDontDeleteOutliner = false, bool bOnlyOneView = false, bool bGrabFocus = true); |
202 | // bDontDeleteReally is a special parameter for writer |
203 | // If this flag is set, then a maybe empty textobject is not deleted. |
204 | // Instead you get a return code SdrEndTextEditKind::ShouldBeDeleted |
205 | // (in place of SDRENDTEXTEDIT_BEDELETED), which says, the obj should be |
206 | // deleted. |
207 | virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally = false); |
208 | virtual bool IsTextEdit() const final override; |
209 | |
210 | // This method returns sal_True, if the point rHit is inside the |
211 | // objectspace or the OutlinerView. |
212 | bool IsTextEditHit(const Point& rHit) const; |
213 | |
214 | // This method returns sal_True, if the point rHit is inside the |
215 | // handle-thick frame, which surrounds the OutlinerView at TextFrames. |
216 | bool IsTextEditFrameHit(const Point& rHit) const; |
217 | |
218 | // At active selection, between MouseButtonDown and |
219 | // MouseButtonUp, this method always returns TRUE. |
220 | bool IsTextEditInSelectionMode() const; |
221 | |
222 | // If sb needs the object out of the TextEdit: |
223 | SdrTextObj* GetTextEditObject() const { return mxTextEditObj.get(); } |
224 | |
225 | // info about TextEditPageView. Default is 0L. |
226 | SdrPageView* GetTextEditPageView() const; |
227 | |
228 | // Current window of the outliners. |
229 | void SetTextEditWin(vcl::Window* pWin); |
230 | |
231 | // Now at this outliner, events can be send, attributes can be set, |
232 | // call Cut/Copy/Paste, call Undo/Redo, and so on... |
233 | const SdrOutliner* GetTextEditOutliner() const { return pTextEditOutliner.get(); } |
234 | SdrOutliner* GetTextEditOutliner() { return pTextEditOutliner.get(); } |
235 | const OutlinerView* GetTextEditOutlinerView() const { return pTextEditOutlinerView; } |
236 | OutlinerView* GetTextEditOutlinerView() { return pTextEditOutlinerView; } |
237 | |
238 | virtual bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override; |
239 | virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override; |
240 | virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override; |
241 | virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; |
242 | virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override; |
243 | |
244 | // #97766# make virtual to change implementation e.g. for SdOutlineView |
245 | virtual SvtScriptType GetScriptType() const; |
246 | |
247 | /* new interface src537 */ |
248 | void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const; |
249 | |
250 | bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll); |
251 | SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const; |
252 | void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr); |
253 | |
254 | // Intern: at mounting new OutlinerView... |
255 | virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow) override; |
256 | virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin) override; |
257 | |
258 | sal_uInt16 GetSelectionLevel() const; |
259 | |
260 | |
261 | // Object MacroMode (e.g. rect as button or sth. like that): |
262 | |
263 | void BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin); |
264 | void BegMacroObj(const Point& rPnt, SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin) { BegMacroObj(rPnt,-2,pObj,pPV,pWin); } |
265 | void MovMacroObj(const Point& rPnt); |
266 | void BrkMacroObj(); |
267 | bool EndMacroObj(); |
268 | bool IsMacroObj() const { return pMacroObj!=nullptr; } |
269 | |
270 | /** fills the given any with a XTextCursor for the current text selection. |
271 | Leaves the any untouched if there currently is no text selected */ |
272 | void getTextSelection( css::uno::Any& rSelection ); |
273 | |
274 | virtual void MarkListHasChanged() override; |
275 | |
276 | const rtl::Reference< sdr::SelectionController >& getSelectionController() const { return mxSelectionController; } |
277 | |
278 | /** returns true if the shape identified by its inventor and identifier supports format paint brush operation */ |
279 | static bool SupportsFormatPaintbrush( SdrInventor nObjectInventor, sal_uInt16 nObjectIdentifier ); |
280 | |
281 | /** returns a format paint brush set from the current selection */ |
282 | void TakeFormatPaintBrush( std::shared_ptr< SfxItemSet >& rFormatSet ); |
283 | |
284 | /** applies a format paint brush set from the current selection. |
285 | if bNoCharacterFormats is true, no character attributes are changed. |
286 | if bNoParagraphFormats is true, no paragraph attributes are changed. |
287 | */ |
288 | void ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); |
289 | |
290 | /** helper function for selections with multiple SdrText for one SdrTextObj (f.e. tables ) */ |
291 | static void ApplyFormatPaintBrushToText( SfxItemSet const & rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats ); |
292 | |
293 | protected: |
294 | virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ); |
295 | virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ); |
296 | |
297 | }; |
298 | |
299 | #endif // INCLUDED_SVX_SVDEDXV_HXX |
300 | |
301 | /* 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_TOOLS_WEAKBASE_HXX |
21 | #define INCLUDED_TOOLS_WEAKBASE_HXX |
22 | |
23 | #include <tools/weakbase.h> |
24 | |
25 | /// see weakbase.h for documentation |
26 | |
27 | namespace tools |
28 | { |
29 | |
30 | template< class reference_type > |
31 | inline WeakReference< reference_type >::WeakReference() |
32 | { |
33 | mpWeakConnection = new WeakConnection; |
34 | } |
35 | |
36 | template< class reference_type > |
37 | inline WeakReference< reference_type >::WeakReference( reference_type* pReference ) |
38 | { |
39 | reset( pReference ); |
40 | } |
41 | |
42 | template< class reference_type > |
43 | inline WeakReference< reference_type >::WeakReference( const WeakReference< reference_type >& rWeakRef ) |
44 | { |
45 | mpWeakConnection = rWeakRef.mpWeakConnection; |
46 | } |
47 | |
48 | template< class reference_type > |
49 | inline WeakReference< reference_type >::WeakReference( WeakReference< reference_type >&& rWeakRef ) |
50 | { |
51 | mpWeakConnection = std::move(rWeakRef.mpWeakConnection); |
52 | rWeakRef.reset(); |
53 | } |
54 | |
55 | template< class reference_type > |
56 | inline bool WeakReference< reference_type >::is() const |
57 | { |
58 | return mpWeakConnection->mpReference != nullptr; |
59 | } |
60 | |
61 | template< class reference_type > |
62 | inline reference_type * WeakReference< reference_type >::get() const |
63 | { |
64 | auto pWeakBase = mpWeakConnection->mpReference; |
65 | if (!pWeakBase) |
66 | return nullptr; |
67 | assert(dynamic_cast<reference_type *>(pWeakBase))(static_cast <bool> (dynamic_cast<reference_type *> (pWeakBase)) ? void (0) : __assert_fail ("dynamic_cast<reference_type *>(pWeakBase)" , "/home/maarten/src/libreoffice/core/include/tools/weakbase.hxx" , 67, __extension__ __PRETTY_FUNCTION__)); |
68 | return static_cast<reference_type *>(pWeakBase); |
69 | } |
70 | |
71 | template< class reference_type > |
72 | inline void WeakReference< reference_type >::reset( reference_type* pReference ) |
73 | { |
74 | if( pReference ) |
75 | mpWeakConnection = pReference->getWeakConnection(); |
76 | else |
77 | reset(); |
78 | } |
79 | |
80 | template< class reference_type > |
81 | inline void WeakReference< reference_type >::reset() |
82 | { |
83 | mpWeakConnection = new WeakConnection; |
84 | } |
85 | |
86 | template< class reference_type > |
87 | inline reference_type * WeakReference< reference_type >::operator->() const |
88 | { |
89 | return get(); |
90 | } |
91 | |
92 | template< class reference_type > |
93 | inline reference_type& WeakReference< reference_type >::operator*() const |
94 | { |
95 | return *get(); |
96 | } |
97 | |
98 | template< class reference_type > |
99 | inline bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const |
100 | { |
101 | return mpWeakConnection->mpReference == pReferenceObject; |
102 | } |
103 | |
104 | template< class reference_type > |
105 | inline bool WeakReference< reference_type >::operator==(const WeakReference<reference_type> & handle) const |
106 | { |
107 | return mpWeakConnection == handle.mpWeakConnection; |
108 | } |
109 | |
110 | template< class reference_type > |
111 | inline bool WeakReference< reference_type >::operator!=(const WeakReference<reference_type> & handle) const |
112 | { |
113 | return mpWeakConnection != handle.mpWeakConnection; |
114 | } |
115 | |
116 | template< class reference_type > |
117 | inline bool WeakReference< reference_type >::operator<(const WeakReference<reference_type> & handle) const |
118 | { |
119 | return mpWeakConnection->mpReference < handle.mpWeakConnection->mpReference; |
120 | } |
121 | |
122 | template< class reference_type > |
123 | inline bool WeakReference< reference_type >::operator>(const WeakReference<reference_type> & handle) const |
124 | { |
125 | return mpWeakConnection->mpReference > handle.mpWeakConnection->mpReference; |
126 | } |
127 | |
128 | template< class reference_type > |
129 | inline WeakReference<reference_type>& WeakReference<reference_type>::operator= ( |
130 | const WeakReference<reference_type>& rReference) |
131 | { |
132 | if (&rReference != this) |
133 | mpWeakConnection = rReference.mpWeakConnection; |
134 | return *this; |
135 | } |
136 | |
137 | template< class reference_type > |
138 | inline WeakReference<reference_type>& WeakReference<reference_type>::operator= ( |
139 | WeakReference<reference_type>&& rReference) |
140 | { |
141 | mpWeakConnection = std::move(rReference.mpWeakConnection); |
142 | return *this; |
143 | } |
144 | |
145 | inline void WeakBase::clearWeak() |
146 | { |
147 | if( mpWeakConnection.is() ) |
148 | mpWeakConnection->mpReference = nullptr; |
149 | } |
150 | |
151 | inline WeakConnection* WeakBase::getWeakConnection() |
152 | { |
153 | if( !mpWeakConnection.is() ) |
154 | mpWeakConnection = new WeakConnection( this ); |
155 | return mpWeakConnection.get(); |
156 | } |
157 | |
158 | } |
159 | |
160 | #endif |
161 | |
162 | /* 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_COMMANDEVENT_HXX |
21 | #define INCLUDED_VCL_COMMANDEVENT_HXX |
22 | |
23 | #include <memory> |
24 | #include <tools/gen.hxx> |
25 | #include <tools/solar.h> |
26 | #include <vcl/dllapi.h> |
27 | #include <vcl/keycodes.hxx> |
28 | #include <o3tl/typed_flags_set.hxx> |
29 | #include <rtl/ustring.hxx> |
30 | #include <vcl/GestureEvent.hxx> |
31 | |
32 | class CommandExtTextInputData; |
33 | class CommandWheelData; |
34 | class CommandScrollData; |
35 | class CommandModKeyData; |
36 | class CommandDialogData; |
37 | class CommandMediaData; |
38 | class CommandSelectionChangeData; |
39 | class CommandSwipeData; |
40 | class CommandLongPressData; |
41 | class CommandGestureData; |
42 | |
43 | enum class CommandEventId; |
44 | |
45 | enum class ExtTextInputAttr { |
46 | NONE = 0x0000, |
47 | GrayWaveline = 0x0100, |
48 | Underline = 0x0200, |
49 | BoldUnderline = 0x0400, |
50 | DottedUnderline = 0x0800, |
51 | DashDotUnderline = 0x1000, |
52 | Highlight = 0x2000, |
53 | RedText = 0x4000, |
54 | HalfToneText = 0x8000 |
55 | }; |
56 | namespace o3tl |
57 | { |
58 | template<> struct typed_flags<ExtTextInputAttr> : is_typed_flags<ExtTextInputAttr, 0xff00> {}; |
59 | } |
60 | |
61 | #define EXTTEXTINPUT_CURSOR_INVISIBLE(sal_uInt16(0x0001)) (sal_uInt16(0x0001)) |
62 | #define EXTTEXTINPUT_CURSOR_OVERWRITE(sal_uInt16(0x0002)) (sal_uInt16(0x0002)) |
63 | |
64 | |
65 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandEvent |
66 | { |
67 | private: |
68 | Point maPos; |
69 | void* mpData; |
70 | CommandEventId mnCommand; |
71 | bool mbMouseEvent; |
72 | |
73 | public: |
74 | CommandEvent(); |
75 | CommandEvent( const Point& rMousePos, CommandEventId nCmd, |
76 | bool bMEvt = false, const void* pCmdData = nullptr ); |
77 | |
78 | CommandEventId GetCommand() const { return mnCommand; } |
79 | const Point& GetMousePosPixel() const { return maPos; } |
80 | bool IsMouseEvent() const { return mbMouseEvent; } |
81 | void* GetEventData() const { return mpData; } |
82 | |
83 | const CommandExtTextInputData* GetExtTextInputData() const; |
84 | const CommandWheelData* GetWheelData() const; |
85 | const CommandScrollData* GetAutoScrollData() const; |
86 | const CommandModKeyData* GetModKeyData() const; |
87 | const CommandDialogData* GetDialogData() const; |
88 | CommandMediaData* GetMediaData() const; |
89 | const CommandSelectionChangeData* GetSelectionChangeData() const; |
90 | const CommandSwipeData* GetSwipeData() const; |
91 | const CommandLongPressData* GetLongPressData() const; |
92 | const CommandGestureData* GetGestureData() const; |
93 | }; |
94 | |
95 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandExtTextInputData |
96 | { |
97 | private: |
98 | OUString maText; |
99 | std::unique_ptr<ExtTextInputAttr[]> mpTextAttr; |
100 | sal_Int32 mnCursorPos; |
101 | sal_uInt16 mnCursorFlags; |
102 | bool mbOnlyCursor; |
103 | |
104 | public: |
105 | CommandExtTextInputData( const OUString& rText, |
106 | const ExtTextInputAttr* pTextAttr, |
107 | sal_Int32 nCursorPos, |
108 | sal_uInt16 nCursorFlags, |
109 | bool bOnlyCursor ); |
110 | CommandExtTextInputData( const CommandExtTextInputData& rData ); |
111 | ~CommandExtTextInputData(); |
112 | |
113 | const OUString& GetText() const { return maText; } |
114 | const ExtTextInputAttr* GetTextAttr() const { return mpTextAttr.get(); } |
115 | |
116 | sal_Int32 GetCursorPos() const { return mnCursorPos; } |
117 | bool IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE(sal_uInt16(0x0001))) == 0; } |
118 | bool IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE(sal_uInt16(0x0002))) != 0; } |
119 | bool IsOnlyCursorChanged() const { return mbOnlyCursor; } |
120 | }; |
121 | |
122 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandInputContextData |
123 | { |
124 | }; |
125 | |
126 | enum class CommandWheelMode |
127 | { |
128 | NONE = 0, |
129 | SCROLL = 1, |
130 | ZOOM = 2, |
131 | DATAZOOM = 3 |
132 | }; |
133 | |
134 | // Magic value used in mnLines field in CommandWheelData |
135 | #define COMMAND_WHEEL_PAGESCROLL(sal_uLong(0xFFFFFFFF)) (sal_uLong(0xFFFFFFFF)) |
136 | |
137 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandWheelData |
138 | { |
139 | private: |
140 | long mnDelta; |
141 | long mnNotchDelta; |
142 | double mnLines; |
143 | CommandWheelMode mnWheelMode; |
144 | sal_uInt16 mnCode; |
145 | bool mbHorz; |
146 | bool mbDeltaIsPixel; |
147 | |
148 | public: |
149 | CommandWheelData(); |
150 | CommandWheelData( long nWheelDelta, long nWheelNotchDelta, |
151 | double nScrollLines, |
152 | CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier, |
153 | bool bHorz, bool bDeltaIsPixel = false ); |
154 | |
155 | long GetDelta() const { return mnDelta; } |
156 | long GetNotchDelta() const { return mnNotchDelta; } |
157 | double GetScrollLines() const { return mnLines; } |
158 | bool IsHorz() const { return mbHorz; } |
159 | bool IsDeltaPixel() const { return mbDeltaIsPixel; } |
160 | |
161 | CommandWheelMode GetMode() const { return mnWheelMode; } |
162 | |
163 | sal_uInt16 GetModifier() const |
164 | { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); } |
165 | bool IsShift() const |
166 | { return ((mnCode & KEY_SHIFT) != 0); } |
167 | bool IsMod1() const |
168 | { return ((mnCode & KEY_MOD1) != 0); } |
169 | bool IsMod2() const |
170 | { return ((mnCode & KEY_MOD2) != 0); } |
171 | }; |
172 | |
173 | class CommandScrollData |
174 | { |
175 | private: |
176 | long mnDeltaX; |
177 | long mnDeltaY; |
178 | |
179 | public: |
180 | CommandScrollData( long nDeltaX, long nDeltaY ); |
181 | |
182 | long GetDeltaX() const { return mnDeltaX; } |
183 | long GetDeltaY() const { return mnDeltaY; } |
184 | }; |
185 | |
186 | class CommandModKeyData |
187 | { |
188 | private: |
189 | bool mbDown; |
190 | ModKeyFlags mnCode; |
191 | |
192 | public: |
193 | CommandModKeyData( ModKeyFlags nCode, bool bDown ); |
194 | |
195 | bool IsDown() const { return mbDown; } |
196 | bool IsMod1() const { return bool(mnCode & ModKeyFlags::Mod1Msk); } |
197 | bool IsMod2() const { return bool(mnCode & ModKeyFlags::Mod2Msk); } |
198 | bool IsLeftShift() const { return bool(mnCode & ModKeyFlags::LeftShift); } |
199 | bool IsRightShift() const { return bool(mnCode & ModKeyFlags::RightShift); } |
200 | }; |
201 | |
202 | enum class ShowDialogId |
203 | { |
204 | Preferences = 1, |
205 | About = 2, |
206 | }; |
207 | |
208 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandDialogData |
209 | { |
210 | ShowDialogId m_nDialogId; |
211 | public: |
212 | CommandDialogData( ShowDialogId nDialogId ) |
213 | : m_nDialogId( nDialogId ) |
214 | {} |
215 | |
216 | ShowDialogId GetDialogId() const { return m_nDialogId; } |
217 | }; |
218 | |
219 | // Media Commands |
220 | enum class MediaCommand |
221 | { |
222 | ChannelDown = 1, // Decrement the channel value, for example, for a TV or radio tuner. |
223 | ChannelUp = 2, // Increment the channel value, for example, for a TV or radio tuner. |
224 | NextTrack = 3, // Go to next media track/slide. |
225 | Pause = 4, // Pause. If already paused, take no further action. This is a direct PAUSE command that has no state. |
226 | Play = 5, // Begin playing at the current position. If already paused, it will resume. This is a direct PLAY command that has no state. |
227 | PlayPause = 6, // Play or pause playback. |
228 | PreviousTrack = 7, // Go to previous media track/slide. |
229 | Record = 8, // Begin recording the current stream. |
230 | Rewind = 9,// Go backward in a stream at a higher rate of speed. |
231 | Stop = 10,// Stop playback. |
232 | MicOnOffToggle = 11,// Toggle the microphone. |
233 | MicrophoneVolumeDown = 12,// Increase microphone volume. |
234 | MicrophoneVolumeMute = 13,// Mute the microphone. |
235 | MicrophoneVolumeUp = 14,// Decrease microphone volume. |
236 | VolumeDown = 15,// Lower the volume. |
237 | VolumeMute = 16,// Mute the volume. |
238 | VolumeUp = 17,// Raise the volume. |
239 | Menu = 18,// Button Menu pressed. |
240 | PlayHold = 20,// Button Play (long) pressed. |
241 | NextTrackHold = 21,// Button Right holding pressed. |
242 | }; |
243 | |
244 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandMediaData |
245 | { |
246 | MediaCommand m_nMediaId; |
247 | bool m_bPassThroughToOS; |
248 | public: |
249 | CommandMediaData(MediaCommand nMediaId) |
250 | : m_nMediaId(nMediaId) |
251 | , m_bPassThroughToOS(true) |
252 | { |
253 | } |
254 | MediaCommand GetMediaId() const { return m_nMediaId; } |
255 | void SetPassThroughToOS(bool bPassThroughToOS) { m_bPassThroughToOS = bPassThroughToOS; } |
256 | bool GetPassThroughToOS() const { return m_bPassThroughToOS; } |
257 | }; |
258 | |
259 | class CommandSelectionChangeData |
260 | { |
261 | private: |
262 | sal_uLong mnStart; |
263 | sal_uLong mnEnd; |
264 | |
265 | public: |
266 | CommandSelectionChangeData( sal_uLong nStart, sal_uLong nEnd ); |
267 | |
268 | sal_uLong GetStart() const { return mnStart; } |
269 | sal_uLong GetEnd() const { return mnEnd; } |
270 | }; |
271 | |
272 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandSwipeData |
273 | { |
274 | double mnVelocityX; |
275 | public: |
276 | CommandSwipeData() |
277 | : mnVelocityX(0) |
278 | { |
279 | } |
280 | CommandSwipeData(double nVelocityX) |
281 | : mnVelocityX(nVelocityX) |
282 | { |
283 | } |
284 | double getVelocityX() const { return mnVelocityX; } |
285 | }; |
286 | |
287 | |
288 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandLongPressData |
289 | { |
290 | double mnX; |
291 | double mnY; |
292 | public: |
293 | CommandLongPressData() |
294 | : mnX(0) |
295 | , mnY(0) |
296 | { |
297 | } |
298 | CommandLongPressData(double nX, double nY) |
299 | : mnX(nX) |
300 | , mnY(nY) |
301 | { |
302 | } |
303 | double getX() const { return mnX; } |
304 | double getY() const { return mnY; } |
305 | }; |
306 | |
307 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) CommandGestureData |
308 | { |
309 | public: |
310 | double const mfX; |
311 | double const mfY; |
312 | GestureEventType const meEventType; |
313 | |
314 | double const mfOffset; |
315 | PanningOrientation const meOrientation; |
316 | |
317 | CommandGestureData(double fX, double fY, GestureEventType eEventType, double fOffset, PanningOrientation eOrientation) |
318 | : mfX(fX) |
319 | , mfY(fY) |
320 | , meEventType(eEventType) |
321 | , mfOffset(fOffset) |
322 | , meOrientation(eOrientation) |
323 | {} |
324 | }; |
325 | |
326 | enum class CommandEventId |
327 | { |
328 | NONE = 0, |
329 | ContextMenu = 1, |
330 | StartDrag = 2, |
331 | Wheel = 3, |
332 | StartAutoScroll = 4, |
333 | AutoScroll = 5, |
334 | StartExtTextInput = 7, |
335 | ExtTextInput = 8, |
336 | EndExtTextInput = 9, |
337 | InputContextChange = 10, |
338 | CursorPos = 11, |
339 | PasteSelection = 12, |
340 | ModKeyChange = 13, |
341 | InputLanguageChange = 15, |
342 | ShowDialog = 16, |
343 | Media = 17, |
344 | SelectionChange = 18, |
345 | PrepareReconversion = 19, |
346 | QueryCharPosition = 20, |
347 | Swipe = 21, |
348 | LongPress = 22, |
349 | Gesture = 23, |
350 | }; |
351 | |
352 | #endif // INCLUDED_VCL_COMMANDEVENT_HXX |
353 | |
354 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |