/src/libreoffice/sd/source/ui/view/drviews3.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #include <config_features.h> |
21 | | |
22 | | #include <DrawViewShell.hxx> |
23 | | #include <DrawController.hxx> |
24 | | |
25 | | #include <sfx2/viewfrm.hxx> |
26 | | #include <editeng/eeitem.hxx> |
27 | | #include <editeng/tstpitem.hxx> |
28 | | #include <editeng/lrspitem.hxx> |
29 | | #include <editeng/protitem.hxx> |
30 | | #include <editeng/frmdiritem.hxx> |
31 | | #include <editeng/adjustitem.hxx> |
32 | | #include <svx/svdotable.hxx> |
33 | | #include <editeng/numitem.hxx> |
34 | | #include <svx/rulritem.hxx> |
35 | | #include <svx/svxids.hrc> |
36 | | #include <svx/svdpagv.hxx> |
37 | | #include <sfx2/request.hxx> |
38 | | #include <sfx2/dispatch.hxx> |
39 | | #include <tools/urlobj.hxx> |
40 | | #include <svl/eitem.hxx> |
41 | | #include <svl/rectitem.hxx> |
42 | | #include <svl/stritem.hxx> |
43 | | #include <svx/svdoole2.hxx> |
44 | | #include <svl/itempool.hxx> |
45 | | #include <svl/ptitem.hxx> |
46 | | #include <basic/sbstar.hxx> |
47 | | #include <basic/sberrors.hxx> |
48 | | #include <svx/fmshell.hxx> |
49 | | #include <svx/f3dchild.hxx> |
50 | | #include <svx/float3d.hxx> |
51 | | #include <svx/sdmetitm.hxx> |
52 | | #include <svx/svdogrp.hxx> |
53 | | #include <svx/diagram/IDiagramHelper.hxx> |
54 | | |
55 | | #include <app.hrc> |
56 | | #include <strings.hrc> |
57 | | |
58 | | #include <sdundogr.hxx> |
59 | | #include <undopage.hxx> |
60 | | #include <fupoor.hxx> |
61 | | #include <slideshow.hxx> |
62 | | #include <sdpage.hxx> |
63 | | #include <Window.hxx> |
64 | | #include <sdresid.hxx> |
65 | | #include <unokywds.hxx> |
66 | | #include <drawview.hxx> |
67 | | #include <drawdoc.hxx> |
68 | | #include <DrawDocShell.hxx> |
69 | | #include <sdabstdlg.hxx> |
70 | | #include <sfx2/ipclient.hxx> |
71 | | #include <comphelper/diagnose_ex.hxx> |
72 | | #include <ViewShellBase.hxx> |
73 | | #include <FormShellManager.hxx> |
74 | | #include <LayerTabBar.hxx> |
75 | | #include <framework/ConfigurationController.hxx> |
76 | | #include <framework/Configuration.hxx> |
77 | | #include <com/sun/star/drawing/XShape.hpp> |
78 | | #include <com/sun/star/frame/XFrame.hpp> |
79 | | #include <editeng/lspcitem.hxx> |
80 | | #include <editeng/ulspitem.hxx> |
81 | | #include <memory> |
82 | | #include <comphelper/processfactory.hxx> |
83 | | #include <oox/drawingml/diagram/diagram.hxx> |
84 | | #include <oox/export/drawingml.hxx> |
85 | | #include <oox/shape/ShapeFilterBase.hxx> |
86 | | |
87 | | using namespace ::com::sun::star::uno; |
88 | | using namespace ::com::sun::star::drawing::framework; |
89 | | using ::com::sun::star::frame::XFrame; |
90 | | using ::com::sun::star::frame::XController; |
91 | | |
92 | | namespace sd { |
93 | | |
94 | | /** |
95 | | * handle SfxRequests for controller |
96 | | */ |
97 | | void DrawViewShell::ExecCtrl(SfxRequest& rReq) |
98 | 0 | { |
99 | | // except a page switch and jumps to bookmarks, nothing is executed during |
100 | | // a slide show |
101 | 0 | if( HasCurrentFunction(SID_PRESENTATION) && |
102 | 0 | rReq.GetSlot() != SID_SWITCHPAGE && |
103 | 0 | rReq.GetSlot() != SID_JUMPTOMARK) |
104 | 0 | return; |
105 | | |
106 | 0 | CheckLineTo (rReq); |
107 | | |
108 | | // End text edit mode for some requests. |
109 | 0 | sal_uInt16 nSlot = rReq.GetSlot(); |
110 | 0 | bool bAllowFocusChange = true; |
111 | 0 | switch (nSlot) |
112 | 0 | { |
113 | 0 | case SID_OUTPUT_QUALITY_COLOR: |
114 | 0 | case SID_OUTPUT_QUALITY_GRAYSCALE: |
115 | 0 | case SID_OUTPUT_QUALITY_BLACKWHITE: |
116 | 0 | case SID_OUTPUT_QUALITY_CONTRAST: |
117 | | // Do nothing. |
118 | 0 | break; |
119 | 0 | case SID_SWITCHPAGE: |
120 | 0 | if (rReq.GetArgs() && rReq.GetArgs()->Count () == 1) |
121 | 0 | { |
122 | 0 | const SfxBoolItem* pAllowFocusChange = rReq.GetArg<SfxBoolItem>(SID_SWITCHPAGE); |
123 | 0 | bAllowFocusChange = pAllowFocusChange->GetValue(); |
124 | 0 | if (!bAllowFocusChange) |
125 | 0 | break; |
126 | 0 | } |
127 | 0 | [[fallthrough]]; |
128 | 0 | default: |
129 | 0 | if ( mpDrawView->IsTextEdit() ) |
130 | 0 | { |
131 | 0 | mpDrawView->SdrEndTextEdit(); |
132 | 0 | } |
133 | 0 | } |
134 | | |
135 | 0 | const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); |
136 | | // sal_uInt16 nSlot = rReq.GetSlot(); |
137 | 0 | switch (nSlot) |
138 | 0 | { |
139 | 0 | case SID_SWITCHPAGE: // BASIC |
140 | 0 | { |
141 | | // switch page in running slide show |
142 | 0 | if(SlideShow::IsRunning(GetViewShellBase()) |
143 | 0 | && !SlideShow::IsInteractiveSlideshow(GetViewShellBase()) // IASS |
144 | 0 | && rReq.GetArgs()) |
145 | 0 | { |
146 | 0 | if (const SfxUInt32Item* pWhatPage = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATPAGE)) |
147 | 0 | SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber(static_cast<sal_Int32>((pWhatPage->GetValue()-1)>>1)); |
148 | 0 | } |
149 | 0 | else |
150 | 0 | { |
151 | 0 | const SfxItemSet *pArgs = rReq.GetArgs (); |
152 | 0 | sal_uInt16 nSelectedPage = 0; |
153 | |
|
154 | 0 | if (! pArgs || pArgs->Count () == 1) |
155 | 0 | { |
156 | 0 | nSelectedPage = maTabControl->GetCurPagePos(); |
157 | 0 | } |
158 | 0 | else if (pArgs->Count () == 2) |
159 | 0 | { |
160 | 0 | const SfxUInt32Item* pWhatPage = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATPAGE); |
161 | 0 | const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND); |
162 | |
|
163 | 0 | sal_Int32 nWhatPage = static_cast<sal_Int32>(pWhatPage->GetValue ()); |
164 | 0 | PageKind nWhatKind = static_cast<PageKind>(pWhatKind->GetValue ()); |
165 | 0 | if (nWhatKind < PageKind::Standard || nWhatKind > PageKind::Handout) |
166 | 0 | { |
167 | | #if HAVE_FEATURE_SCRIPTING |
168 | | StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE); |
169 | | #endif |
170 | 0 | rReq.Ignore (); |
171 | 0 | break; |
172 | 0 | } |
173 | 0 | else if (meEditMode != EditMode::MasterPage) |
174 | 0 | { |
175 | 0 | if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount(nWhatKind))) |
176 | 0 | { |
177 | | #if HAVE_FEATURE_SCRIPTING |
178 | | StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE); |
179 | | #endif |
180 | 0 | rReq.Ignore (); |
181 | 0 | break; |
182 | 0 | } |
183 | | |
184 | 0 | nSelectedPage = static_cast<short>(nWhatPage); |
185 | 0 | mePageKind = nWhatKind; |
186 | 0 | } |
187 | 0 | } |
188 | 0 | else |
189 | 0 | { |
190 | | #if HAVE_FEATURE_SCRIPTING |
191 | | StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS); |
192 | | #endif |
193 | 0 | rReq.Ignore (); |
194 | 0 | break; |
195 | 0 | } |
196 | | |
197 | 0 | if( GetDocSh() && (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED)) |
198 | 0 | GetDocSh()->SetModified(); |
199 | |
|
200 | 0 | SwitchPage(nSelectedPage, bAllowFocusChange); |
201 | |
|
202 | 0 | if(HasCurrentFunction(SID_BEZIER_EDIT)) |
203 | 0 | GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON); |
204 | |
|
205 | 0 | Invalidate(); |
206 | 0 | InvalidateWindows(); |
207 | 0 | rReq.Done (); |
208 | 0 | } |
209 | 0 | break; |
210 | 0 | } |
211 | | |
212 | 0 | case SID_SWITCHLAYER: // BASIC |
213 | 0 | { |
214 | 0 | const SfxItemSet *pArgs = rReq.GetArgs (); |
215 | | |
216 | | // #i87182# |
217 | 0 | bool bCurPageValid(false); |
218 | 0 | sal_uInt16 nCurPage(0); |
219 | |
|
220 | 0 | if(GetLayerTabControl()) |
221 | 0 | { |
222 | 0 | nCurPage = GetLayerTabControl()->GetCurPageId(); |
223 | 0 | bCurPageValid = true; |
224 | 0 | } |
225 | |
|
226 | 0 | if(pArgs && 1 == pArgs->Count()) |
227 | 0 | { |
228 | 0 | const SfxUInt32Item* pWhatLayer = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYER); |
229 | |
|
230 | 0 | if(pWhatLayer) |
231 | 0 | { |
232 | 0 | nCurPage = static_cast<short>(pWhatLayer->GetValue()); |
233 | 0 | bCurPageValid = true; |
234 | 0 | } |
235 | 0 | } |
236 | |
|
237 | 0 | if(bCurPageValid) |
238 | 0 | { |
239 | 0 | OUString aLayerName( GetLayerTabControl()->GetLayerName(nCurPage)); |
240 | 0 | if (!aLayerName.isEmpty()) |
241 | 0 | { |
242 | 0 | mpDrawView->SetActiveLayer(aLayerName); |
243 | 0 | } |
244 | 0 | Invalidate(); |
245 | 0 | } |
246 | |
|
247 | 0 | rReq.Done (); |
248 | |
|
249 | 0 | break; |
250 | 0 | } |
251 | | |
252 | 0 | case SID_PAGEMODE: // BASIC |
253 | 0 | { |
254 | |
|
255 | 0 | const SfxItemSet *pArgs = rReq.GetArgs(); |
256 | |
|
257 | 0 | if (pArgs && pArgs->Count () == 2) |
258 | 0 | { |
259 | 0 | const SfxBoolItem* pIsActive = rReq.GetArg<SfxBoolItem>(ID_VAL_ISACTIVE); |
260 | 0 | const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND); |
261 | |
|
262 | 0 | PageKind nWhatKind = static_cast<PageKind>(pWhatKind->GetValue()); |
263 | 0 | if ( nWhatKind >= PageKind::Standard && nWhatKind <= PageKind::Handout) |
264 | 0 | { |
265 | 0 | mbIsLayerModeActive = pIsActive->GetValue(); |
266 | 0 | mePageKind = nWhatKind; |
267 | 0 | } |
268 | 0 | } |
269 | | |
270 | | // turn on default layer of page |
271 | 0 | mpDrawView->SetActiveLayer(sUNO_LayerName_layout); |
272 | |
|
273 | 0 | ChangeEditMode(EditMode::Page, mbIsLayerModeActive); |
274 | |
|
275 | 0 | Invalidate(); |
276 | 0 | rReq.Done (); |
277 | |
|
278 | 0 | break; |
279 | 0 | } |
280 | | |
281 | 0 | case SID_LAYERMODE: // BASIC |
282 | 0 | { |
283 | 0 | const SfxItemSet *pArgs = rReq.GetArgs(); |
284 | |
|
285 | 0 | if (pArgs && pArgs->Count() == 2) |
286 | 0 | { |
287 | 0 | const SfxUInt32Item* pWhatLayer = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYER); |
288 | 0 | EditMode nWhatLayer = static_cast<EditMode>(pWhatLayer->GetValue()); |
289 | 0 | if (nWhatLayer == EditMode::Page || nWhatLayer == EditMode::MasterPage) |
290 | 0 | { |
291 | 0 | mbIsLayerModeActive = rReq.GetArg<SfxBoolItem>(ID_VAL_ISACTIVE)->GetValue(); |
292 | 0 | meEditMode = nWhatLayer; |
293 | 0 | } |
294 | 0 | } |
295 | |
|
296 | 0 | ChangeEditMode(meEditMode, !mbIsLayerModeActive); |
297 | |
|
298 | 0 | Invalidate(); |
299 | 0 | rReq.Done(); |
300 | |
|
301 | 0 | break; |
302 | 0 | } |
303 | | |
304 | 0 | case SID_HEADER_AND_FOOTER: |
305 | 0 | case SID_INSERT_PAGE_NUMBER: |
306 | 0 | case SID_INSERT_DATE_TIME: |
307 | 0 | { |
308 | 0 | SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); |
309 | 0 | vcl::Window* pWin = GetActiveWindow(); |
310 | 0 | VclPtr<AbstractHeaderFooterDialog> pDlg(pFact->CreateHeaderFooterDialog(*this, pWin ? pWin->GetFrameWeld() : nullptr, *GetDoc(), mpActualPage)); |
311 | 0 | auto xRequest = std::make_shared<SfxRequest>(rReq); |
312 | 0 | rReq.Ignore(); // the 'old' request is not relevant any more |
313 | 0 | pDlg->StartExecuteAsync([this, pDlg, xRequest=std::move(xRequest)](sal_Int32 /*nResult*/){ |
314 | 0 | GetActiveWindow()->Invalidate(); |
315 | 0 | UpdatePreview( mpActualPage ); |
316 | |
|
317 | 0 | Invalidate(); |
318 | 0 | xRequest->Done(); |
319 | |
|
320 | 0 | pDlg->disposeOnce(); |
321 | 0 | }); |
322 | 0 | break; |
323 | 0 | } |
324 | | |
325 | 0 | case SID_MASTER_LAYOUTS: |
326 | 0 | { |
327 | 0 | SdPage* pPage = GetActualPage(); |
328 | 0 | if (meEditMode == EditMode::MasterPage) |
329 | | // Use the master page of the current page. |
330 | 0 | pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage()); |
331 | |
|
332 | 0 | SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); |
333 | 0 | vcl::Window* pWin = GetActiveWindow(); |
334 | 0 | ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, *GetDoc(), pPage)); |
335 | 0 | pDlg->Execute(); |
336 | 0 | Invalidate(); |
337 | 0 | rReq.Done (); |
338 | 0 | break; |
339 | 0 | } |
340 | 0 | case SID_OBJECTRESIZE: |
341 | 0 | { |
342 | | // The server likes to change the client size |
343 | 0 | OSL_ASSERT (GetViewShell()!=nullptr); |
344 | 0 | SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); |
345 | |
|
346 | 0 | if ( pIPClient && pIPClient->IsObjectInPlaceActive() ) |
347 | 0 | { |
348 | 0 | const SfxRectangleItem& rRect = |
349 | 0 | rReq.GetArgs()->Get(SID_OBJECTRESIZE); |
350 | 0 | ::tools::Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) ); |
351 | |
|
352 | 0 | if ( rMarkList.GetMarkCount() != 0 ) |
353 | 0 | { |
354 | 0 | if (rMarkList.GetMarkCount() == 1) |
355 | 0 | { |
356 | 0 | SdrMark* pMark = rMarkList.GetMark(0); |
357 | 0 | SdrObject* pObj = pMark->GetMarkedSdrObj(); |
358 | |
|
359 | 0 | SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj ); |
360 | 0 | if(pOle2Obj) |
361 | 0 | { |
362 | 0 | if( pOle2Obj->GetObjRef().is() ) |
363 | 0 | { |
364 | 0 | pOle2Obj->SetLogicRect(aRect); |
365 | 0 | } |
366 | 0 | } |
367 | 0 | } |
368 | 0 | } |
369 | 0 | } |
370 | 0 | rReq.Ignore (); |
371 | 0 | break; |
372 | 0 | } |
373 | | |
374 | 0 | case SID_RELOAD: |
375 | 0 | { |
376 | 0 | sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId(); |
377 | 0 | SfxViewFrame* pFrame = GetViewFrame(); |
378 | |
|
379 | 0 | try |
380 | 0 | { |
381 | 0 | Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW ); |
382 | | |
383 | | // Save the current configuration of panes and views. |
384 | 0 | DrawController* pDrawController = GetViewShellBase().GetDrawController(); |
385 | 0 | if (pDrawController) |
386 | 0 | { |
387 | 0 | rtl::Reference<sd::framework::ConfigurationController> xConfigurationController ( |
388 | 0 | pDrawController->getConfigurationController() ); |
389 | 0 | rtl::Reference<sd::framework::Configuration> xConfiguration ( |
390 | 0 | xConfigurationController->getRequestedConfiguration() ); |
391 | |
|
392 | 0 | SfxChildWindow* pWindow = pFrame->GetChildWindow(nId); |
393 | 0 | if(pWindow) |
394 | 0 | { |
395 | 0 | Svx3DWin* p3DWin = static_cast<Svx3DWin*>(pWindow->GetWindow()); |
396 | 0 | if(p3DWin) |
397 | 0 | p3DWin->DocumentReload(); |
398 | 0 | } |
399 | | |
400 | | // normal forwarding to ViewFrame for execution |
401 | 0 | GetViewFrame()->ExecuteSlot(rReq); |
402 | | |
403 | | // From here on we must cope with this object and the frame already being |
404 | | // deleted. Do not call any methods or use data members. |
405 | 0 | Reference<XController> xController( xFrame->getController(), UNO_SET_THROW ); |
406 | | |
407 | | // Restore the configuration. |
408 | 0 | if (auto pDrawController2 = dynamic_cast<DrawController*>( xController.get() )) |
409 | 0 | { |
410 | 0 | xConfigurationController = pDrawController2->getConfigurationController(); |
411 | 0 | if ( ! xConfigurationController.is()) |
412 | 0 | throw RuntimeException(); |
413 | 0 | xConfigurationController->restoreConfiguration(xConfiguration); |
414 | 0 | } |
415 | 0 | } |
416 | 0 | } |
417 | 0 | catch (RuntimeException&) |
418 | 0 | { |
419 | 0 | DBG_UNHANDLED_EXCEPTION("sd.view"); |
420 | 0 | } |
421 | | |
422 | | // We have to return immediately to avoid accessing this object. |
423 | 0 | return; |
424 | 0 | } |
425 | | |
426 | 0 | case SID_JUMPTOMARK: |
427 | 0 | { |
428 | 0 | if( rReq.GetArgs() ) |
429 | 0 | { |
430 | 0 | const SfxStringItem* pBookmark = rReq.GetArg<SfxStringItem>(SID_JUMPTOMARK); |
431 | |
|
432 | 0 | if (pBookmark) |
433 | 0 | { |
434 | 0 | OUString sBookmark(INetURLObject::decode(pBookmark->GetValue(), INetURLObject::DecodeMechanism::WithCharset)); |
435 | |
|
436 | 0 | rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) ); |
437 | 0 | if(xSlideshow.is() && xSlideshow->isRunning()) |
438 | 0 | { |
439 | 0 | xSlideshow->jumpToBookmark(sBookmark); |
440 | 0 | } |
441 | 0 | else |
442 | 0 | { |
443 | 0 | GotoBookmark(sBookmark); |
444 | 0 | } |
445 | 0 | } |
446 | 0 | } |
447 | 0 | rReq.Done(); |
448 | 0 | break; |
449 | 0 | } |
450 | | |
451 | 0 | case SID_OUTPUT_QUALITY_COLOR: |
452 | 0 | case SID_OUTPUT_QUALITY_GRAYSCALE: |
453 | 0 | case SID_OUTPUT_QUALITY_BLACKWHITE: |
454 | 0 | case SID_OUTPUT_QUALITY_CONTRAST: |
455 | 0 | { |
456 | 0 | ExecReq( rReq ); |
457 | 0 | break; |
458 | 0 | } |
459 | | |
460 | 0 | case SID_MAIL_SCROLLBODY_PAGEDOWN: |
461 | 0 | { |
462 | 0 | ExecReq( rReq ); |
463 | 0 | break; |
464 | 0 | } |
465 | | |
466 | 0 | case SID_ATTR_YEAR2000: |
467 | 0 | { |
468 | 0 | FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); |
469 | 0 | if (pFormShell != nullptr) |
470 | 0 | { |
471 | 0 | const SfxPoolItem* pItem; |
472 | 0 | if (rReq.GetArgs()->GetItemState( |
473 | 0 | SID_ATTR_YEAR2000, true, &pItem) == SfxItemState::SET) |
474 | 0 | pFormShell->SetY2KState ( |
475 | 0 | static_cast<const SfxUInt16Item*>(pItem)->GetValue()); |
476 | 0 | } |
477 | |
|
478 | 0 | rReq.Done(); |
479 | 0 | } |
480 | 0 | break; |
481 | | |
482 | 0 | case SID_OPT_LOCALE_CHANGED: |
483 | 0 | { |
484 | 0 | GetActiveWindow()->Invalidate(); |
485 | 0 | UpdatePreview( mpActualPage ); |
486 | 0 | rReq.Done(); |
487 | 0 | } |
488 | 0 | break; |
489 | | |
490 | 0 | case SID_REGENERATE_DIAGRAM: |
491 | 0 | case SID_EDIT_DIAGRAM: |
492 | 0 | { |
493 | 0 | if (1 == rMarkList.GetMarkCount()) |
494 | 0 | { |
495 | 0 | SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); |
496 | | |
497 | | // Support advanced DiagramHelper |
498 | 0 | if(nullptr != pObj && pObj->isDiagram()) |
499 | 0 | { |
500 | 0 | if(SID_REGENERATE_DIAGRAM == nSlot) |
501 | 0 | { |
502 | 0 | mpDrawView->UnmarkAll(); |
503 | 0 | pObj->getDiagramHelper()->reLayout(*static_cast<SdrObjGroup*>(pObj)); |
504 | 0 | mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); |
505 | 0 | } |
506 | 0 | else // SID_EDIT_DIAGRAM |
507 | 0 | { |
508 | 0 | VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); |
509 | 0 | VclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog( |
510 | 0 | GetFrameWeld(), |
511 | 0 | *static_cast<SdrObjGroup*>(pObj)); |
512 | 0 | pDlg->StartExecuteAsync( |
513 | 0 | [pDlg] (sal_Int32 /*nResult*/)->void |
514 | 0 | { |
515 | 0 | pDlg->disposeOnce(); |
516 | 0 | } |
517 | 0 | ); |
518 | 0 | } |
519 | 0 | } |
520 | 0 | } |
521 | |
|
522 | 0 | rReq.Done(); |
523 | 0 | } |
524 | 0 | break; |
525 | | |
526 | 0 | default: |
527 | 0 | break; |
528 | 0 | } |
529 | 0 | } |
530 | | |
531 | | void DrawViewShell::ExecRuler(SfxRequest& rReq) |
532 | 0 | { |
533 | | // nothing is executed during a slide show! |
534 | 0 | if(HasCurrentFunction(SID_PRESENTATION)) |
535 | 0 | return; |
536 | | |
537 | 0 | CheckLineTo (rReq); |
538 | |
|
539 | 0 | const SfxItemSet* pArgs = rReq.GetArgs(); |
540 | 0 | const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); |
541 | 0 | Size aPageSize = mpActualPage->GetSize(); |
542 | 0 | Size aViewSize = GetActiveWindow()->GetViewSize(); |
543 | |
|
544 | 0 | switch ( rReq.GetSlot() ) |
545 | 0 | { |
546 | 0 | case SID_ATTR_LONG_LRSPACE: |
547 | 0 | if (pArgs) |
548 | 0 | { |
549 | 0 | std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(*GetDoc())); |
550 | 0 | pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER)); |
551 | |
|
552 | 0 | const SvxLongLRSpaceItem& rLRSpace = |
553 | 0 | pArgs->Get(SID_ATTR_LONG_LRSPACE); |
554 | |
|
555 | 0 | if( mpDrawView->IsTextEdit() ) |
556 | 0 | { |
557 | 0 | ::tools::Rectangle aRect = maMarkRect; |
558 | 0 | aRect.SetPos(aRect.TopLeft() + aPagePos); |
559 | 0 | aRect.SetLeft( rLRSpace.GetLeft() ); |
560 | 0 | aRect.SetRight( aViewSize.Width() - rLRSpace.GetRight() ); |
561 | 0 | aRect.SetPos(aRect.TopLeft() - aPagePos); |
562 | 0 | if ( aRect != maMarkRect) |
563 | 0 | { |
564 | 0 | mpDrawView->SetAllMarkedRect(aRect); |
565 | 0 | maMarkRect = mpDrawView->GetAllMarkedRect(); |
566 | 0 | Invalidate( SID_RULER_OBJECT ); |
567 | 0 | } |
568 | 0 | } |
569 | 0 | else |
570 | 0 | { |
571 | 0 | ::tools::Long nLeft = std::max(::tools::Long(0), rLRSpace.GetLeft() - aPagePos.X()); |
572 | 0 | ::tools::Long nRight = std::max(::tools::Long(0), rLRSpace.GetRight() + aPagePos.X() + |
573 | 0 | aPageSize.Width() - aViewSize.Width()); |
574 | |
|
575 | 0 | sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); |
576 | 0 | sal_uInt16 i; |
577 | 0 | for ( i = 0; i < nPageCnt; i++) |
578 | 0 | { |
579 | 0 | SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); |
580 | 0 | SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(), |
581 | 0 | pPage, |
582 | 0 | pPage->GetLeftBorder(), |
583 | 0 | pPage->GetRightBorder(), |
584 | 0 | nLeft, nRight); |
585 | 0 | pUndoGroup->AddAction(pUndo); |
586 | 0 | pPage->SetLeftBorder(nLeft); |
587 | 0 | pPage->SetRightBorder(nRight); |
588 | 0 | } |
589 | 0 | nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); |
590 | |
|
591 | 0 | for (i = 0; i < nPageCnt; i++) |
592 | 0 | { |
593 | 0 | SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind); |
594 | 0 | SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(), |
595 | 0 | pPage, |
596 | 0 | pPage->GetLeftBorder(), |
597 | 0 | pPage->GetRightBorder(), |
598 | 0 | nLeft, nRight); |
599 | 0 | pUndoGroup->AddAction(pUndo); |
600 | 0 | pPage->SetLeftBorder(nLeft); |
601 | 0 | pPage->SetRightBorder(nRight); |
602 | 0 | } |
603 | 0 | InvalidateWindows(); |
604 | 0 | } |
605 | | |
606 | | // give the undo group to the undo manager |
607 | 0 | GetViewFrame()->GetObjectShell()->GetUndoManager()-> |
608 | 0 | AddUndoAction(std::move(pUndoGroup)); |
609 | 0 | } |
610 | 0 | break; |
611 | 0 | case SID_ATTR_LONG_ULSPACE: |
612 | 0 | if (pArgs) |
613 | 0 | { |
614 | 0 | std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(*GetDoc())); |
615 | 0 | pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER)); |
616 | |
|
617 | 0 | const SvxLongULSpaceItem& rULSpace = |
618 | 0 | pArgs->Get(SID_ATTR_LONG_ULSPACE); |
619 | |
|
620 | 0 | if( mpDrawView->IsTextEdit() ) |
621 | 0 | { |
622 | 0 | ::tools::Rectangle aRect = maMarkRect; |
623 | 0 | aRect.SetPos(aRect.TopLeft() + aPagePos); |
624 | 0 | aRect.SetTop( rULSpace.GetUpper() ); |
625 | 0 | aRect.SetBottom( aViewSize.Height() - rULSpace.GetLower() ); |
626 | 0 | aRect.SetPos(aRect.TopLeft() - aPagePos); |
627 | |
|
628 | 0 | if ( aRect != maMarkRect) |
629 | 0 | { |
630 | 0 | mpDrawView->SetAllMarkedRect(aRect); |
631 | 0 | maMarkRect = mpDrawView->GetAllMarkedRect(); |
632 | 0 | Invalidate( SID_RULER_OBJECT ); |
633 | 0 | } |
634 | 0 | } |
635 | 0 | else |
636 | 0 | { |
637 | 0 | ::tools::Long nUpper = std::max(::tools::Long(0), rULSpace.GetUpper() - aPagePos.Y()); |
638 | 0 | ::tools::Long nLower = std::max(::tools::Long(0), rULSpace.GetLower() + aPagePos.Y() + |
639 | 0 | aPageSize.Height() - aViewSize.Height()); |
640 | |
|
641 | 0 | sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); |
642 | 0 | sal_uInt16 i; |
643 | 0 | for ( i = 0; i < nPageCnt; i++) |
644 | 0 | { |
645 | 0 | SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); |
646 | 0 | SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(), |
647 | 0 | pPage, |
648 | 0 | pPage->GetUpperBorder(), |
649 | 0 | pPage->GetLowerBorder(), |
650 | 0 | nUpper, nLower); |
651 | 0 | pUndoGroup->AddAction(pUndo); |
652 | 0 | pPage->SetUpperBorder(nUpper); |
653 | 0 | pPage->SetLowerBorder(nLower); |
654 | 0 | } |
655 | 0 | nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); |
656 | |
|
657 | 0 | for (i = 0; i < nPageCnt; i++) |
658 | 0 | { |
659 | 0 | SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind); |
660 | 0 | SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(), |
661 | 0 | pPage, |
662 | 0 | pPage->GetUpperBorder(), |
663 | 0 | pPage->GetLowerBorder(), |
664 | 0 | nUpper, nLower); |
665 | 0 | pUndoGroup->AddAction(pUndo); |
666 | 0 | pPage->SetUpperBorder(nUpper); |
667 | 0 | pPage->SetLowerBorder(nLower); |
668 | 0 | } |
669 | 0 | InvalidateWindows(); |
670 | 0 | } |
671 | | |
672 | | // give the undo group to the undo manager |
673 | 0 | GetViewFrame()->GetObjectShell()->GetUndoManager()-> |
674 | 0 | AddUndoAction(std::move(pUndoGroup)); |
675 | 0 | } |
676 | 0 | break; |
677 | 0 | case SID_RULER_OBJECT: |
678 | 0 | if (pArgs) |
679 | 0 | { |
680 | 0 | ::tools::Rectangle aRect = maMarkRect; |
681 | 0 | aRect.SetPos(aRect.TopLeft() + aPagePos); |
682 | |
|
683 | 0 | const SvxObjectItem& rOI = pArgs->Get(SID_RULER_OBJECT); |
684 | |
|
685 | 0 | if ( rOI.GetStartX() != rOI.GetEndX() ) |
686 | 0 | { |
687 | 0 | aRect.SetLeft( rOI.GetStartX() ); |
688 | 0 | aRect.SetRight( rOI.GetEndX() ); |
689 | 0 | } |
690 | 0 | if ( rOI.GetStartY() != rOI.GetEndY() ) |
691 | 0 | { |
692 | 0 | aRect.SetTop( rOI.GetStartY() ); |
693 | 0 | aRect.SetBottom( rOI.GetEndY() ); |
694 | 0 | } |
695 | 0 | aRect.SetPos(aRect.TopLeft() - aPagePos); |
696 | 0 | if ( aRect != maMarkRect) |
697 | 0 | { |
698 | 0 | mpDrawView->SetAllMarkedRect(aRect); |
699 | 0 | maMarkRect = mpDrawView->GetAllMarkedRect(); |
700 | 0 | Invalidate( SID_RULER_OBJECT ); |
701 | 0 | } |
702 | 0 | } |
703 | 0 | break; |
704 | 0 | case SID_ATTR_TABSTOP: |
705 | 0 | if (pArgs && mpDrawView->IsTextEdit()) |
706 | 0 | { |
707 | 0 | const SvxTabStopItem& rItem = pArgs->Get( EE_PARA_TABS ); |
708 | |
|
709 | 0 | SfxItemSetFixed<EE_PARA_TABS, EE_PARA_TABS> aEditAttr( GetPool() ); |
710 | |
|
711 | 0 | aEditAttr.Put( rItem ); |
712 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
713 | |
|
714 | 0 | Invalidate(SID_ATTR_TABSTOP); |
715 | 0 | } |
716 | 0 | break; |
717 | 0 | case SID_ATTR_PARA_LINESPACE: |
718 | 0 | if (pArgs) |
719 | 0 | { |
720 | 0 | SvxLineSpacingItem aParaLineSP = pArgs->Get( |
721 | 0 | GetPool().GetWhichIDFromSlotID(SID_ATTR_PARA_LINESPACE)); |
722 | |
|
723 | 0 | SfxItemSetFixed<EE_PARA_SBL, EE_PARA_SBL> aEditAttr( GetPool() ); |
724 | 0 | aParaLineSP.SetWhich( EE_PARA_SBL ); |
725 | |
|
726 | 0 | aEditAttr.Put( aParaLineSP ); |
727 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
728 | |
|
729 | 0 | Invalidate(SID_ATTR_PARA_LINESPACE); |
730 | 0 | } |
731 | 0 | break; |
732 | 0 | case SID_ATTR_PARA_ADJUST_LEFT: |
733 | 0 | { |
734 | 0 | SvxAdjustItem aItem( SvxAdjust::Left, EE_PARA_JUST ); |
735 | 0 | SfxItemSetFixed<EE_PARA_JUST, EE_PARA_JUST> aEditAttr( GetPool() ); |
736 | |
|
737 | 0 | aEditAttr.Put( aItem ); |
738 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
739 | |
|
740 | 0 | Invalidate(SID_ATTR_PARA_ADJUST_LEFT); |
741 | 0 | break; |
742 | 0 | } |
743 | 0 | case SID_ATTR_PARA_ADJUST_CENTER: |
744 | 0 | { |
745 | 0 | SvxAdjustItem aItem( SvxAdjust::Center, EE_PARA_JUST ); |
746 | 0 | SfxItemSetFixed<EE_PARA_JUST, EE_PARA_JUST> aEditAttr( GetPool() ); |
747 | |
|
748 | 0 | aEditAttr.Put( aItem ); |
749 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
750 | |
|
751 | 0 | Invalidate(SID_ATTR_PARA_ADJUST_CENTER); |
752 | 0 | break; |
753 | 0 | } |
754 | 0 | case SID_ATTR_PARA_ADJUST_RIGHT: |
755 | 0 | { |
756 | 0 | SvxAdjustItem aItem( SvxAdjust::Right, EE_PARA_JUST ); |
757 | 0 | SfxItemSetFixed<EE_PARA_JUST, EE_PARA_JUST> aEditAttr( GetPool() ); |
758 | |
|
759 | 0 | aEditAttr.Put( aItem ); |
760 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
761 | |
|
762 | 0 | Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); |
763 | 0 | break; |
764 | 0 | } |
765 | 0 | case SID_ATTR_PARA_ADJUST_BLOCK: |
766 | 0 | { |
767 | 0 | SvxAdjustItem aItem( SvxAdjust::Block, EE_PARA_JUST ); |
768 | 0 | SfxItemSetFixed<EE_PARA_JUST, EE_PARA_JUST> aEditAttr( GetPool() ); |
769 | |
|
770 | 0 | aEditAttr.Put( aItem ); |
771 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
772 | |
|
773 | 0 | Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); |
774 | 0 | break; |
775 | 0 | } |
776 | 0 | case SID_ATTR_PARA_ULSPACE: |
777 | 0 | if (pArgs) |
778 | 0 | { |
779 | 0 | SvxULSpaceItem aULSP = static_cast<const SvxULSpaceItem&>(pArgs->Get( |
780 | 0 | SID_ATTR_PARA_ULSPACE)); |
781 | 0 | SfxItemSetFixed<EE_PARA_ULSPACE, EE_PARA_ULSPACE> aEditAttr( GetPool() ); |
782 | 0 | aULSP.SetWhich( EE_PARA_ULSPACE ); |
783 | |
|
784 | 0 | aEditAttr.Put( aULSP ); |
785 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
786 | |
|
787 | 0 | Invalidate(SID_ATTR_PARA_ULSPACE); |
788 | 0 | } |
789 | 0 | break; |
790 | 0 | case SID_ATTR_PARA_LRSPACE: |
791 | 0 | if (pArgs) |
792 | 0 | { |
793 | 0 | SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get( |
794 | 0 | SID_ATTR_PARA_LRSPACE)); |
795 | |
|
796 | 0 | SfxItemSetFixed<EE_PARA_LRSPACE, EE_PARA_LRSPACE> aEditAttr( GetPool() ); |
797 | 0 | aLRSpace.SetWhich( EE_PARA_LRSPACE ); |
798 | |
|
799 | 0 | aEditAttr.Put( aLRSpace ); |
800 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
801 | |
|
802 | 0 | Invalidate(SID_ATTR_PARA_LRSPACE); |
803 | 0 | } |
804 | 0 | break; |
805 | 0 | case SID_ATTR_LRSPACE: |
806 | 0 | if (pArgs && mpDrawView->IsTextEdit()) |
807 | 0 | { |
808 | 0 | sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; |
809 | 0 | const SvxLRSpaceItem& rItem = static_cast<const SvxLRSpaceItem&>( |
810 | 0 | pArgs->Get( nId )); |
811 | |
|
812 | 0 | SfxItemSetFixed< |
813 | 0 | EE_PARA_NUMBULLET, EE_PARA_NUMBULLET, |
814 | 0 | EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL, |
815 | 0 | EE_PARA_LRSPACE, EE_PARA_LRSPACE> aEditAttr( GetDoc()->GetPool() ); |
816 | 0 | mpDrawView->GetAttributes( aEditAttr ); |
817 | |
|
818 | 0 | nId = EE_PARA_LRSPACE; |
819 | 0 | SvxLRSpaceItem aLRSpaceItem(rItem.GetLeft(), rItem.GetRight(), |
820 | 0 | rItem.GetTextFirstLineOffset(), nId); |
821 | |
|
822 | 0 | const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue(); |
823 | 0 | const SvxLRSpaceItem& rOrigLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE ); |
824 | 0 | const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET ); |
825 | 0 | if( nOutlineLevel != -1 && |
826 | 0 | rNumBulletItem.GetNumRule().GetLevelCount() > nOutlineLevel ) |
827 | 0 | { |
828 | 0 | const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule().GetLevel(nOutlineLevel); |
829 | 0 | SvxNumberFormat aFormat(rFormat); |
830 | | |
831 | | // left margin gets distributed onto LRSpace item |
832 | | // and number format AbsLSpace - this fixes |
833 | | // n#707779 (previously, LRSpace left indent could |
834 | | // become negative - EditEngine really does not |
835 | | // like that. |
836 | 0 | const auto nAbsLSpace=aFormat.GetAbsLSpace(); |
837 | 0 | const ::tools::Long nTxtLeft = rItem.ResolveTextLeft({}); |
838 | 0 | const ::tools::Long nLeftIndent=std::max(::tools::Long(0),nTxtLeft - nAbsLSpace); |
839 | 0 | aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(nLeftIndent)); |
840 | | // control for clipped left indent - remainder |
841 | | // reduces number format first line indent |
842 | 0 | aFormat.SetAbsLSpace(nTxtLeft - nLeftIndent); |
843 | | |
844 | | // negative first line indent goes to the number |
845 | | // format, positive to the lrSpace item |
846 | 0 | if (rItem.GetTextFirstLineOffset().m_dValue < 0.0) |
847 | 0 | { |
848 | 0 | aFormat.SetFirstLineOffset(rItem.ResolveTextFirstLineOffset({}) |
849 | 0 | - rOrigLRSpaceItem.ResolveTextFirstLineOffset({}) |
850 | 0 | + aFormat.GetCharTextDistance()); |
851 | 0 | aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::zero()); |
852 | 0 | } |
853 | 0 | else |
854 | 0 | { |
855 | 0 | aFormat.SetFirstLineOffset(0); |
856 | 0 | aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips( |
857 | 0 | rItem.ResolveTextFirstLineOffset({}) - aFormat.GetFirstLineOffset() |
858 | 0 | + aFormat.GetCharTextDistance())); |
859 | 0 | } |
860 | |
|
861 | 0 | if( rFormat != aFormat ) |
862 | 0 | { |
863 | | // put all items |
864 | 0 | const_cast<SvxNumRule&>(rNumBulletItem.GetNumRule()).SetLevel(nOutlineLevel,aFormat); |
865 | 0 | aEditAttr.Put( rNumBulletItem ); |
866 | 0 | aEditAttr.Put( aLRSpaceItem ); |
867 | 0 | mpDrawView->SetAttributes( aEditAttr ); |
868 | |
|
869 | 0 | Invalidate(SID_ATTR_PARA_LRSPACE); |
870 | 0 | break; |
871 | 0 | } |
872 | 0 | } |
873 | | |
874 | | // only put lrSpace item |
875 | 0 | SfxItemSetFixed<EE_PARA_LRSPACE, EE_PARA_LRSPACE> aEditAttrReduced( GetDoc()->GetPool() ); |
876 | 0 | aEditAttrReduced.Put( aLRSpaceItem ); |
877 | 0 | mpDrawView->SetAttributes( aEditAttrReduced ); |
878 | |
|
879 | 0 | Invalidate(SID_ATTR_PARA_LRSPACE); |
880 | 0 | } |
881 | 0 | break; |
882 | 0 | } |
883 | 0 | } |
884 | | |
885 | | void DrawViewShell::GetRulerState(SfxItemSet& rSet) |
886 | 0 | { |
887 | 0 | Point aOrigin; |
888 | |
|
889 | 0 | if (mpDrawView->GetSdrPageView()) |
890 | 0 | { |
891 | 0 | aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin(); |
892 | 0 | } |
893 | |
|
894 | 0 | Size aViewSize = GetActiveWindow()->GetViewSize(); |
895 | |
|
896 | 0 | const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); |
897 | 0 | Size aPageSize = mpActualPage->GetSize(); |
898 | |
|
899 | 0 | ::tools::Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()), |
900 | 0 | aViewSize.Height() - (aPagePos.Y() + aPageSize.Height()))); |
901 | |
|
902 | 0 | if( mpDrawView->IsTextEdit() ) |
903 | 0 | { |
904 | 0 | Point aPnt1 = GetActiveWindow()->GetWinViewPos(); |
905 | 0 | ::tools::Rectangle aMinMaxRect( aPnt1, Size(-1, -1) ); |
906 | 0 | rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) ); |
907 | 0 | } |
908 | 0 | else |
909 | 0 | { |
910 | 0 | rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) ); |
911 | 0 | } |
912 | |
|
913 | 0 | SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLeftBorder(), |
914 | 0 | aRect.Right() + mpActualPage->GetRightBorder(), |
915 | 0 | SID_ATTR_LONG_LRSPACE); |
916 | 0 | SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUpperBorder(), |
917 | 0 | aRect.Bottom() + mpActualPage->GetLowerBorder(), |
918 | 0 | SID_ATTR_LONG_ULSPACE); |
919 | 0 | rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(), |
920 | 0 | aViewSize.Height())); |
921 | 0 | SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin ); |
922 | |
|
923 | 0 | SvxProtectItem aProtect( SID_RULER_PROTECT ); |
924 | |
|
925 | 0 | maMarkRect = mpDrawView->GetAllMarkedRect(); |
926 | |
|
927 | 0 | const bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == css::text::WritingMode_RL_TB; |
928 | 0 | rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL)); |
929 | 0 | const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); |
930 | |
|
931 | 0 | if( rMarkList.GetMarkCount() != 0 ) |
932 | 0 | { |
933 | 0 | if( mpDrawView->IsTextEdit() ) |
934 | 0 | { |
935 | 0 | SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); |
936 | 0 | if( pObj->GetObjInventor() == SdrInventor::Default) |
937 | 0 | { |
938 | 0 | SfxItemSet aEditAttr( GetDoc()->GetPool() ); |
939 | 0 | mpDrawView->GetAttributes( aEditAttr ); |
940 | 0 | if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SfxItemState::DEFAULT ) |
941 | 0 | { |
942 | 0 | const SvxTabStopItem& rItem = aEditAttr.Get( EE_PARA_TABS ); |
943 | 0 | rSet.Put( rItem ); |
944 | |
|
945 | 0 | const SvxLRSpaceItem& rLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE ); |
946 | 0 | SvxLRSpaceItem aLRSpaceItem(rLRSpaceItem.GetLeft(), rLRSpaceItem.GetRight(), |
947 | 0 | rLRSpaceItem.GetTextFirstLineOffset(), |
948 | 0 | SID_ATTR_PARA_LRSPACE); |
949 | |
|
950 | 0 | const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue(); |
951 | 0 | const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET ); |
952 | 0 | if( nOutlineLevel != -1 && |
953 | 0 | rNumBulletItem.GetNumRule().GetLevelCount() > nOutlineLevel ) |
954 | 0 | { |
955 | 0 | const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule().GetLevel(nOutlineLevel); |
956 | 0 | aLRSpaceItem.SetTextLeft(SvxIndentValue::twips( |
957 | 0 | rFormat.GetAbsLSpace() + rLRSpaceItem.ResolveTextLeft({}))); |
958 | 0 | aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips( |
959 | 0 | rLRSpaceItem.ResolveTextFirstLineOffset({}) |
960 | 0 | + rFormat.GetFirstLineOffset() - rFormat.GetCharTextDistance())); |
961 | 0 | } |
962 | |
|
963 | 0 | rSet.Put( aLRSpaceItem ); |
964 | |
|
965 | 0 | Point aPos( aPagePos + maMarkRect.TopLeft() ); |
966 | |
|
967 | 0 | if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SfxItemState::SET ) |
968 | 0 | { |
969 | 0 | const SdrMetricItem& rTLDItem = aEditAttr.Get( SDRATTR_TEXT_LEFTDIST ); |
970 | 0 | ::tools::Long nLD = rTLDItem.GetValue(); |
971 | 0 | aPos.AdjustX(nLD ); |
972 | 0 | } |
973 | |
|
974 | 0 | aPointItem.SetValue( aPos ); |
975 | |
|
976 | 0 | ::tools::Rectangle aParaRect(maMarkRect); |
977 | 0 | if (pObj->GetObjIdentifier() == SdrObjKind::Table) |
978 | 0 | { |
979 | 0 | sdr::table::SdrTableObj* pTable = static_cast<sdr::table::SdrTableObj*>(pObj); |
980 | 0 | sdr::table::CellPos cellpos; |
981 | 0 | pTable->getActiveCellPos(cellpos); |
982 | 0 | pTable->getCellBounds(cellpos, aParaRect); |
983 | 0 | } |
984 | |
|
985 | 0 | aLRSpace.SetLeft(aPagePos.X() + aParaRect.Left()); |
986 | |
|
987 | 0 | if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SfxItemState::SET ) |
988 | 0 | { |
989 | 0 | const SdrMetricItem& rTLDItem = aEditAttr.Get( SDRATTR_TEXT_LEFTDIST ); |
990 | 0 | ::tools::Long nLD = rTLDItem.GetValue(); |
991 | 0 | aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD ); |
992 | 0 | } |
993 | |
|
994 | 0 | aLRSpace.SetRight(aRect.Right() + aPageSize.Width() - aParaRect.Right()); |
995 | |
|
996 | 0 | if ( aEditAttr.GetItemState( SDRATTR_TEXT_RIGHTDIST ) == SfxItemState::SET ) |
997 | 0 | { |
998 | 0 | const SdrMetricItem& rTRDItem = aEditAttr.Get( SDRATTR_TEXT_RIGHTDIST ); |
999 | 0 | ::tools::Long nRD = rTRDItem.GetValue(); |
1000 | 0 | aLRSpace.SetRight( aLRSpace.GetRight() + nRD ); |
1001 | 0 | } |
1002 | |
|
1003 | 0 | aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() ); |
1004 | 0 | aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() ); |
1005 | |
|
1006 | 0 | rSet.DisableItem( SID_RULER_OBJECT ); |
1007 | | |
1008 | | // lock page margins |
1009 | 0 | aProtect.SetSizeProtect( true ); |
1010 | 0 | aProtect.SetPosProtect( true ); |
1011 | 0 | } |
1012 | |
|
1013 | 0 | if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SfxItemState::DEFAULT ) |
1014 | 0 | { |
1015 | 0 | const SvxFrameDirectionItem& rItem = aEditAttr.Get( EE_PARA_WRITINGDIR ); |
1016 | 0 | rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == SvxFrameDirection::Horizontal_RL_TB)); |
1017 | 0 | } |
1018 | 0 | } |
1019 | 0 | } |
1020 | 0 | else |
1021 | 0 | { |
1022 | 0 | rSet.DisableItem( EE_PARA_TABS ); |
1023 | 0 | rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT ); |
1024 | |
|
1025 | 0 | if( mpDrawView->IsResizeAllowed(true) ) |
1026 | 0 | { |
1027 | 0 | ::tools::Rectangle aResizeRect( maMarkRect ); |
1028 | |
|
1029 | 0 | aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos); |
1030 | 0 | SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(), |
1031 | 0 | aResizeRect.Top(), aResizeRect.Bottom()); |
1032 | 0 | rSet.Put(aObjItem); |
1033 | 0 | rSet.DisableItem( EE_PARA_TABS ); |
1034 | 0 | } |
1035 | 0 | else |
1036 | 0 | { |
1037 | 0 | rSet.DisableItem( SID_RULER_OBJECT ); |
1038 | 0 | } |
1039 | 0 | } |
1040 | 0 | } |
1041 | 0 | else |
1042 | 0 | { |
1043 | 0 | rSet.DisableItem( SID_RULER_OBJECT ); |
1044 | 0 | rSet.DisableItem( EE_PARA_TABS ); |
1045 | 0 | } |
1046 | |
|
1047 | 0 | rSet.Put( aLRSpace ); |
1048 | 0 | rSet.Put( aULSpace ); |
1049 | |
|
1050 | 0 | rSet.Put( aPointItem ); |
1051 | 0 | rSet.Put( aProtect ); |
1052 | 0 | } |
1053 | | |
1054 | | void DrawViewShell::ExecStatusBar(SfxRequest& rReq) |
1055 | 0 | { |
1056 | | // nothing is executed during a slide show! |
1057 | 0 | if(HasCurrentFunction(SID_PRESENTATION)) |
1058 | 0 | return; |
1059 | | |
1060 | 0 | CheckLineTo (rReq); |
1061 | |
|
1062 | 0 | switch ( rReq.GetSlot() ) |
1063 | 0 | { |
1064 | 0 | case SID_ATTR_SIZE: |
1065 | 0 | { |
1066 | 0 | GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SfxCallMode::ASYNCHRON ); |
1067 | 0 | } |
1068 | 0 | break; |
1069 | | |
1070 | 0 | case SID_STATUS_LAYOUT: |
1071 | 0 | { |
1072 | 0 | GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SfxCallMode::ASYNCHRON ); |
1073 | 0 | } |
1074 | 0 | break; |
1075 | | |
1076 | 0 | case SID_STATUS_PAGE: |
1077 | 0 | { |
1078 | 0 | GetViewFrame()->GetDispatcher()->Execute(SID_GO_TO_PAGE, |
1079 | 0 | SfxCallMode::SYNCHRON | SfxCallMode::RECORD); |
1080 | 0 | } |
1081 | 0 | break; |
1082 | 0 | } |
1083 | 0 | } |
1084 | | |
1085 | | /** |
1086 | | * set state of snap object entries in popup |
1087 | | */ |
1088 | | void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) |
1089 | 0 | { |
1090 | 0 | SdrPageView* pPV; |
1091 | 0 | Point aMPos = GetActiveWindow()->PixelToLogic(maMousePos); |
1092 | 0 | sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( |
1093 | 0 | Size(FuPoor::HITPIX,0)).Width()); |
1094 | 0 | sal_uInt16 nHelpLine; |
1095 | |
|
1096 | 0 | if ( !mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow()->GetOutDev(), nHelpLine, pPV) ) |
1097 | 0 | return; |
1098 | | |
1099 | 0 | const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine]; |
1100 | |
|
1101 | 0 | if ( rHelpLine.GetKind() == SdrHelpLineKind::Point ) |
1102 | 0 | { |
1103 | 0 | rSet.Put( SfxStringItem( SID_SET_SNAPITEM, |
1104 | 0 | SdResId( STR_POPUP_EDIT_SNAPPOINT)) ); |
1105 | 0 | rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, |
1106 | 0 | SdResId( STR_POPUP_DELETE_SNAPPOINT)) ); |
1107 | 0 | } |
1108 | 0 | else |
1109 | 0 | { |
1110 | 0 | rSet.Put( SfxStringItem( SID_SET_SNAPITEM, |
1111 | 0 | SdResId( STR_POPUP_EDIT_SNAPLINE)) ); |
1112 | 0 | rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, |
1113 | 0 | SdResId( STR_POPUP_DELETE_SNAPLINE)) ); |
1114 | 0 | } |
1115 | 0 | } |
1116 | | |
1117 | | } // end of namespace sd |
1118 | | |
1119 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |