Line data Source code
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 <avmedia/mediaplayer.hxx>
23 :
24 : #include <basic/sberrors.hxx>
25 : #include <basic/sbstar.hxx>
26 :
27 : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
28 : #include <com/sun/star/drawing/XDrawPages.hpp>
29 : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
30 : #include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
31 : #include <com/sun/star/frame/XDispatchProvider.hpp>
32 : #include <com/sun/star/util/URLTransformer.hpp>
33 : #include <com/sun/star/util/XURLTransformer.hpp>
34 :
35 : #include <comphelper/processfactory.hxx>
36 :
37 : #include <editeng/editdata.hxx>
38 : #include <editeng/eeitem.hxx>
39 : #include <editeng/flditem.hxx>
40 :
41 : #include <sfx2/bindings.hxx>
42 : #include <sfx2/dispatch.hxx>
43 : #include <sfx2/docfile.hxx>
44 : #include <sfx2/msgpool.hxx>
45 : #include <sfx2/request.hxx>
46 : #include <sfx2/viewfrm.hxx>
47 : #include <sfx2/zoomitem.hxx>
48 :
49 : #include <svl/aeitem.hxx>
50 :
51 : #include <svx/SpellDialogChildWindow.hxx>
52 : #include <svx/compressgraphicdialog.hxx>
53 : #include <svx/dialogs.hrc>
54 : #include <svx/bmpmask.hxx>
55 : #include <svx/colrctrl.hxx>
56 : #include <svx/extedit.hxx>
57 : #include <svx/extrusionbar.hxx>
58 : #include <svx/f3dchild.hxx>
59 : #include <svx/fontwork.hxx>
60 : #include <svx/fontworkbar.hxx>
61 : #include <svx/graphichelper.hxx>
62 : #include <svx/hlnkitem.hxx>
63 : #include <svx/imapdlg.hxx>
64 : #include <svx/sdtagitm.hxx>
65 : #include <svx/sdtmfitm.hxx>
66 : #include <svx/svdoattr.hxx>
67 : #include <svx/svdograf.hxx>
68 : #include <svx/svdoole2.hxx>
69 : #include <svx/svdoutl.hxx>
70 : #include <svx/svdpagv.hxx>
71 : #include <svx/svdundo.hxx>
72 : #include <svx/svxdlg.hxx>
73 : #include <svx/svxids.hrc>
74 : #include <svx/xfillit0.hxx>
75 : #include <svx/xflclit.hxx>
76 : #include <svx/xlineit0.hxx>
77 : #include <svx/xlnedwit.hxx>
78 : #include <svx/xlnstwit.hxx>
79 : #include <svx/xlnwtit.hxx>
80 :
81 : #include <tools/diagnose_ex.h>
82 :
83 : #include <unotools/useroptions.hxx>
84 :
85 : #include <vcl/graph.hxx>
86 : #include <vcl/msgbox.hxx>
87 : #include <vcl/svapp.hxx>
88 : #include <vcl/waitobj.hxx>
89 :
90 : #include <editeng/cmapitem.hxx>
91 : #include <editeng/escapementitem.hxx>
92 : #include <editeng/kernitem.hxx>
93 : #include <editeng/wghtitem.hxx>
94 : #include <editeng/postitem.hxx>
95 : #include <editeng/udlnitem.hxx>
96 : #include <editeng/crossedoutitem.hxx>
97 : #include <editeng/contouritem.hxx>
98 : #include <editeng/shdditem.hxx>
99 : #include <svx/xtable.hxx>
100 : #include <svx/svdobj.hxx>
101 : #include <svx/SvxColorChildWindow.hxx>
102 : #include <editeng/outlobj.hxx>
103 : #include <editeng/flstitem.hxx>
104 : #include <editeng/scripttypeitem.hxx>
105 : #include <editeng/fontitem.hxx>
106 : #include <editeng/fhgtitem.hxx>
107 : #include <editeng/colritem.hxx>
108 : #include <editeng/brushitem.hxx>
109 :
110 : #include <svl/whiter.hxx>
111 :
112 : #include "app.hrc"
113 : #include "glob.hrc"
114 : #include "strings.hrc"
115 :
116 : #include "framework/FrameworkHelper.hxx"
117 :
118 : #include "AnimationChildWindow.hxx"
119 : #include "DrawDocShell.hxx"
120 : #include "DrawViewShell.hxx"
121 : #include "GraphicViewShell.hxx"
122 : #include "LayerTabBar.hxx"
123 : #include "Outliner.hxx"
124 : #include "ViewShellHint.hxx"
125 : #include "ViewShellImplementation.hxx"
126 : #include "Window.hxx"
127 : #include "drawdoc.hxx"
128 : #include "drawview.hxx"
129 : #include "fuarea.hxx"
130 : #include "fubullet.hxx"
131 : #include "fuchar.hxx"
132 : #include "fucushow.hxx"
133 : #include "fuconnct.hxx"
134 : #include "fucopy.hxx"
135 : #include "fudspord.hxx"
136 : #include "fuexpand.hxx"
137 : #include "fuinsert.hxx"
138 : #include "fuinsfil.hxx"
139 : #include "fuline.hxx"
140 : #include "fulinend.hxx"
141 : #include "fulink.hxx"
142 : #include "fumeasur.hxx"
143 : #include "fumorph.hxx"
144 : #include "fuoaprms.hxx"
145 : #include "fuolbull.hxx"
146 : #include "fupage.hxx"
147 : #include "fuparagr.hxx"
148 : #include "fuprlout.hxx"
149 : #include "fuscale.hxx"
150 : #include "fusel.hxx"
151 : #include "fusldlg.hxx"
152 : #include "fusnapln.hxx"
153 : #include "fusumry.hxx"
154 : #include "futempl.hxx"
155 : #include "futhes.hxx"
156 : #include "futransf.hxx"
157 : #include "futxtatt.hxx"
158 : #include "fuvect.hxx"
159 : #include "futext.hxx"
160 : #include "helpids.h"
161 : #include "optsitem.hxx"
162 : #include "sdabstdlg.hxx"
163 : #include "sdattr.hxx"
164 : #include "sdgrffilter.hxx"
165 : #include "sdpage.hxx"
166 : #include "sdresid.hxx"
167 : #include "slideshow.hxx"
168 : #include "stlpool.hxx"
169 : #include "undolayer.hxx"
170 : #include "unmodpg.hxx"
171 : #include <sfx2/sidebar/Sidebar.hxx>
172 :
173 : #include "ViewShellBase.hxx"
174 : #include <boost/scoped_ptr.hpp>
175 :
176 : namespace {
177 : const char CustomAnimationPanelId[] = "CustomAnimationPanel";
178 : const char SlideTransitionPanelId[] = "SlideTransitionPanel";
179 : const char GalleryPanelId[] = "GalleryPanel";
180 : }
181 :
182 : using namespace ::com::sun::star;
183 : using namespace ::com::sun::star::uno;
184 :
185 : #define MIN_ACTIONS_FOR_DIALOG 5000 ///< if there are more meta objects, we show a dialog during the break up
186 :
187 : namespace sd {
188 :
189 : /**
190 : * SfxRequests for temporary actions
191 : */
192 :
193 0 : void DrawViewShell::FuTemporary(SfxRequest& rReq)
194 : {
195 : // during a native slide show nothing gets executed!
196 0 : if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR))
197 0 : return;
198 :
199 : DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
200 0 : if( !mpDrawView )
201 0 : return;
202 :
203 0 : CheckLineTo (rReq);
204 :
205 0 : DeactivateCurrentFunction();
206 :
207 0 : sal_uInt16 nSId = rReq.GetSlot();
208 :
209 : // Slot gets mapped (ToolboxImages/-Slots)
210 0 : MapSlot( nSId );
211 :
212 0 : switch ( nSId )
213 : {
214 : case SID_OUTLINE_TEXT_AUTOFIT:
215 : {
216 0 : ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
217 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
218 0 : if( rMarkList.GetMarkCount() == 1 )
219 : {
220 0 : pUndoManager->EnterListAction("", "");
221 0 : mpDrawView->BegUndo();
222 :
223 0 : SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
224 0 : bool bSet = static_cast<const SdrTextFitToSizeTypeItem*>(pObj->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE))->GetValue() != SDRTEXTFIT_NONE;
225 :
226 0 : mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
227 :
228 0 : pObj->SetMergedItem(SdrTextFitToSizeTypeItem(bSet ? SDRTEXTFIT_NONE : SDRTEXTFIT_AUTOFIT));
229 :
230 0 : mpDrawView->EndUndo();
231 0 : pUndoManager->LeaveListAction();
232 : }
233 0 : Cancel();
234 0 : rReq.Done();
235 : }
236 0 : break;
237 :
238 : // area and line attributes: shall have
239 : // an own Execute method (like StateMethode)
240 : case SID_ATTR_FILL_STYLE:
241 : case SID_ATTR_FILL_COLOR:
242 : case SID_ATTR_FILL_GRADIENT:
243 : case SID_ATTR_FILL_HATCH:
244 : case SID_ATTR_FILL_BITMAP:
245 : case SID_ATTR_FILL_SHADOW:
246 : case SID_ATTR_FILL_TRANSPARENCE:
247 : case SID_ATTR_FILL_FLOATTRANSPARENCE:
248 :
249 : case SID_ATTR_LINE_STYLE:
250 : case SID_ATTR_LINE_DASH:
251 : case SID_ATTR_LINE_WIDTH:
252 : case SID_ATTR_LINE_COLOR:
253 : case SID_ATTR_LINEEND_STYLE:
254 : case SID_ATTR_LINE_START:
255 : case SID_ATTR_LINE_END:
256 : case SID_ATTR_LINE_TRANSPARENCE:
257 : case SID_ATTR_LINE_JOINT:
258 : case SID_ATTR_LINE_CAP:
259 :
260 : case SID_ATTR_TEXT_FITTOSIZE:
261 : {
262 0 : if( rReq.GetArgs() )
263 : {
264 0 : mpDrawView->SetAttributes(*rReq.GetArgs());
265 0 : rReq.Done();
266 : }
267 : else
268 : {
269 0 : switch( rReq.GetSlot() )
270 : {
271 : case SID_ATTR_FILL_SHADOW:
272 : case SID_ATTR_FILL_STYLE:
273 : case SID_ATTR_FILL_COLOR:
274 : case SID_ATTR_FILL_GRADIENT:
275 : case SID_ATTR_FILL_HATCH:
276 : case SID_ATTR_FILL_BITMAP:
277 : case SID_ATTR_FILL_TRANSPARENCE:
278 : case SID_ATTR_FILL_FLOATTRANSPARENCE:
279 0 : GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SfxCallMode::ASYNCHRON );
280 0 : break;
281 : case SID_ATTR_LINE_STYLE:
282 : case SID_ATTR_LINE_DASH:
283 : case SID_ATTR_LINE_WIDTH:
284 : case SID_ATTR_LINE_COLOR:
285 : case SID_ATTR_LINE_TRANSPARENCE:
286 : case SID_ATTR_LINE_JOINT:
287 : case SID_ATTR_LINE_CAP:
288 0 : GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SfxCallMode::ASYNCHRON );
289 0 : break;
290 : case SID_ATTR_TEXT_FITTOSIZE:
291 0 : GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SfxCallMode::ASYNCHRON );
292 0 : break;
293 : }
294 : }
295 0 : Cancel();
296 : }
297 0 : break;
298 :
299 : case SID_HYPHENATION:
300 : {
301 : // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
302 : // ^-- should not be used (defaults are wrong) !
303 0 : SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, false);
304 :
305 0 : if( pItem )
306 : {
307 0 : SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
308 0 : bool bValue = pItem->GetValue();
309 0 : aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
310 0 : mpDrawView->SetAttributes( aSet );
311 : }
312 : else // only for testing purpose
313 : {
314 : OSL_FAIL(" no value for hyphenation!");
315 0 : SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
316 0 : bool bValue = true;
317 0 : aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
318 0 : mpDrawView->SetAttributes( aSet );
319 : }
320 0 : rReq.Done();
321 0 : Cancel();
322 : }
323 0 : break;
324 :
325 : case SID_INSERTPAGE:
326 : case SID_INSERTPAGE_QUICK:
327 : case SID_DUPLICATE_PAGE:
328 : {
329 0 : SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
330 0 : Cancel();
331 0 : if(HasCurrentFunction(SID_BEZIER_EDIT) )
332 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
333 0 : if (pNewPage != NULL)
334 0 : SwitchPage((pNewPage->GetPageNum()-1)/2);
335 0 : rReq.Done ();
336 : }
337 0 : break;
338 :
339 : case SID_INSERT_MASTER_PAGE:
340 : {
341 : // Use the API to create a new page.
342 : Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
343 0 : GetDoc()->getUnoModel(), UNO_QUERY);
344 0 : if (xMasterPagesSupplier.is())
345 : {
346 : Reference<drawing::XDrawPages> xMasterPages (
347 0 : xMasterPagesSupplier->getMasterPages());
348 0 : if (xMasterPages.is())
349 : {
350 0 : sal_uInt16 nIndex = GetCurPageId();
351 0 : xMasterPages->insertNewByIndex (nIndex);
352 :
353 : // Create shapes for the default layout.
354 : SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
355 0 : nIndex, PK_STANDARD);
356 0 : pMasterPage->CreateTitleAndLayout (true,true);
357 0 : }
358 : }
359 :
360 0 : Cancel();
361 0 : if(HasCurrentFunction(SID_BEZIER_EDIT))
362 : GetViewFrame()->GetDispatcher()->Execute(
363 0 : SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
364 0 : rReq.Done ();
365 : }
366 0 : break;
367 :
368 : case SID_MODIFYPAGE:
369 : {
370 0 : if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ||
371 0 : (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) )
372 : {
373 0 : if ( mpDrawView->IsTextEdit() )
374 : {
375 0 : mpDrawView->SdrEndTextEdit();
376 : }
377 0 : sal_uInt16 nPage = maTabControl->GetCurPageId() - 1;
378 0 : mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
379 : ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
380 : rReq,
381 : mpActualPage,
382 0 : mePageKind);
383 : }
384 :
385 0 : Cancel();
386 0 : rReq.Done ();
387 : }
388 0 : break;
389 :
390 : case SID_ASSIGN_LAYOUT:
391 : {
392 0 : if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE))
393 : {
394 0 : if ( mpDrawView->IsTextEdit() )
395 0 : mpDrawView->SdrEndTextEdit();
396 :
397 0 : ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
398 : }
399 0 : Cancel();
400 0 : rReq.Done ();
401 : }
402 0 : break;
403 :
404 : case SID_RENAMEPAGE:
405 : case SID_RENAME_MASTER_PAGE:
406 : {
407 0 : if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
408 : {
409 0 : if ( mpDrawView->IsTextEdit() )
410 : {
411 0 : mpDrawView->SdrEndTextEdit();
412 : }
413 :
414 0 : sal_uInt16 nPageId = maTabControl->GetCurPageId();
415 0 : SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
416 0 : ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
417 0 : : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
418 :
419 0 : OUString aTitle = SD_RESSTR(STR_TITLE_RENAMESLIDE);
420 0 : OUString aDescr = SD_RESSTR(STR_DESC_RENAMESLIDE);
421 0 : OUString aPageName = pCurrentPage->GetName();
422 :
423 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
424 : DBG_ASSERT(pFact, "Dialog creation failed!");
425 0 : boost::scoped_ptr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr ));
426 : DBG_ASSERT(aNameDlg, "Dialog creation failed!");
427 0 : aNameDlg->SetText( aTitle );
428 0 : aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
429 0 : aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
430 :
431 0 : if( aNameDlg->Execute() == RET_OK )
432 : {
433 0 : OUString aNewName;
434 0 : aNameDlg->GetName( aNewName );
435 0 : if (aNewName != aPageName)
436 : {
437 : #ifdef DBG_UTIL
438 : bool bResult =
439 : #endif
440 0 : RenameSlide( nPageId, aNewName );
441 : DBG_ASSERT( bResult, "Couldn't rename slide" );
442 0 : }
443 0 : }
444 : }
445 :
446 0 : Cancel();
447 0 : rReq.Ignore ();
448 : }
449 0 : break;
450 :
451 : case SID_RENAMEPAGE_QUICK:
452 : {
453 0 : if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
454 : {
455 0 : if ( mpDrawView->IsTextEdit() )
456 : {
457 0 : mpDrawView->SdrEndTextEdit();
458 : }
459 :
460 0 : maTabControl->StartEditMode( maTabControl->GetCurPageId() );
461 : }
462 :
463 0 : Cancel();
464 0 : rReq.Ignore ();
465 : }
466 0 : break;
467 :
468 : case SID_PAGESIZE : // either this (no menu entries or something else!)
469 : {
470 0 : const SfxItemSet *pArgs = rReq.GetArgs ();
471 :
472 0 : if (pArgs)
473 0 : if (pArgs->Count () == 3)
474 : {
475 0 : SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, false);
476 0 : SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, false);
477 0 : SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, false);
478 :
479 0 : Size aSize (pWidth->GetValue (), pHeight->GetValue ());
480 :
481 0 : SetupPage (aSize, 0, 0, 0, 0, true, false, pScaleAll->GetValue ());
482 0 : rReq.Ignore ();
483 0 : break;
484 : }
485 : #if HAVE_FEATURE_SCRIPTING
486 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
487 : #endif
488 0 : rReq.Ignore ();
489 0 : break;
490 : }
491 :
492 : case SID_PAGEMARGIN : // or this (no menu entries or something else!)
493 : {
494 0 : const SfxItemSet *pArgs = rReq.GetArgs ();
495 :
496 0 : if (pArgs)
497 0 : if (pArgs->Count () == 5)
498 : {
499 0 : SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, false);
500 0 : SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, false);
501 0 : SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, false);
502 0 : SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, false);
503 0 : SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, false);
504 :
505 0 : Size aEmptySize (0, 0);
506 :
507 0 : SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
508 0 : pUpper->GetValue (), pLower->GetValue (),
509 0 : false, true, pScaleAll->GetValue ());
510 0 : rReq.Ignore ();
511 0 : break;
512 : }
513 : #if HAVE_FEATURE_SCRIPTING
514 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
515 : #endif
516 0 : rReq.Ignore ();
517 0 : break;
518 : }
519 :
520 : case SID_ATTR_ZOOMSLIDER:
521 : {
522 0 : const SfxItemSet* pArgs = rReq.GetArgs();
523 :
524 0 : if (pArgs && pArgs->Count () == 1 )
525 : {
526 0 : SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, false);
527 0 : if (CHECK_RANGE (5, pScale->GetValue (), 3000))
528 : {
529 0 : SetZoom (pScale->GetValue ());
530 :
531 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
532 0 : rBindings.Invalidate( SID_ATTR_ZOOM );
533 0 : rBindings.Invalidate( SID_ZOOM_IN );
534 0 : rBindings.Invalidate( SID_ZOOM_OUT );
535 0 : rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
536 :
537 : }
538 : }
539 :
540 0 : Cancel();
541 0 : rReq.Done ();
542 0 : break;
543 : }
544 : case SID_ZOOMING : // no menu entry, but generated from zoom dialog
545 : {
546 0 : const SfxItemSet* pArgs = rReq.GetArgs();
547 :
548 0 : if (pArgs)
549 0 : if (pArgs->Count () == 1)
550 : {
551 0 : SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, false);
552 0 : if (CHECK_RANGE (10, pScale->GetValue (), 1000))
553 : {
554 0 : SetZoom (pScale->GetValue ());
555 :
556 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
557 0 : rBindings.Invalidate( SID_ATTR_ZOOM );
558 0 : rBindings.Invalidate( SID_ZOOM_IN );
559 0 : rBindings.Invalidate( SID_ZOOM_OUT );
560 0 : rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
561 : }
562 : #if HAVE_FEATURE_SCRIPTING
563 0 : else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
564 : #endif
565 0 : rReq.Ignore ();
566 0 : break;
567 : }
568 : #if HAVE_FEATURE_SCRIPTING
569 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
570 : #endif
571 0 : rReq.Ignore ();
572 0 : break;
573 : }
574 :
575 : case SID_ATTR_ZOOM:
576 : {
577 0 : const SfxItemSet* pArgs = rReq.GetArgs();
578 0 : mbZoomOnPage = false;
579 :
580 0 : if ( pArgs )
581 : {
582 : SvxZoomType eZT = static_cast<const SvxZoomItem&>( pArgs->
583 0 : Get( SID_ATTR_ZOOM ) ).GetType();
584 0 : switch( eZT )
585 : {
586 : case SvxZoomType::PERCENT:
587 : SetZoom( (long) static_cast<const SvxZoomItem&>( pArgs->
588 0 : Get( SID_ATTR_ZOOM ) ).GetValue() );
589 0 : break;
590 :
591 : case SvxZoomType::OPTIMAL:
592 : GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
593 0 : SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
594 0 : break;
595 :
596 : case SvxZoomType::PAGEWIDTH:
597 : GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
598 0 : SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
599 0 : break;
600 :
601 : case SvxZoomType::WHOLEPAGE:
602 : GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
603 0 : SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
604 0 : break;
605 : case SvxZoomType::PAGEWIDTH_NOBORDER:
606 : OSL_FAIL("sd::DrawViewShell::FuTemporary(), SvxZoomType::PAGEWIDTH_NOBORDER not handled!" );
607 0 : break;
608 : }
609 0 : rReq.Ignore ();
610 : }
611 : else
612 : {
613 : // open zoom dialog
614 0 : SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
615 : }
616 0 : Cancel();
617 : }
618 0 : break;
619 :
620 : case SID_CHANGEBEZIER:
621 : case SID_CHANGEPOLYGON:
622 0 : if ( mpDrawView->IsTextEdit() )
623 : {
624 0 : mpDrawView->SdrEndTextEdit();
625 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
626 : }
627 :
628 0 : if ( mpDrawView->IsPresObjSelected() )
629 : {
630 0 : ::sd::Window* pWindow = GetActiveWindow();
631 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
632 : }
633 : else
634 : {
635 0 : if( rReq.GetSlot() == SID_CHANGEBEZIER )
636 : {
637 0 : WaitObject aWait( GetActiveWindow() );
638 0 : mpDrawView->ConvertMarkedToPathObj(false);
639 : }
640 : else
641 : {
642 0 : if( mpDrawView->IsVectorizeAllowed() )
643 : {
644 0 : SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
645 : }
646 : else
647 : {
648 0 : WaitObject aWait( GetActiveWindow() );
649 0 : mpDrawView->ConvertMarkedToPolyObj(false);
650 : }
651 : }
652 :
653 0 : Invalidate(SID_CHANGEBEZIER);
654 0 : Invalidate(SID_CHANGEPOLYGON);
655 : }
656 0 : Cancel();
657 :
658 0 : if( HasCurrentFunction(SID_BEZIER_EDIT) )
659 : { // where applicable, activate right edit action
660 : GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
661 0 : SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
662 : }
663 0 : rReq.Ignore ();
664 0 : break;
665 :
666 : case SID_CONVERT_TO_CONTOUR:
667 0 : if ( mpDrawView->IsTextEdit() )
668 : {
669 0 : mpDrawView->SdrEndTextEdit();
670 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
671 : }
672 :
673 0 : if ( mpDrawView->IsPresObjSelected() )
674 : {
675 0 : ::sd::Window* pWindow = GetActiveWindow();
676 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
677 : }
678 : else
679 : {
680 0 : WaitObject aWait( GetActiveWindow() );
681 0 : mpDrawView->ConvertMarkedToPathObj(true);
682 :
683 0 : Invalidate(SID_CONVERT_TO_CONTOUR);
684 : }
685 0 : Cancel();
686 :
687 0 : rReq.Ignore ();
688 0 : break;
689 :
690 : case SID_CONVERT_TO_METAFILE:
691 : case SID_CONVERT_TO_BITMAP:
692 : {
693 : // End text edit mode when it is active because the metafile or
694 : // bitmap that will be created does not support it.
695 0 : if ( mpDrawView->IsTextEdit() )
696 : {
697 0 : mpDrawView->SdrEndTextEdit();
698 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
699 : }
700 :
701 0 : if ( mpDrawView->IsPresObjSelected(true,true,true) )
702 : {
703 0 : ::sd::Window* pWindow = GetActiveWindow();
704 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
705 : }
706 : else
707 : {
708 0 : WaitObject aWait( GetActiveWindow() );
709 :
710 : // create SdrGrafObj from metafile/bitmap
711 0 : Graphic aGraphic;
712 0 : switch (nSId)
713 : {
714 : case SID_CONVERT_TO_METAFILE:
715 : {
716 : // switch on undo for the next operations
717 0 : mpDrawView->BegUndo(SD_RESSTR(STR_UNDO_CONVERT_TO_METAFILE));
718 0 : GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile());
719 0 : aGraphic = Graphic(aMetaFile);
720 : }
721 0 : break;
722 : case SID_CONVERT_TO_BITMAP:
723 : {
724 : // switch on undo for the next operations
725 0 : mpDrawView->BegUndo(SD_RESSTR(STR_UNDO_CONVERT_TO_BITMAP));
726 0 : bool bDone(false);
727 :
728 : // I have to get the image here directly since GetMarkedObjBitmapEx works
729 : // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
730 : // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
731 : // change that, e.g. in the exchange formats. For now I can only add this
732 : // exception to get good results for Svgs. This is how the code gets more
733 : // and more crowded, at last I made a remark for myself to change this
734 : // as one of the next tasks.
735 0 : if(1 == mpDrawView->GetMarkedObjectCount())
736 : {
737 0 : const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
738 :
739 0 : if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
740 : {
741 0 : aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement());
742 0 : bDone = true;
743 : }
744 : }
745 :
746 0 : if(!bDone)
747 : {
748 0 : aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx());
749 : }
750 : }
751 0 : break;
752 : }
753 :
754 : // create new object
755 0 : SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
756 :
757 : // get some necessary info and ensure it
758 0 : const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
759 0 : const size_t nMarkCount(rMarkList.GetMarkCount());
760 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
761 : OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
762 : OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
763 :
764 : // fit rectangle of new graphic object to selection's mark rect
765 0 : Rectangle aAllMarkedRect;
766 0 : rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
767 0 : pGraphicObj->SetLogicRect(aAllMarkedRect);
768 :
769 : // #i71540# to keep the order, it is necessary to replace the lowest object
770 : // of the selection with the new object. This also means that with multi
771 : // selection, all other objects need to be deleted first
772 0 : SdrMark* pFirstMark = rMarkList.GetMark(0);
773 0 : SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
774 :
775 0 : if(nMarkCount > 1)
776 : {
777 : // take first object out of selection
778 0 : mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
779 :
780 : // clear remaining selection
781 0 : mpDrawView->DeleteMarkedObj();
782 : }
783 :
784 : // #i124816# copy layer from lowest object which gets replaced
785 0 : pGraphicObj->SetLayer(pReplacementCandidate->GetLayer());
786 :
787 : // now replace lowest object with new one
788 0 : mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj);
789 :
790 : // switch off undo
791 0 : mpDrawView->EndUndo();
792 : }
793 : }
794 :
795 0 : Cancel();
796 :
797 0 : rReq.Done ();
798 0 : break;
799 :
800 : case SID_SET_DEFAULT:
801 : {
802 0 : boost::scoped_ptr<SfxItemSet> pSet;
803 :
804 0 : if (mpDrawView->IsTextEdit())
805 : {
806 0 : ::Outliner* pOutl = mpDrawView->GetTextEditOutliner();
807 0 : if (pOutl)
808 : {
809 0 : pOutl->RemoveFields(true, SvxURLField::StaticType());
810 : }
811 :
812 0 : pSet.reset(new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END ));
813 0 : mpDrawView->SetAttributes( *pSet, true );
814 : }
815 : else
816 : {
817 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
818 0 : const size_t nCount = rMarkList.GetMarkCount();
819 :
820 : // For every presentation object a SfxItemSet of hard attributes
821 : // and the UserCall is stored in this list. This is because
822 : // at the following mpDrawView->SetAttributes( *pSet, sal_True )
823 : // they get lost and have to be restored.
824 0 : std::vector<std::pair<SfxItemSet*,SdrObjUserCall*> > aAttrList;
825 0 : SdPage* pPresPage = static_cast<SdPage*>( mpDrawView->GetSdrPageView()->GetPage() );
826 :
827 0 : for ( size_t i = 0; i < nCount; ++i )
828 : {
829 0 : SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
830 :
831 0 : if( pPresPage->IsPresObj( pObj ) )
832 : {
833 0 : SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 );
834 0 : pNewSet->Put(pObj->GetMergedItemSet());
835 0 : aAttrList.push_back(std::make_pair(pNewSet, pObj->GetUserCall()));
836 : }
837 : }
838 :
839 0 : pSet.reset(new SfxItemSet( GetPool() ));
840 0 : mpDrawView->SetAttributes( *pSet, true );
841 :
842 0 : sal_uLong j = 0;
843 :
844 0 : for ( size_t i = 0; i < nCount; ++i )
845 : {
846 0 : SfxStyleSheet* pSheet = NULL;
847 0 : SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
848 :
849 0 : if (pObj->GetObjIdentifier() == OBJ_TITLETEXT)
850 : {
851 0 : pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
852 0 : if (pSheet)
853 0 : pObj->SetStyleSheet(pSheet, false);
854 : }
855 0 : else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
856 : {
857 0 : for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
858 : {
859 0 : pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
860 : DBG_ASSERT(pSheet, "Template for outline object not found");
861 0 : if (pSheet)
862 : {
863 0 : pObj->StartListening(*pSheet);
864 :
865 0 : if( nLevel == 1 )
866 : // text frame listens on StyleSheet of level1
867 0 : pObj->NbcSetStyleSheet(pSheet, false);
868 :
869 : }
870 : }
871 : }
872 :
873 0 : if( pPresPage->IsPresObj( pObj ) )
874 : {
875 0 : std::pair<SfxItemSet*,SdrObjUserCall*> &rAttr = aAttrList[j++];
876 :
877 0 : boost::scoped_ptr<SfxItemSet> pNewSet(rAttr.first);
878 0 : SdrObjUserCall* pUserCall = rAttr.second;
879 :
880 0 : if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SfxItemState::SET )
881 : {
882 0 : pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
883 : }
884 :
885 0 : if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SfxItemState::SET )
886 : {
887 0 : pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
888 : }
889 :
890 0 : if( pUserCall )
891 0 : pObj->SetUserCall( pUserCall );
892 : }
893 0 : }
894 : }
895 :
896 0 : pSet.reset();
897 0 : Cancel();
898 : }
899 0 : break;
900 :
901 : case SID_DELETE_SNAPITEM:
902 : {
903 : SdrPageView* pPV;
904 0 : Point aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
905 0 : sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size(
906 0 : FuPoor::HITPIX, 0 ) ).Width();
907 : sal_uInt16 nHelpLine;
908 :
909 0 : mbMousePosFreezed = false;
910 :
911 0 : if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
912 : {
913 0 : pPV->DeleteHelpLine( nHelpLine );
914 : }
915 0 : Cancel();
916 0 : rReq.Ignore ();
917 : }
918 0 : break;
919 :
920 : case SID_DELETE_PAGE:
921 : case SID_DELETE_MASTER_PAGE:
922 0 : DeleteActualPage();
923 0 : Cancel();
924 0 : rReq.Ignore ();
925 0 : break;
926 :
927 : case SID_DELETE_LAYER:
928 0 : DeleteActualLayer();
929 0 : Cancel();
930 0 : rReq.Ignore ();
931 0 : break;
932 :
933 : case SID_ORIGINAL_SIZE:
934 0 : mpDrawView->SetMarkedOriginalSize();
935 0 : Cancel();
936 0 : rReq.Done();
937 0 : break;
938 :
939 : case SID_DRAW_FONTWORK:
940 : case SID_DRAW_FONTWORK_VERTICAL:
941 : {
942 0 : svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think)
943 0 : Cancel();
944 0 : rReq.Done();
945 : }
946 0 : break;
947 :
948 : case SID_SAVE_GRAPHIC:
949 : {
950 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
951 0 : if( rMarkList.GetMarkCount() == 1 )
952 : {
953 0 : SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
954 0 : if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP )
955 : {
956 0 : GraphicObject aGraphicObject( static_cast<SdrGrafObj*>( pObj )->GetGraphicObject() );
957 : {
958 0 : GraphicHelper::ExportGraphic( aGraphicObject.GetGraphic(), "" );
959 0 : }
960 : }
961 : }
962 0 : Cancel();
963 0 : rReq.Ignore();
964 : }
965 0 : break;
966 :
967 : case SID_EXTERNAL_EDIT:
968 : {
969 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
970 0 : if( rMarkList.GetMarkCount() == 1 )
971 : {
972 0 : SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
973 0 : if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP )
974 : {
975 0 : GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
976 : m_ExternalEdits.push_back(
977 : std::unique_ptr<SdrExternalToolEdit>(
978 0 : new SdrExternalToolEdit(mpDrawView, pObj)));
979 0 : m_ExternalEdits.back()->Edit( &aGraphicObject );
980 : }
981 : }
982 0 : Cancel();
983 0 : rReq.Ignore();
984 : }
985 0 : break;
986 :
987 : case SID_COMPRESS_GRAPHIC:
988 : {
989 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
990 0 : if( rMarkList.GetMarkCount() == 1 )
991 : {
992 0 : SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
993 :
994 0 : if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP )
995 : {
996 0 : SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj);
997 0 : ScopedVclPtrInstance< CompressGraphicsDialog > dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() );
998 0 : if ( dialog->Execute() == RET_OK )
999 : {
1000 0 : SdrGrafObj* pNewObject = dialog->GetCompressedSdrGrafObj();
1001 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1002 0 : OUString aUndoString = mpDrawView->GetDescriptionOfMarkedObjects();
1003 0 : aUndoString += " Compress";
1004 0 : mpDrawView->BegUndo( aUndoString );
1005 0 : mpDrawView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
1006 0 : mpDrawView->EndUndo();
1007 0 : }
1008 : }
1009 : }
1010 0 : Cancel();
1011 0 : rReq.Ignore();
1012 : }
1013 0 : break;
1014 :
1015 : case SID_ATTRIBUTES_LINE: // BASIC
1016 : {
1017 0 : SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1018 0 : Cancel();
1019 : }
1020 0 : break;
1021 :
1022 : case SID_ATTRIBUTES_AREA: // BASIC
1023 : {
1024 0 : SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1025 0 : Cancel();
1026 : }
1027 0 : break;
1028 :
1029 : case SID_ATTR_TRANSFORM:
1030 : {
1031 0 : SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1032 0 : Invalidate(SID_RULER_OBJECT);
1033 0 : Cancel();
1034 : }
1035 0 : break;
1036 :
1037 : case SID_CHAR_DLG_EFFECT:
1038 : case SID_CHAR_DLG: // BASIC
1039 : {
1040 0 : SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1041 0 : Cancel();
1042 : }
1043 0 : break;
1044 :
1045 : case SID_PARA_DLG:
1046 : {
1047 0 : SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1048 0 : Cancel();
1049 : }
1050 0 : break;
1051 :
1052 : case FN_NUM_BULLET_ON:
1053 : {
1054 : // The value (sal_uInt16)0xFFFF means set bullet on/off.
1055 0 : SfxUInt16Item aItem(FN_SVX_SET_BULLET, (sal_uInt16)0xFFFF);
1056 0 : GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SfxCallMode::RECORD, &aItem, 0L );
1057 : }
1058 0 : break;
1059 :
1060 : case FN_NUM_NUMBERING_ON:
1061 : {
1062 : // The value (sal_uInt16)0xFFFF means set bullet on/off.
1063 0 : SfxUInt16Item aItem(FN_SVX_SET_NUMBER, (sal_uInt16)0xFFFF);
1064 0 : GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SfxCallMode::RECORD, &aItem, 0L );
1065 : }
1066 0 : break;
1067 :
1068 : case SID_OUTLINE_BULLET:
1069 : case FN_SVX_SET_BULLET:
1070 : case FN_SVX_SET_NUMBER:
1071 : {
1072 0 : SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1073 0 : Cancel();
1074 : }
1075 0 : break;
1076 :
1077 : case FN_INSERT_SOFT_HYPHEN:
1078 : case FN_INSERT_HARDHYPHEN:
1079 : case FN_INSERT_HARD_SPACE:
1080 : case SID_INSERT_RLM :
1081 : case SID_INSERT_LRM :
1082 : case SID_INSERT_ZWNBSP :
1083 : case SID_INSERT_ZWSP:
1084 : case SID_CHARMAP:
1085 : {
1086 0 : SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1087 0 : Cancel();
1088 : }
1089 0 : break;
1090 :
1091 : case SID_PRESENTATION_LAYOUT:
1092 : {
1093 0 : SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
1094 0 : Cancel();
1095 : }
1096 0 : break;
1097 :
1098 : case SID_PASTE_SPECIAL:
1099 : {
1100 0 : SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1101 0 : Cancel();
1102 0 : rReq.Ignore ();
1103 : }
1104 0 : break;
1105 :
1106 : case SID_CHANGE_PICTURE:
1107 : case SID_INSERT_GRAPHIC:
1108 : {
1109 0 : SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1110 0 : Cancel();
1111 0 : rReq.Ignore ();
1112 0 : Invalidate(SID_DRAWTBX_INSERT);
1113 : }
1114 0 : break;
1115 :
1116 : case SID_INSERT_AVMEDIA:
1117 : {
1118 0 : SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1119 :
1120 0 : Cancel();
1121 0 : rReq.Ignore ();
1122 :
1123 0 : Invalidate(SID_DRAWTBX_INSERT);
1124 : }
1125 0 : break;
1126 :
1127 : case SID_INSERT_OBJECT:
1128 : case SID_INSERT_PLUGIN:
1129 : case SID_INSERT_SOUND:
1130 : case SID_INSERT_VIDEO:
1131 : case SID_INSERT_FLOATINGFRAME:
1132 : case SID_INSERT_MATH:
1133 : case SID_INSERT_DIAGRAM:
1134 : case SID_ATTR_TABLE:
1135 : {
1136 0 : SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1137 : // Set the selection tool as the old one. This in particular important for the
1138 : // zoom function, in which clicking without dragging zooms as well, and that
1139 : // makes exiting the object editing mode impossible.
1140 0 : SetOldFunction( FuSelection::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1141 0 : Cancel();
1142 0 : rReq.Ignore ();
1143 :
1144 0 : Invalidate(SID_DRAWTBX_INSERT);
1145 : }
1146 0 : break;
1147 : #if HAVE_FEATURE_GLTF
1148 : case SID_INSERT_3DMODEL:
1149 : {
1150 0 : SetCurrentFunction( FuInsert3DModel::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1151 :
1152 0 : Cancel();
1153 0 : rReq.Ignore ();
1154 :
1155 0 : Invalidate(SID_DRAWTBX_INSERT);
1156 : }
1157 0 : break;
1158 : #endif
1159 :
1160 : case SID_COPYOBJECTS:
1161 : {
1162 0 : if ( mpDrawView->IsPresObjSelected(false, true) )
1163 : {
1164 0 : ::sd::Window* pWindow = GetActiveWindow();
1165 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
1166 : }
1167 : else
1168 : {
1169 0 : if ( mpDrawView->IsTextEdit() )
1170 : {
1171 0 : mpDrawView->SdrEndTextEdit();
1172 : }
1173 :
1174 0 : SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1175 : }
1176 0 : Cancel();
1177 0 : rReq.Ignore ();
1178 : }
1179 0 : break;
1180 :
1181 : case SID_INSERTFILE: // BASIC
1182 : {
1183 0 : Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
1184 0 : SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1185 0 : Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
1186 0 : Cancel();
1187 0 : rReq.Done ();
1188 :
1189 0 : Invalidate(SID_DRAWTBX_INSERT);
1190 : }
1191 0 : break;
1192 :
1193 : case SID_SELECT_BACKGROUND:
1194 : case SID_PAGESETUP: // BASIC ??
1195 : {
1196 0 : SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1197 0 : Cancel();
1198 0 : rReq.Ignore (); // we generate independent macros !!
1199 : }
1200 0 : break;
1201 :
1202 : case SID_BEFORE_OBJ:
1203 : case SID_BEHIND_OBJ:
1204 : {
1205 0 : SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
1206 0 : Invalidate( SID_POSITION );
1207 0 : rReq.Ignore ();
1208 : // finishes itself, no Cancel() needed!
1209 : }
1210 0 : break;
1211 :
1212 : case SID_REVERSE_ORDER: // BASIC
1213 : {
1214 0 : mpDrawView->ReverseOrderOfMarked();
1215 0 : Invalidate( SID_POSITION );
1216 0 : Cancel();
1217 0 : rReq.Done ();
1218 : }
1219 0 : break;
1220 :
1221 : case SID_ANIMATION_EFFECTS:
1222 : {
1223 0 : SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
1224 0 : Cancel();
1225 : }
1226 0 : break;
1227 :
1228 : case SID_LINEEND_POLYGON:
1229 : {
1230 0 : SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1231 0 : Cancel();
1232 : }
1233 0 : break;
1234 :
1235 : case SID_CAPTUREPOINT:
1236 : // negative value to signal call from menu
1237 0 : maMousePos = Point(-1,-1);
1238 : // fall-through
1239 : case SID_SET_SNAPITEM:
1240 : {
1241 0 : SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
1242 0 : Cancel();
1243 : }
1244 0 : break;
1245 :
1246 : case SID_MANAGE_LINKS:
1247 : {
1248 0 : SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1249 0 : Cancel();
1250 0 : rReq.Ignore ();
1251 : }
1252 0 : break;
1253 :
1254 : case SID_THESAURUS:
1255 : {
1256 0 : SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1257 0 : Cancel();
1258 0 : rReq.Ignore ();
1259 : }
1260 0 : break;
1261 :
1262 : case SID_TEXTATTR_DLG:
1263 : {
1264 0 : SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1265 0 : Cancel();
1266 0 : rReq.Ignore ();
1267 : }
1268 0 : break;
1269 :
1270 : case SID_MEASURE_DLG:
1271 : {
1272 0 : SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1273 0 : Cancel();
1274 0 : rReq.Ignore ();
1275 : }
1276 0 : break;
1277 :
1278 : case SID_CONNECTION_DLG:
1279 : {
1280 0 : SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1281 0 : Cancel();
1282 0 : rReq.Done();
1283 : }
1284 0 : break;
1285 :
1286 : case SID_CONNECTION_NEW_ROUTING:
1287 : {
1288 0 : SfxItemSet aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA, SDRATTR_EDGELINE3DELTA );
1289 0 : GetView()->SetAttributes( aDefAttr, true ); // (ReplaceAll)
1290 :
1291 0 : Cancel();
1292 0 : rReq.Done();
1293 : }
1294 0 : break;
1295 :
1296 : case SID_TWAIN_SELECT:
1297 : {
1298 0 : if( mxScannerManager.is() )
1299 : {
1300 : try
1301 : {
1302 : const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext >
1303 0 : aContexts( mxScannerManager->getAvailableScanners() );
1304 :
1305 0 : if( aContexts.getLength() )
1306 : {
1307 0 : ::com::sun::star::scanner::ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
1308 0 : mxScannerManager->configureScannerAndScan( aContext, mxScannerListener );
1309 0 : }
1310 : }
1311 0 : catch(...)
1312 : {
1313 : }
1314 : }
1315 :
1316 0 : Cancel();
1317 0 : rReq.Done();
1318 : }
1319 0 : break;
1320 :
1321 : case SID_TWAIN_TRANSFER:
1322 : {
1323 0 : bool bDone = false;
1324 :
1325 0 : if( mxScannerManager.is() )
1326 : {
1327 : try
1328 : {
1329 0 : const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext > aContexts( mxScannerManager->getAvailableScanners() );
1330 :
1331 0 : if( aContexts.getLength() )
1332 : {
1333 0 : mxScannerManager->startScan( aContexts.getConstArray()[ 0 ], mxScannerListener );
1334 0 : bDone = true;
1335 0 : }
1336 : }
1337 0 : catch( ... )
1338 : {
1339 : }
1340 : }
1341 :
1342 0 : if( !bDone )
1343 : {
1344 : #ifndef UNX
1345 : const sal_uInt16 nId = STR_TWAIN_NO_SOURCE;
1346 : #else
1347 0 : const sal_uInt16 nId = STR_TWAIN_NO_SOURCE_UNX;
1348 : #endif
1349 :
1350 0 : ::sd::Window* pWindow = GetActiveWindow();
1351 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(nId))->Execute();
1352 : }
1353 : else
1354 : {
1355 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
1356 0 : rBindings.Invalidate( SID_TWAIN_SELECT );
1357 0 : rBindings.Invalidate( SID_TWAIN_TRANSFER );
1358 : }
1359 :
1360 0 : Cancel();
1361 0 : rReq.Done();
1362 : }
1363 0 : break;
1364 :
1365 : case SID_POLYGON_MORPHING:
1366 : {
1367 0 : SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1368 0 : Cancel();
1369 : }
1370 0 : break;
1371 :
1372 : case SID_VECTORIZE:
1373 : {
1374 0 : SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
1375 0 : Cancel();
1376 : }
1377 0 : break;
1378 :
1379 : case SID_INSERTLAYER:
1380 : {
1381 0 : if ( mpDrawView->IsTextEdit() )
1382 : {
1383 0 : mpDrawView->SdrEndTextEdit();
1384 : }
1385 :
1386 0 : SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
1387 0 : sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
1388 0 : sal_uInt16 nLayer = nLayerCnt - 2 + 1;
1389 0 : OUString aLayerName = SD_RESSTR(STR_LAYER) + OUString::number(nLayer);
1390 0 : OUString aLayerTitle, aLayerDesc;
1391 0 : bool bIsVisible = false;
1392 0 : bool bIsLocked = false;
1393 0 : bool bIsPrintable = false;
1394 :
1395 0 : const SfxItemSet* pArgs = rReq.GetArgs();
1396 :
1397 0 : if (! pArgs)
1398 : {
1399 0 : SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END );
1400 :
1401 0 : aNewAttr.Put( SdAttrLayerName( aLayerName ) );
1402 0 : aNewAttr.Put( SdAttrLayerTitle() );
1403 0 : aNewAttr.Put( SdAttrLayerDesc() );
1404 0 : aNewAttr.Put( SdAttrLayerVisible() );
1405 0 : aNewAttr.Put( SdAttrLayerPrintable() );
1406 0 : aNewAttr.Put( SdAttrLayerLocked() );
1407 0 : aNewAttr.Put( SdAttrLayerThisPage() );
1408 :
1409 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
1410 0 : boost::scoped_ptr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, true, SD_RESSTR(STR_INSERTLAYER)) : 0);
1411 0 : if( pDlg )
1412 : {
1413 0 : pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() );
1414 :
1415 : // test for already existing names
1416 0 : bool bLoop = true;
1417 0 : while( bLoop && pDlg->Execute() == RET_OK )
1418 : {
1419 0 : pDlg->GetAttr( aNewAttr );
1420 0 : aLayerName = static_cast<const SdAttrLayerName &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
1421 :
1422 0 : if( rLayerAdmin.GetLayer( aLayerName, false )
1423 0 : || aLayerName.isEmpty() )
1424 : {
1425 : // name already exists
1426 : ScopedVclPtrInstance<WarningBox> aWarningBox (
1427 0 : GetParentWindow(),
1428 : WinBits( WB_OK ),
1429 0 : SD_RESSTR(STR_WARN_NAME_DUPLICATE));
1430 0 : aWarningBox->Execute();
1431 : }
1432 : else
1433 0 : bLoop = false;
1434 : }
1435 0 : if( bLoop ) // was canceled
1436 : {
1437 0 : pDlg.reset();
1438 0 : Cancel();
1439 0 : rReq.Ignore ();
1440 0 : break;
1441 : }
1442 : else
1443 : {
1444 0 : aLayerTitle = static_cast<const SdAttrLayerTitle &>( aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue ();
1445 0 : aLayerDesc = static_cast<const SdAttrLayerDesc &>( aNewAttr.Get (ATTR_LAYER_DESC)).GetValue ();
1446 0 : bIsVisible = static_cast<const SdAttrLayerVisible &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
1447 0 : bIsLocked = static_cast<const SdAttrLayerLocked &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ;
1448 0 : bIsPrintable = static_cast<const SdAttrLayerPrintable &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ;
1449 : }
1450 0 : }
1451 : }
1452 0 : else if (pArgs->Count () != 4)
1453 : {
1454 : #if HAVE_FEATURE_SCRIPTING
1455 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
1456 : #endif
1457 0 : Cancel();
1458 0 : rReq.Ignore ();
1459 0 : break;
1460 : }
1461 : else
1462 : {
1463 0 : SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, false);
1464 0 : SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, false);
1465 0 : SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, false);
1466 0 : SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, false);
1467 :
1468 0 : aLayerName = pLayerName->GetValue ();
1469 0 : bIsVisible = pIsVisible->GetValue ();
1470 0 : bIsLocked = pIsLocked->GetValue ();
1471 0 : bIsPrintable = pIsPrintable->GetValue ();
1472 : }
1473 :
1474 0 : OUString aPrevLayer = mpDrawView->GetActiveLayer();
1475 : SdrLayer* pLayer;
1476 0 : sal_uInt16 nPrevLayer = 0;
1477 0 : nLayerCnt = rLayerAdmin.GetLayerCount();
1478 :
1479 0 : for ( nLayer = 0; nLayer < nLayerCnt; nLayer++ )
1480 : {
1481 0 : pLayer = rLayerAdmin.GetLayer(nLayer);
1482 0 : OUString aName = pLayer->GetName();
1483 :
1484 0 : if ( aPrevLayer == aName )
1485 : {
1486 0 : nPrevLayer = std::max(nLayer, (sal_uInt16) 4);
1487 : }
1488 0 : }
1489 :
1490 0 : mpDrawView->InsertNewLayer(aLayerName, nPrevLayer + 1);
1491 0 : pLayer = rLayerAdmin.GetLayer(aLayerName, false);
1492 0 : if( pLayer )
1493 : {
1494 0 : pLayer->SetTitle( aLayerTitle );
1495 0 : pLayer->SetDescription( aLayerDesc );
1496 : }
1497 :
1498 0 : mpDrawView->SetLayerVisible( aLayerName, bIsVisible );
1499 0 : mpDrawView->SetLayerLocked( aLayerName, bIsLocked);
1500 0 : mpDrawView->SetLayerPrintable(aLayerName, bIsPrintable);
1501 :
1502 0 : mpDrawView->SetActiveLayer(aLayerName);
1503 :
1504 0 : ResetActualLayer();
1505 :
1506 0 : GetDoc()->SetChanged(true);
1507 :
1508 : GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER,
1509 0 : SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
1510 :
1511 0 : Cancel();
1512 0 : rReq.Done ();
1513 : }
1514 0 : break;
1515 :
1516 : case SID_MODIFYLAYER:
1517 : {
1518 0 : if(!GetLayerTabControl()) // #i87182#
1519 : {
1520 : OSL_ENSURE(false, "No LayerTabBar (!)");
1521 0 : Cancel();
1522 0 : rReq.Ignore();
1523 0 : break;
1524 : }
1525 :
1526 0 : if ( mpDrawView->IsTextEdit() )
1527 : {
1528 0 : mpDrawView->SdrEndTextEdit();
1529 : }
1530 :
1531 0 : SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
1532 0 : sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId();
1533 0 : OUString aLayerName = GetLayerTabControl()->GetPageText(nCurPage);
1534 0 : SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName, false);
1535 :
1536 0 : OUString aLayerTitle = pLayer->GetTitle();
1537 0 : OUString aLayerDesc = pLayer->GetDescription();
1538 :
1539 0 : OUString aOldLayerName(aLayerName);
1540 0 : OUString aOldLayerTitle(aLayerTitle);
1541 0 : OUString aOldLayerDesc(aLayerDesc);
1542 :
1543 : bool bIsVisible, bIsLocked, bIsPrintable;
1544 0 : bool bOldIsVisible = bIsVisible = mpDrawView->IsLayerVisible(aLayerName);
1545 0 : bool bOldIsLocked = bIsLocked = mpDrawView->IsLayerLocked(aLayerName);
1546 0 : bool bOldIsPrintable = bIsPrintable = mpDrawView->IsLayerPrintable(aLayerName);
1547 :
1548 0 : const SfxItemSet* pArgs = rReq.GetArgs();
1549 : // is it allowed to delete the layer?
1550 0 : bool bDelete = true;
1551 :
1552 0 : OUString aLayoutLayer = SD_RESSTR(STR_LAYER_LAYOUT);
1553 0 : OUString aControlsLayer = SD_RESSTR(STR_LAYER_CONTROLS);
1554 0 : OUString aMeasureLinesLayer = SD_RESSTR(STR_LAYER_MEASURELINES);
1555 0 : OUString aBackgroundLayer = SD_RESSTR(STR_LAYER_BCKGRND);
1556 0 : OUString aBackgroundObjLayer = SD_RESSTR(STR_LAYER_BCKGRNDOBJ);
1557 :
1558 0 : if( aLayerName == aLayoutLayer || aLayerName == aControlsLayer ||
1559 0 : aLayerName == aMeasureLinesLayer ||
1560 0 : aLayerName == aBackgroundLayer || aLayerName == aBackgroundObjLayer )
1561 : {
1562 0 : bDelete = false;
1563 : }
1564 :
1565 0 : if (! pArgs)
1566 : {
1567 0 : SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END );
1568 :
1569 0 : aNewAttr.Put( SdAttrLayerName( aLayerName ) );
1570 0 : aNewAttr.Put( SdAttrLayerTitle( aLayerTitle ) );
1571 0 : aNewAttr.Put( SdAttrLayerDesc( aLayerDesc ) );
1572 0 : aNewAttr.Put( SdAttrLayerVisible( bIsVisible ) );
1573 0 : aNewAttr.Put( SdAttrLayerLocked( bIsLocked ) );
1574 0 : aNewAttr.Put( SdAttrLayerPrintable( bIsPrintable ) );
1575 0 : aNewAttr.Put( SdAttrLayerThisPage() );
1576 :
1577 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
1578 0 : boost::scoped_ptr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, bDelete, SD_RESSTR(STR_MODIFYLAYER)) : 0);
1579 0 : if( pDlg )
1580 : {
1581 0 : pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() );
1582 :
1583 : // test for already existing names
1584 0 : bool bLoop = true;
1585 0 : sal_uInt16 nRet = 0;
1586 0 : while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) )
1587 : {
1588 0 : pDlg->GetAttr( aNewAttr );
1589 0 : aLayerName = static_cast<const SdAttrLayerName &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
1590 :
1591 0 : if( (rLayerAdmin.GetLayer( aLayerName, false ) &&
1592 0 : aLayerName != aOldLayerName) || aLayerName.isEmpty() )
1593 : {
1594 : // name already exists
1595 : ScopedVclPtrInstance<WarningBox> aWarningBox (
1596 0 : GetParentWindow(),
1597 : WinBits( WB_OK ),
1598 0 : SD_RESSTR(STR_WARN_NAME_DUPLICATE));
1599 0 : aWarningBox->Execute();
1600 : }
1601 : else
1602 0 : bLoop = false;
1603 : }
1604 0 : switch (nRet)
1605 : {
1606 : case RET_OK :
1607 0 : aLayerTitle = static_cast<const SdAttrLayerTitle &>( aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue ();
1608 0 : aLayerDesc = static_cast<const SdAttrLayerDesc &>( aNewAttr.Get (ATTR_LAYER_DESC)).GetValue ();
1609 0 : bIsVisible = static_cast<const SdAttrLayerVisible &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
1610 0 : bIsLocked = static_cast<const SdAttrLayerLocked &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue ();
1611 0 : bIsPrintable = static_cast<const SdAttrLayerLocked &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue ();
1612 0 : break;
1613 :
1614 : default :
1615 0 : pDlg.reset();
1616 0 : rReq.Ignore ();
1617 0 : Cancel ();
1618 0 : return;
1619 : }
1620 0 : }
1621 : }
1622 0 : else if (pArgs->Count () == 4)
1623 : {
1624 0 : SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, false);
1625 0 : SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, false);
1626 0 : SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, false);
1627 0 : SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, false);
1628 :
1629 0 : aLayerName = pLayerName->GetValue ();
1630 0 : bIsVisible = pIsVisible->GetValue ();
1631 0 : bIsLocked = pIsLocked->GetValue ();
1632 0 : bIsPrintable = pIsPrintable->GetValue ();
1633 : }
1634 : else
1635 : {
1636 : #if HAVE_FEATURE_SCRIPTING
1637 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
1638 : #endif
1639 0 : Cancel ();
1640 0 : rReq.Ignore ();
1641 0 : break;
1642 : }
1643 :
1644 0 : ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
1645 : SdLayerModifyUndoAction* pAction = new SdLayerModifyUndoAction(
1646 0 : GetDoc(),
1647 : pLayer,
1648 : // old values
1649 : aOldLayerName,
1650 : aOldLayerTitle,
1651 : aOldLayerDesc,
1652 : bOldIsVisible,
1653 : bOldIsLocked,
1654 : bOldIsPrintable,
1655 : // new values
1656 : aLayerName,
1657 : aLayerTitle,
1658 : aLayerDesc,
1659 : bIsVisible,
1660 : bIsLocked,
1661 : bIsPrintable
1662 0 : );
1663 0 : pManager->AddUndoAction( pAction );
1664 :
1665 0 : ModifyLayer( pLayer, aLayerName, aLayerTitle, aLayerDesc, bIsVisible, bIsLocked, bIsPrintable );
1666 :
1667 0 : Cancel();
1668 0 : rReq.Done ();
1669 : }
1670 0 : break;
1671 :
1672 : case SID_RENAMELAYER:
1673 : {
1674 0 : if ( mpDrawView->IsTextEdit() )
1675 : {
1676 0 : mpDrawView->SdrEndTextEdit();
1677 : }
1678 :
1679 0 : if(GetLayerTabControl()) // #i87182#
1680 : {
1681 0 : GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
1682 : }
1683 : else
1684 : {
1685 : OSL_ENSURE(false, "No LayerTabBar (!)");
1686 : }
1687 :
1688 0 : Cancel();
1689 0 : rReq.Ignore ();
1690 : }
1691 0 : break;
1692 :
1693 : case SID_EDIT_HYPERLINK :
1694 : {
1695 0 : GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
1696 :
1697 0 : Cancel();
1698 0 : rReq.Done ();
1699 : }
1700 0 : break;
1701 :
1702 : case SID_OPEN_HYPERLINK:
1703 : {
1704 0 : OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
1705 0 : if ( pOutView )
1706 : {
1707 0 : const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
1708 0 : if ( pFieldItem )
1709 : {
1710 0 : const SvxFieldData* pField = pFieldItem->GetField();
1711 0 : if( pField && pField->ISA( SvxURLField ) )
1712 : {
1713 0 : const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField );
1714 :
1715 0 : SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() );
1716 0 : SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() );
1717 :
1718 0 : OUString aReferName;
1719 0 : SfxViewFrame* pFrame = GetViewFrame();
1720 0 : SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium();
1721 0 : if (pMed)
1722 0 : aReferName = pMed->GetName();
1723 :
1724 0 : SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
1725 0 : SfxStringItem aReferer( SID_REFERER, aReferName );
1726 :
1727 0 : SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
1728 0 : SfxBoolItem aBrowsing( SID_BROWSE, true );
1729 :
1730 0 : SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1731 0 : if (pViewFrm)
1732 : pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
1733 : SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
1734 : &aUrl, &aTarget,
1735 : &aFrm, &aReferer,
1736 : &aNewView, &aBrowsing,
1737 0 : 0L );
1738 : }
1739 : }
1740 : }
1741 0 : Cancel();
1742 0 : rReq.Done ();
1743 : }
1744 0 : break;
1745 :
1746 : case SID_HYPERLINK_SETLINK:
1747 : {
1748 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
1749 :
1750 0 : if (pReqArgs)
1751 : {
1752 : const SvxHyperlinkItem* pHLItem =
1753 0 : static_cast<const SvxHyperlinkItem*>( &pReqArgs->Get(SID_HYPERLINK_SETLINK) );
1754 :
1755 0 : if (pHLItem->GetInsertMode() == HLINK_FIELD)
1756 : {
1757 0 : InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
1758 0 : pHLItem->GetTargetFrame(), NULL);
1759 : }
1760 0 : else if (pHLItem->GetInsertMode() == HLINK_BUTTON)
1761 : {
1762 0 : InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
1763 0 : pHLItem->GetTargetFrame(), NULL);
1764 : }
1765 0 : else if (pHLItem->GetInsertMode() == HLINK_DEFAULT)
1766 : {
1767 0 : OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
1768 :
1769 0 : if (pOlView)
1770 : {
1771 0 : InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
1772 0 : pHLItem->GetTargetFrame(), NULL);
1773 : }
1774 : else
1775 : {
1776 0 : InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
1777 0 : pHLItem->GetTargetFrame(), NULL);
1778 : }
1779 : }
1780 : }
1781 :
1782 0 : Cancel();
1783 0 : rReq.Ignore ();
1784 : }
1785 0 : break;
1786 :
1787 : case SID_HIDE_LAST_LEVEL:
1788 : {
1789 0 : ESelection aSel;
1790 : // fdo#78151 editing a PRESOBJ_OUTLINE in a master page ?
1791 0 : ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
1792 0 : if (pOL)
1793 : {
1794 : //we are on the last paragraph
1795 0 : aSel.Adjust();
1796 0 : if (aSel.nEndPara == pOL->GetParagraphCount() - 1)
1797 : {
1798 0 : sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara);
1799 : //there exists a previous numbering level
1800 0 : if (nDepth != sal_uInt16(-1) && nDepth > 0)
1801 : {
1802 0 : Paragraph* pPara = pOL->GetParagraph(aSel.nEndPara);
1803 0 : pOL->Remove(pPara, 1);
1804 : }
1805 : }
1806 : }
1807 0 : Cancel();
1808 0 : rReq.Done ();
1809 : }
1810 0 : break;
1811 :
1812 : case SID_SHOW_NEXT_LEVEL:
1813 : {
1814 0 : ESelection aSel;
1815 : // fdo#78151 editing a PRESOBJ_OUTLINE in a master page ?
1816 0 : ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
1817 0 : if (pOL)
1818 : {
1819 : //we are on the last paragraph
1820 0 : aSel.Adjust();
1821 0 : if (aSel.nEndPara == pOL->GetParagraphCount() - 1)
1822 : {
1823 0 : sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara);
1824 : //there exists a previous numbering level
1825 0 : if (nDepth != sal_uInt16(-1) && nDepth < 8)
1826 : {
1827 0 : sal_uInt16 nNewDepth = nDepth+1;
1828 0 : pOL->Insert(SD_RESSTR(STR_PRESOBJ_MPOUTLINE+nNewDepth), EE_PARA_APPEND, nNewDepth);
1829 : }
1830 : }
1831 : }
1832 0 : Cancel();
1833 0 : rReq.Done ();
1834 : }
1835 0 : break;
1836 :
1837 : case SID_INSERT_FLD_DATE_FIX:
1838 : case SID_INSERT_FLD_DATE_VAR:
1839 : case SID_INSERT_FLD_TIME_FIX:
1840 : case SID_INSERT_FLD_TIME_VAR:
1841 : case SID_INSERT_FLD_AUTHOR:
1842 : case SID_INSERT_FLD_PAGE:
1843 : case SID_INSERT_FLD_PAGE_TITLE:
1844 : case SID_INSERT_FLD_PAGES:
1845 : case SID_INSERT_FLD_FILE:
1846 : {
1847 0 : sal_uInt16 nMul = 1;
1848 0 : boost::scoped_ptr<SvxFieldItem> pFieldItem;
1849 :
1850 0 : switch( nSId )
1851 : {
1852 : case SID_INSERT_FLD_DATE_FIX:
1853 : pFieldItem.reset(new SvxFieldItem(
1854 0 : SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ));
1855 0 : break;
1856 :
1857 : case SID_INSERT_FLD_DATE_VAR:
1858 0 : pFieldItem.reset(new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD ));
1859 0 : break;
1860 :
1861 : case SID_INSERT_FLD_TIME_FIX:
1862 : pFieldItem.reset(new SvxFieldItem(
1863 0 : SvxExtTimeField( ::tools::Time( ::tools::Time::SYSTEM ), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD ));
1864 0 : break;
1865 :
1866 : case SID_INSERT_FLD_TIME_VAR:
1867 0 : pFieldItem.reset(new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD ));
1868 0 : break;
1869 :
1870 : case SID_INSERT_FLD_AUTHOR:
1871 : {
1872 0 : SvtUserOptions aUserOptions;
1873 : pFieldItem.reset(new SvxFieldItem(
1874 : SvxAuthorField(
1875 0 : aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() ), EE_FEATURE_FIELD ));
1876 : }
1877 0 : break;
1878 :
1879 : case SID_INSERT_FLD_PAGE:
1880 : {
1881 0 : pFieldItem.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ));
1882 0 : nMul = 3;
1883 : }
1884 0 : break;
1885 :
1886 : case SID_INSERT_FLD_PAGE_TITLE:
1887 : {
1888 0 : pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
1889 0 : nMul = 3;
1890 : }
1891 0 : break;
1892 :
1893 : case SID_INSERT_FLD_PAGES:
1894 : {
1895 0 : pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
1896 0 : nMul = 3;
1897 : }
1898 0 : break;
1899 :
1900 : case SID_INSERT_FLD_FILE:
1901 : {
1902 0 : OUString aName;
1903 0 : if( GetDocSh()->HasName() )
1904 0 : aName = GetDocSh()->GetMedium()->GetName();
1905 0 : pFieldItem.reset(new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD ));
1906 : }
1907 0 : break;
1908 : }
1909 :
1910 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1911 :
1912 0 : if( pOLV )
1913 : {
1914 0 : const SvxFieldItem* pOldFldItem = pOLV->GetFieldAtSelection();
1915 :
1916 0 : if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
1917 0 : pOldFldItem->GetField()->ISA( SvxDateField ) ||
1918 0 : pOldFldItem->GetField()->ISA( SvxTimeField ) ||
1919 0 : pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
1920 0 : pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
1921 0 : pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
1922 0 : pOldFldItem->GetField()->ISA( SvxPageField ) ) )
1923 : {
1924 : // select field, then it will be deleted when inserting
1925 0 : ESelection aSel = pOLV->GetSelection();
1926 0 : if( aSel.nStartPos == aSel.nEndPos )
1927 0 : aSel.nEndPos++;
1928 0 : pOLV->SetSelection( aSel );
1929 : }
1930 :
1931 0 : if( pFieldItem )
1932 0 : pOLV->InsertField( *pFieldItem );
1933 : }
1934 : else
1935 : {
1936 0 : Outliner* pOutl = GetDoc()->GetInternalOutliner();
1937 0 : pOutl->Init( OUTLINERMODE_TEXTOBJECT );
1938 0 : sal_uInt16 nOutlMode = pOutl->GetMode();
1939 0 : pOutl->SetStyleSheet( 0, NULL );
1940 0 : pOutl->QuickInsertField( *pFieldItem, ESelection() );
1941 0 : OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
1942 :
1943 0 : SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT );
1944 0 : pRectObj->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
1945 :
1946 0 : pOutl->UpdateFields();
1947 0 : pOutl->SetUpdateMode( true );
1948 0 : Size aSize( pOutl->CalcTextSize() );
1949 0 : aSize.Width() *= nMul;
1950 0 : pOutl->SetUpdateMode( false );
1951 :
1952 0 : Point aPos;
1953 0 : Rectangle aRect( aPos, GetActiveWindow()->GetOutputSizePixel() );
1954 0 : aPos = aRect.Center();
1955 0 : aPos = GetActiveWindow()->PixelToLogic(aPos);
1956 0 : aPos.X() -= aSize.Width() / 2;
1957 0 : aPos.Y() -= aSize.Height() / 2;
1958 :
1959 0 : Rectangle aLogicRect(aPos, aSize);
1960 0 : pRectObj->SetLogicRect(aLogicRect);
1961 0 : pRectObj->SetOutlinerParaObject( pOutlParaObject );
1962 0 : mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
1963 0 : pOutl->Init( nOutlMode );
1964 : }
1965 :
1966 0 : pFieldItem.reset();
1967 :
1968 0 : Cancel();
1969 0 : rReq.Ignore ();
1970 : }
1971 0 : break;
1972 :
1973 : case SID_MODIFY_FIELD:
1974 : {
1975 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1976 :
1977 0 : if( pOLV )
1978 : {
1979 0 : const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
1980 :
1981 0 : if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
1982 0 : pFldItem->GetField()->ISA( SvxAuthorField ) ||
1983 0 : pFldItem->GetField()->ISA( SvxExtFileField ) ||
1984 0 : pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
1985 : {
1986 : // Dialog...
1987 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
1988 0 : boost::scoped_ptr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOLV->GetAttribs() ) : 0);
1989 0 : if( pDlg && pDlg->Execute() == RET_OK )
1990 : {
1991 : // To make a correct SetAttribs() call at the utlinerView
1992 : // it is necessary to split the actions here
1993 0 : boost::scoped_ptr<SvxFieldData> pField(pDlg->GetField());
1994 0 : ESelection aSel = pOLV->GetSelection();
1995 0 : bool bSelectionWasModified(false);
1996 :
1997 0 : if( pField )
1998 : {
1999 0 : SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
2000 :
2001 0 : if( aSel.nStartPos == aSel.nEndPos )
2002 : {
2003 0 : bSelectionWasModified = true;
2004 0 : aSel.nEndPos++;
2005 0 : pOLV->SetSelection( aSel );
2006 : }
2007 :
2008 0 : pOLV->InsertField( aFieldItem );
2009 :
2010 : // select again for eventual SetAttribs call
2011 0 : pOLV->SetSelection( aSel );
2012 : }
2013 :
2014 0 : SfxItemSet aSet( pDlg->GetItemSet() );
2015 :
2016 0 : if( aSet.Count() )
2017 : {
2018 0 : pOLV->SetAttribs( aSet );
2019 :
2020 0 : ::Outliner* pOutliner = pOLV->GetOutliner();
2021 0 : if( pOutliner )
2022 0 : pOutliner->UpdateFields();
2023 : }
2024 :
2025 0 : if(pField)
2026 : {
2027 : // restore selection to original
2028 0 : if(bSelectionWasModified)
2029 : {
2030 0 : aSel.nEndPos--;
2031 0 : pOLV->SetSelection( aSel );
2032 : }
2033 0 : }
2034 0 : }
2035 : }
2036 : }
2037 :
2038 0 : Cancel();
2039 0 : rReq.Ignore ();
2040 : }
2041 0 : break;
2042 :
2043 : case SID_OPEN_XML_FILTERSETTINGS:
2044 : {
2045 : try
2046 : {
2047 0 : css::uno::Reference < css::ui::dialogs::XExecutableDialog > xDialog = css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
2048 0 : xDialog->execute();
2049 : }
2050 0 : catch( ::com::sun::star::uno::RuntimeException& )
2051 : {
2052 : DBG_UNHANDLED_EXCEPTION();
2053 : }
2054 :
2055 0 : Cancel();
2056 0 : rReq.Ignore ();
2057 : }
2058 0 : break;
2059 :
2060 : case SID_GROUP: // BASIC
2061 : {
2062 0 : if ( mpDrawView->IsPresObjSelected( true, true, true ) )
2063 : {
2064 0 : ::sd::Window* pWindow = GetActiveWindow();
2065 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2066 : }
2067 : else
2068 : {
2069 0 : mpDrawView->GroupMarked();
2070 : }
2071 0 : Cancel();
2072 0 : rReq.Done ();
2073 : }
2074 0 : break;
2075 :
2076 : case SID_UNGROUP: // BASIC
2077 : {
2078 0 : mpDrawView->UnGroupMarked();
2079 0 : Cancel();
2080 0 : rReq.Done ();
2081 : }
2082 0 : break;
2083 :
2084 : case SID_NAME_GROUP:
2085 : {
2086 : // only allow for single object selection since the name of an object needs
2087 : // to be unique
2088 0 : if(1 == mpDrawView->GetMarkedObjectCount())
2089 : {
2090 : // #i68101#
2091 0 : SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0);
2092 : OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2093 0 : OUString aName(pSelected->GetName());
2094 :
2095 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
2096 : OSL_ENSURE(pFact, "Dialog creation failed!");
2097 0 : boost::scoped_ptr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(NULL, aName));
2098 : OSL_ENSURE(pDlg, "Dialog creation failed!");
2099 :
2100 0 : pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl));
2101 :
2102 0 : if(RET_OK == pDlg->Execute())
2103 : {
2104 0 : pDlg->GetName(aName);
2105 0 : pSelected->SetName(aName);
2106 0 : }
2107 : }
2108 :
2109 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
2110 0 : rBindings.Invalidate( SID_NAVIGATOR_STATE, true, false );
2111 0 : rBindings.Invalidate( SID_CONTEXT );
2112 :
2113 0 : Cancel();
2114 0 : rReq.Ignore();
2115 0 : break;
2116 : }
2117 :
2118 : // #i68101#
2119 : case SID_OBJECT_TITLE_DESCRIPTION:
2120 : {
2121 0 : if(1 == mpDrawView->GetMarkedObjectCount())
2122 : {
2123 0 : SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0);
2124 : OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2125 0 : OUString aTitle(pSelected->GetTitle());
2126 0 : OUString aDescription(pSelected->GetDescription());
2127 :
2128 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
2129 : OSL_ENSURE(pFact, "Dialog creation failed!");
2130 0 : boost::scoped_ptr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription));
2131 : OSL_ENSURE(pDlg, "Dialog creation failed!");
2132 :
2133 0 : if(RET_OK == pDlg->Execute())
2134 : {
2135 0 : pDlg->GetTitle(aTitle);
2136 0 : pDlg->GetDescription(aDescription);
2137 0 : pSelected->SetTitle(aTitle);
2138 0 : pSelected->SetDescription(aDescription);
2139 0 : }
2140 : }
2141 :
2142 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
2143 0 : rBindings.Invalidate( SID_NAVIGATOR_STATE, true, false );
2144 0 : rBindings.Invalidate( SID_CONTEXT );
2145 :
2146 0 : Cancel();
2147 0 : rReq.Ignore();
2148 0 : break;
2149 : }
2150 :
2151 : case SID_ENTER_GROUP: // BASIC
2152 : {
2153 0 : mpDrawView->EnterMarkedGroup();
2154 0 : Cancel();
2155 0 : rReq.Done ();
2156 : }
2157 0 : break;
2158 :
2159 : case SID_LEAVE_GROUP: // BASIC
2160 : {
2161 0 : mpDrawView->LeaveOneGroup();
2162 0 : Cancel();
2163 0 : rReq.Done ();
2164 : }
2165 0 : break;
2166 :
2167 : case SID_LEAVE_ALL_GROUPS: // BASIC
2168 : {
2169 0 : mpDrawView->LeaveAllGroup();
2170 0 : Cancel();
2171 0 : rReq.Done ();
2172 : }
2173 0 : break;
2174 :
2175 : case SID_COMBINE: // BASIC
2176 : {
2177 : // End text edit to avoid conflicts
2178 0 : if(mpDrawView->IsTextEdit())
2179 0 : mpDrawView->SdrEndTextEdit();
2180 :
2181 0 : if ( mpDrawView->IsPresObjSelected() )
2182 : {
2183 0 : ::sd::Window* pWindow = GetActiveWindow();
2184 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2185 : }
2186 : else
2187 : {
2188 0 : WaitObject aWait( GetActiveWindow() );
2189 0 : mpDrawView->CombineMarkedObjects(false);
2190 : }
2191 0 : Cancel();
2192 0 : rReq.Done ();
2193 : }
2194 0 : break;
2195 :
2196 : case SID_DISTRIBUTE_DLG:
2197 : {
2198 0 : if ( mpDrawView->IsPresObjSelected() )
2199 : {
2200 0 : ::sd::Window* pWindow = GetActiveWindow();
2201 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2202 : }
2203 : else
2204 : {
2205 0 : mpDrawView->DistributeMarkedObjects();
2206 : }
2207 0 : Cancel();
2208 0 : rReq.Done ();
2209 : }
2210 0 : break;
2211 :
2212 : case SID_POLY_MERGE:
2213 : {
2214 : // End text edit to avoid conflicts
2215 0 : if(mpDrawView->IsTextEdit())
2216 0 : mpDrawView->SdrEndTextEdit();
2217 :
2218 0 : if ( mpDrawView->IsPresObjSelected() )
2219 : {
2220 0 : ::sd::Window* pWindow = GetActiveWindow();
2221 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2222 : }
2223 : else
2224 : {
2225 0 : WaitObject aWait( GetActiveWindow() );
2226 0 : mpDrawView->MergeMarkedObjects(SDR_MERGE_MERGE);
2227 : }
2228 0 : Cancel();
2229 0 : rReq.Done ();
2230 : }
2231 0 : break;
2232 :
2233 : case SID_POLY_SUBSTRACT:
2234 : {
2235 : // End text edit to avoid conflicts
2236 0 : if(mpDrawView->IsTextEdit())
2237 0 : mpDrawView->SdrEndTextEdit();
2238 :
2239 0 : if ( mpDrawView->IsPresObjSelected() )
2240 : {
2241 0 : ::sd::Window* pWindow = GetActiveWindow();
2242 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2243 : }
2244 : else
2245 : {
2246 0 : WaitObject aWait( GetActiveWindow() );
2247 0 : mpDrawView->MergeMarkedObjects(SDR_MERGE_SUBSTRACT);
2248 : }
2249 0 : Cancel();
2250 0 : rReq.Done ();
2251 : }
2252 0 : break;
2253 :
2254 : case SID_POLY_INTERSECT:
2255 : {
2256 : // End text edit to avoid conflicts
2257 0 : if(mpDrawView->IsTextEdit())
2258 0 : mpDrawView->SdrEndTextEdit();
2259 :
2260 0 : if ( mpDrawView->IsPresObjSelected() )
2261 : {
2262 0 : ::sd::Window* pWindow = GetActiveWindow();
2263 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2264 : }
2265 : else
2266 : {
2267 0 : WaitObject aWait( GetActiveWindow() );
2268 0 : mpDrawView->MergeMarkedObjects(SDR_MERGE_INTERSECT);
2269 : }
2270 0 : Cancel();
2271 0 : rReq.Done ();
2272 : }
2273 0 : break;
2274 :
2275 : case SID_DISMANTLE: // BASIC
2276 : {
2277 0 : if ( mpDrawView->IsDismantlePossible(false) )
2278 : {
2279 0 : WaitObject aWait( GetActiveWindow() );
2280 0 : mpDrawView->DismantleMarkedObjects(false);
2281 : }
2282 0 : Cancel();
2283 0 : rReq.Done ();
2284 : }
2285 0 : break;
2286 :
2287 : case SID_CONNECT: // BASIC
2288 : {
2289 0 : if ( mpDrawView->IsPresObjSelected() )
2290 : {
2291 0 : ::sd::Window* pWindow = GetActiveWindow();
2292 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2293 : }
2294 : else
2295 : {
2296 0 : WaitObject aWait( GetActiveWindow() );
2297 0 : mpDrawView->CombineMarkedObjects(true);
2298 : }
2299 0 : Cancel();
2300 0 : rReq.Done ();
2301 : }
2302 0 : break;
2303 :
2304 : case SID_BREAK: // BASIC
2305 : {
2306 0 : if ( mpDrawView->IsTextEdit() )
2307 : {
2308 0 : mpDrawView->SdrEndTextEdit();
2309 : }
2310 :
2311 0 : if ( mpDrawView->IsBreak3DObjPossible() )
2312 : {
2313 0 : WaitObject aWait( GetActiveWindow() );
2314 0 : mpDrawView->Break3DObj();
2315 : }
2316 0 : else if ( mpDrawView->IsDismantlePossible(true) )
2317 : {
2318 0 : WaitObject aWait( GetActiveWindow() );
2319 0 : mpDrawView->DismantleMarkedObjects(true);
2320 : }
2321 0 : else if ( mpDrawView->IsImportMtfPossible() )
2322 : {
2323 0 : WaitObject aWait( GetActiveWindow() );
2324 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
2325 0 : const size_t nAnz=rMarkList.GetMarkCount();
2326 :
2327 : // determine the sum of meta objects of all selected meta files
2328 0 : sal_uLong nCount = 0;
2329 0 : for(size_t nm=0; nm<nAnz; ++nm)
2330 : {
2331 0 : SdrMark* pM=rMarkList.GetMark(nm);
2332 0 : SdrObject* pObj=pM->GetMarkedSdrObj();
2333 0 : SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj);
2334 0 : SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj);
2335 :
2336 0 : if(pGraf)
2337 : {
2338 0 : if(pGraf->HasGDIMetaFile())
2339 : {
2340 0 : nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionSize();
2341 : }
2342 0 : else if(pGraf->isEmbeddedSvg())
2343 : {
2344 0 : nCount += pGraf->getMetafileFromEmbeddedSvg().GetActionSize();
2345 : }
2346 : }
2347 :
2348 0 : if(pOle2 && pOle2->GetGraphic())
2349 : {
2350 0 : nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionSize();
2351 : }
2352 : }
2353 :
2354 : // decide with the sum of all meta objects if we should show a dialog
2355 0 : if(nCount < MIN_ACTIONS_FOR_DIALOG)
2356 : {
2357 : // nope, no dialog
2358 0 : mpDrawView->DoImportMarkedMtf();
2359 : }
2360 : else
2361 : {
2362 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
2363 0 : if( pFact )
2364 : {
2365 0 : boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView, GetDocSh(), nCount, static_cast<sal_uLong>(nAnz) ));
2366 0 : if( pDlg )
2367 : {
2368 0 : pDlg->Execute();
2369 0 : }
2370 : }
2371 0 : }
2372 : }
2373 :
2374 0 : Cancel();
2375 0 : rReq.Done ();
2376 : }
2377 0 : break;
2378 :
2379 : case SID_CONVERT_TO_3D:
2380 : {
2381 0 : if ( mpDrawView->IsPresObjSelected() )
2382 : {
2383 0 : ::sd::Window* pWindow = GetActiveWindow();
2384 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
2385 : }
2386 : else
2387 : {
2388 0 : if (mpDrawView->IsConvertTo3DObjPossible())
2389 : {
2390 0 : if (mpDrawView->IsTextEdit())
2391 : {
2392 0 : mpDrawView->SdrEndTextEdit();
2393 : }
2394 :
2395 0 : WaitObject aWait( GetActiveWindow() );
2396 0 : mpDrawView->ConvertMarkedObjTo3D(true);
2397 : }
2398 : }
2399 :
2400 0 : Cancel();
2401 0 : rReq.Done();
2402 : }
2403 0 : break;
2404 :
2405 : case SID_FRAME_TO_TOP: // BASIC
2406 : {
2407 0 : mpDrawView->PutMarkedToTop();
2408 0 : Cancel();
2409 0 : Invalidate( SID_POSITION );
2410 0 : rReq.Done ();
2411 : }
2412 0 : break;
2413 :
2414 : case SID_MOREFRONT: // BASIC
2415 : {
2416 0 : mpDrawView->MovMarkedToTop();
2417 0 : Cancel();
2418 0 : Invalidate( SID_POSITION );
2419 0 : rReq.Done ();
2420 : }
2421 0 : break;
2422 :
2423 : case SID_MOREBACK: // BASIC
2424 : {
2425 0 : mpDrawView->MovMarkedToBtm();
2426 0 : Cancel();
2427 0 : Invalidate( SID_POSITION );
2428 0 : rReq.Done ();
2429 : }
2430 0 : break;
2431 :
2432 : case SID_FRAME_TO_BOTTOM: // BASIC
2433 : {
2434 0 : mpDrawView->PutMarkedToBtm();
2435 0 : Cancel();
2436 0 : Invalidate( SID_POSITION );
2437 0 : rReq.Done ();
2438 : }
2439 0 : break;
2440 :
2441 : case SID_HORIZONTAL: // BASIC
2442 : case SID_FLIP_HORIZONTAL:
2443 : {
2444 0 : mpDrawView->MirrorAllMarkedHorizontal();
2445 0 : Cancel();
2446 0 : rReq.Done ();
2447 : }
2448 0 : break;
2449 :
2450 : case SID_VERTICAL: // BASIC
2451 : case SID_FLIP_VERTICAL:
2452 : {
2453 0 : mpDrawView->MirrorAllMarkedVertical();
2454 0 : Cancel();
2455 0 : rReq.Done ();
2456 : }
2457 0 : break;
2458 :
2459 : case SID_OBJECT_ALIGN_LEFT: // BASIC
2460 : {
2461 0 : mpDrawView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
2462 0 : Cancel();
2463 0 : rReq.Done ();
2464 : }
2465 0 : break;
2466 :
2467 : case SID_OBJECT_ALIGN_CENTER: // BASIC
2468 : {
2469 0 : mpDrawView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
2470 0 : Cancel();
2471 0 : rReq.Done ();
2472 : }
2473 0 : break;
2474 :
2475 : case SID_OBJECT_ALIGN_RIGHT: // BASIC
2476 : {
2477 0 : mpDrawView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
2478 0 : Cancel();
2479 0 : rReq.Done ();
2480 : }
2481 0 : break;
2482 :
2483 : case SID_OBJECT_ALIGN_UP: // BASIC
2484 : {
2485 0 : mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
2486 0 : Cancel();
2487 0 : rReq.Done ();
2488 : }
2489 0 : break;
2490 :
2491 : case SID_OBJECT_ALIGN_MIDDLE: // BASIC
2492 : {
2493 0 : mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
2494 0 : Cancel();
2495 0 : rReq.Done ();
2496 : }
2497 0 : break;
2498 :
2499 : case SID_OBJECT_ALIGN_DOWN: // BASIC
2500 : {
2501 0 : mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
2502 0 : Cancel();
2503 0 : rReq.Done ();
2504 : }
2505 0 : break;
2506 :
2507 : case SID_SELECTALL: // BASIC
2508 : {
2509 0 : if( (dynamic_cast<FuSelection*>( GetOldFunction().get() ) != 0) &&
2510 0 : !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
2511 : {
2512 0 : if ( !mpDrawView->IsAction() )
2513 0 : mpDrawView->MarkAllPoints();
2514 : }
2515 : else
2516 0 : mpDrawView->SelectAll();
2517 :
2518 0 : Cancel();
2519 0 : rReq.Done ();
2520 : }
2521 0 : break;
2522 :
2523 : case SID_STYLE_NEW: // BASIC ???
2524 : case SID_STYLE_APPLY:
2525 : case SID_STYLE_EDIT:
2526 : case SID_STYLE_DELETE:
2527 : case SID_STYLE_HIDE:
2528 : case SID_STYLE_SHOW:
2529 : case SID_STYLE_FAMILY:
2530 : case SID_STYLE_WATERCAN:
2531 : case SID_STYLE_UPDATE_BY_EXAMPLE:
2532 : case SID_STYLE_NEW_BY_EXAMPLE:
2533 : {
2534 0 : if( rReq.GetSlot() == SID_STYLE_EDIT && !rReq.GetArgs() )
2535 : {
2536 0 : SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
2537 0 : if( pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
2538 0 : pStyleSheet = static_cast<SdStyleSheet*>(pStyleSheet)->GetPseudoStyleSheet();
2539 :
2540 0 : if( (pStyleSheet == NULL) && GetView()->IsTextEdit() )
2541 : {
2542 0 : GetView()->SdrEndTextEdit();
2543 :
2544 0 : pStyleSheet = mpDrawView->GetStyleSheet();
2545 0 : if(pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
2546 0 : pStyleSheet = static_cast<SdStyleSheet*>(pStyleSheet)->GetPseudoStyleSheet();
2547 : }
2548 :
2549 0 : if( pStyleSheet == NULL )
2550 : {
2551 0 : rReq.Ignore();
2552 0 : break;
2553 : }
2554 :
2555 0 : SfxAllItemSet aSet(GetDoc()->GetPool());
2556 :
2557 0 : SfxStringItem aStyleNameItem( SID_STYLE_EDIT, pStyleSheet->GetName() );
2558 0 : aSet.Put(aStyleNameItem);
2559 :
2560 0 : SfxUInt16Item aStyleFamilyItem( SID_STYLE_FAMILY, (sal_uInt16)pStyleSheet->GetFamily() );
2561 0 : aSet.Put(aStyleFamilyItem);
2562 :
2563 0 : rReq.SetArgs(aSet);
2564 : }
2565 :
2566 0 : if( rReq.GetArgs() )
2567 : {
2568 0 : SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
2569 0 : if( rReq.GetSlot() == SID_STYLE_APPLY )
2570 0 : GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
2571 0 : Cancel();
2572 : }
2573 0 : else if( rReq.GetSlot() == SID_STYLE_APPLY )
2574 0 : GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON );
2575 0 : rReq.Ignore ();
2576 : }
2577 0 : break;
2578 :
2579 : case SID_IMAP:
2580 : {
2581 0 : sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
2582 :
2583 0 : GetViewFrame()->ToggleChildWindow( nId );
2584 0 : GetViewFrame()->GetBindings().Invalidate( SID_IMAP );
2585 :
2586 0 : if ( GetViewFrame()->HasChildWindow( nId )
2587 0 : && ( ( ViewShell::Implementation::GetImageMapDialog() ) != NULL ) )
2588 : {
2589 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
2590 :
2591 0 : if ( rMarkList.GetMarkCount() == 1 )
2592 0 : UpdateIMapDlg( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
2593 : }
2594 :
2595 0 : Cancel();
2596 0 : rReq.Ignore ();
2597 : }
2598 0 : break;
2599 :
2600 : case SID_GRID_FRONT:
2601 : {
2602 0 : mpDrawView->SetGridFront( !mpDrawView->IsGridFront() );
2603 0 : Cancel();
2604 0 : rReq.Done ();
2605 : }
2606 0 : break;
2607 :
2608 : case SID_HELPLINES_FRONT:
2609 : {
2610 0 : mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() );
2611 0 : Cancel();
2612 0 : rReq.Done ();
2613 : }
2614 0 : break;
2615 :
2616 : case SID_FONTWORK:
2617 : {
2618 0 : if ( rReq.GetArgs() )
2619 : {
2620 0 : GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
2621 : static_cast<const SfxBoolItem&>(rReq.GetArgs()->
2622 0 : Get(SID_FONTWORK)).GetValue());
2623 : }
2624 : else
2625 : {
2626 0 : GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
2627 : }
2628 :
2629 0 : GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK);
2630 0 : Cancel();
2631 0 : rReq.Ignore ();
2632 : }
2633 0 : break;
2634 :
2635 : case SID_COLOR_CONTROL:
2636 : {
2637 0 : if ( rReq.GetArgs() )
2638 0 : GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
2639 : static_cast<const SfxBoolItem&>(rReq.GetArgs()->
2640 0 : Get(SID_COLOR_CONTROL)).GetValue());
2641 : else
2642 0 : GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
2643 :
2644 0 : GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL);
2645 0 : Cancel();
2646 0 : rReq.Ignore ();
2647 : }
2648 0 : break;
2649 :
2650 : case SID_EXTRUSION_TOOGLE:
2651 : case SID_EXTRUSION_TILT_DOWN:
2652 : case SID_EXTRUSION_TILT_UP:
2653 : case SID_EXTRUSION_TILT_LEFT:
2654 : case SID_EXTRUSION_TILT_RIGHT:
2655 : case SID_EXTRUSION_3D_COLOR:
2656 : case SID_EXTRUSION_DEPTH:
2657 : case SID_EXTRUSION_DIRECTION:
2658 : case SID_EXTRUSION_PROJECTION:
2659 : case SID_EXTRUSION_LIGHTING_DIRECTION:
2660 : case SID_EXTRUSION_LIGHTING_INTENSITY:
2661 : case SID_EXTRUSION_SURFACE:
2662 : case SID_EXTRUSION_DEPTH_FLOATER:
2663 : case SID_EXTRUSION_DIRECTION_FLOATER:
2664 : case SID_EXTRUSION_LIGHTING_FLOATER:
2665 : case SID_EXTRUSION_SURFACE_FLOATER:
2666 : case SID_EXTRUSION_DEPTH_DIALOG:
2667 0 : svx::ExtrusionBar::execute( mpDrawView, rReq, GetViewFrame()->GetBindings() );
2668 0 : Cancel();
2669 0 : rReq.Ignore ();
2670 0 : break;
2671 :
2672 : case SID_FONTWORK_SHAPE:
2673 : case SID_FONTWORK_SHAPE_TYPE:
2674 : case SID_FONTWORK_ALIGNMENT:
2675 : case SID_FONTWORK_SAME_LETTER_HEIGHTS:
2676 : case SID_FONTWORK_CHARACTER_SPACING:
2677 : case SID_FONTWORK_KERN_CHARACTER_PAIRS:
2678 : case SID_FONTWORK_GALLERY_FLOATER:
2679 : case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
2680 : case SID_FONTWORK_ALIGNMENT_FLOATER:
2681 : case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
2682 0 : svx::FontworkBar::execute( mpDrawView, rReq, GetViewFrame()->GetBindings() );
2683 0 : Cancel();
2684 0 : rReq.Ignore ();
2685 0 : break;
2686 :
2687 : case SID_BMPMASK:
2688 : {
2689 0 : GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
2690 0 : GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK );
2691 :
2692 0 : Cancel();
2693 0 : rReq.Ignore ();
2694 : }
2695 0 : break;
2696 :
2697 : case SID_NAVIGATOR:
2698 : {
2699 0 : if ( rReq.GetArgs() )
2700 : GetViewFrame()->SetChildWindow(SID_NAVIGATOR,
2701 : static_cast<const SfxBoolItem&>(rReq.GetArgs()->
2702 0 : Get(SID_NAVIGATOR)).GetValue());
2703 : else
2704 0 : GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR );
2705 :
2706 0 : GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR);
2707 0 : Cancel();
2708 0 : rReq.Ignore ();
2709 : }
2710 0 : break;
2711 :
2712 : case SID_SLIDE_TRANSITIONS_PANEL:
2713 : case SID_CUSTOM_ANIMATION_PANEL:
2714 : case SID_GALLERY:
2715 : {
2716 : // First make sure that the sidebar is visible
2717 0 : GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
2718 :
2719 0 : OUString panelId;
2720 0 : if (nSId == SID_CUSTOM_ANIMATION_PANEL)
2721 0 : panelId = CustomAnimationPanelId;
2722 0 : else if (nSId == SID_GALLERY)
2723 0 : panelId = GalleryPanelId;
2724 0 : else if (nSId == SID_SLIDE_TRANSITIONS_PANEL)
2725 0 : panelId = SlideTransitionPanelId;
2726 :
2727 : ::sfx2::sidebar::Sidebar::ShowPanel(
2728 : panelId,
2729 0 : GetViewFrame()->GetFrame().GetFrameInterface());
2730 :
2731 0 : Cancel();
2732 0 : rReq.Done();
2733 : }
2734 0 : break;
2735 :
2736 : case SID_ANIMATION_OBJECTS:
2737 : {
2738 0 : if ( rReq.GetArgs() )
2739 : GetViewFrame()->SetChildWindow(
2740 0 : AnimationChildWindow::GetChildWindowId(),
2741 : static_cast<const SfxBoolItem&>(rReq.GetArgs()->
2742 0 : Get(SID_ANIMATION_OBJECTS)).GetValue());
2743 : else
2744 : GetViewFrame()->ToggleChildWindow(
2745 0 : AnimationChildWindow::GetChildWindowId() );
2746 :
2747 0 : GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS);
2748 0 : Cancel();
2749 0 : rReq.Ignore ();
2750 : }
2751 0 : break;
2752 :
2753 : case SID_3D_WIN:
2754 : {
2755 0 : if ( rReq.GetArgs() )
2756 0 : GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
2757 : static_cast<const SfxBoolItem&>(rReq.GetArgs()->
2758 0 : Get( SID_3D_WIN )).GetValue());
2759 : else
2760 0 : GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
2761 :
2762 0 : GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN );
2763 0 : Cancel();
2764 0 : rReq.Ignore ();
2765 : }
2766 0 : break;
2767 :
2768 : case SID_CONVERT_TO_3D_LATHE_FAST:
2769 : {
2770 : /* The call is enough. The initialization via Start3DCreation and
2771 : CreateMirrorPolygons is no longer needed if the parameter
2772 : sal_True is provided. Then a tilted rotary body with an axis left
2773 : besides the bounding rectangle of the selected objects is drawn
2774 : immediately and without user interaction. */
2775 0 : mpDrawView->SdrEndTextEdit();
2776 0 : if(GetActiveWindow())
2777 0 : GetActiveWindow()->EnterWait();
2778 0 : mpDrawView->End3DCreation(true);
2779 0 : Cancel();
2780 0 : rReq.Ignore();
2781 0 : if(GetActiveWindow())
2782 0 : GetActiveWindow()->LeaveWait();
2783 : }
2784 0 : break;
2785 :
2786 : case SID_PRESENTATION_DLG:
2787 : {
2788 0 : SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
2789 0 : Cancel();
2790 : }
2791 0 : break;
2792 :
2793 : case SID_REMOTE_DLG:
2794 : {
2795 : #ifdef ENABLE_SDREMOTE
2796 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
2797 0 : VclAbstractDialog* pDlg = pFact ? pFact->CreateRemoteDialog(GetActiveWindow()) : 0;
2798 0 : if (pDlg)
2799 0 : pDlg->Execute();
2800 : #endif
2801 : }
2802 0 : break;
2803 :
2804 : case SID_CUSTOMSHOW_DLG:
2805 : {
2806 0 : SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
2807 0 : Cancel();
2808 : }
2809 0 : break;
2810 :
2811 : case SID_EXPAND_PAGE:
2812 : {
2813 0 : SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
2814 0 : Cancel();
2815 : }
2816 0 : break;
2817 :
2818 : case SID_SUMMARY_PAGE:
2819 : {
2820 0 : mpDrawView->SdrEndTextEdit();
2821 0 : SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
2822 0 : Cancel();
2823 : }
2824 0 : break;
2825 :
2826 : case SID_AVMEDIA_PLAYER:
2827 : {
2828 0 : GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
2829 0 : GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER );
2830 0 : Cancel();
2831 0 : rReq.Ignore ();
2832 : }
2833 0 : break;
2834 :
2835 : case SID_PRESENTATION_MINIMIZER:
2836 : {
2837 0 : Reference<XComponentContext> xContext(::comphelper::getProcessComponentContext());
2838 0 : Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext));
2839 0 : Reference<frame::XDispatchProvider> xProvider(GetViewShellBase().GetController()->getFrame(), UNO_QUERY);
2840 0 : if (xProvider.is())
2841 : {
2842 0 : util::URL aURL;
2843 0 : aURL.Complete = "vnd.com.sun.star.comp.PresentationMinimizer:execute";
2844 0 : xParser->parseStrict(aURL);
2845 0 : uno::Reference<frame::XDispatch> xDispatch(xProvider->queryDispatch(aURL, OUString(), 0));
2846 0 : if (xDispatch.is())
2847 : {
2848 0 : xDispatch->dispatch(aURL, uno::Sequence< beans::PropertyValue >());
2849 0 : }
2850 : }
2851 0 : Cancel();
2852 0 : rReq.Ignore();
2853 : }
2854 0 : break;
2855 :
2856 : case SID_DISPLAY_MASTER_BACKGROUND:
2857 : case SID_DISPLAY_MASTER_OBJECTS:
2858 : {
2859 : // Determine current page and toggle visibility of layers
2860 : // associated with master page background or master page shapes.
2861 0 : SdPage* pPage = GetActualPage();
2862 0 : if (pPage != NULL
2863 0 : && GetDoc() != NULL)
2864 : {
2865 0 : SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
2866 0 : SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
2867 : sal_uInt8 aLayerId;
2868 0 : if (nSId == SID_DISPLAY_MASTER_BACKGROUND)
2869 0 : aLayerId = rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRND), false);
2870 : else
2871 0 : aLayerId = rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRNDOBJ), false);
2872 0 : aVisibleLayers.Set(aLayerId, !aVisibleLayers.IsSet(aLayerId));
2873 0 : pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
2874 : }
2875 0 : Cancel();
2876 0 : rReq.Ignore ();
2877 : }
2878 0 : break;
2879 :
2880 : case SID_PHOTOALBUM:
2881 : {
2882 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
2883 : boost::scoped_ptr<VclAbstractDialog> pDlg(pFact ? pFact->CreateSdPhotoAlbumDialog(
2884 0 : GetActiveWindow(),
2885 0 : GetDoc()) : 0);
2886 :
2887 0 : if (pDlg)
2888 : {
2889 0 : pDlg->Execute();
2890 0 : pDlg.reset();
2891 : }
2892 0 : Cancel();
2893 0 : rReq.Ignore ();
2894 : }
2895 0 : break;
2896 :
2897 : default:
2898 : {
2899 : DBG_ASSERT( false, "Slot without function" );
2900 0 : Cancel();
2901 0 : rReq.Ignore ();
2902 : }
2903 0 : break;
2904 : }
2905 :
2906 0 : if(HasCurrentFunction())
2907 : {
2908 0 : GetCurrentFunction()->Activate();
2909 : }
2910 : }
2911 :
2912 0 : void DrawViewShell::ExecChar( SfxRequest &rReq )
2913 : {
2914 0 : SdDrawDocument* pDoc = GetDoc();
2915 0 : if (!pDoc || !mpDrawView)
2916 0 : return;
2917 :
2918 0 : SfxItemSet aEditAttr( pDoc->GetPool() );
2919 0 : mpDrawView->GetAttributes( aEditAttr );
2920 :
2921 : //modified by wj for sym2_1580, if put old itemset into new set,
2922 : //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
2923 : // and use old attr to update all the attributes
2924 : // SfxItemSet aNewAttr( GetPool(),
2925 : // EE_ITEMS_START, EE_ITEMS_END );
2926 : // aNewAttr.Put( aEditAttr, sal_False );
2927 0 : SfxItemSet aNewAttr( pDoc->GetPool() );
2928 : //modified end
2929 :
2930 0 : sal_uInt16 nSId = rReq.GetSlot();
2931 :
2932 0 : MapSlot( nSId );
2933 :
2934 0 : switch ( nSId )
2935 : {
2936 : case SID_ATTR_CHAR_FONT:
2937 0 : if( rReq.GetArgs() )
2938 : {
2939 0 : SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , false );
2940 0 : if (pItem)
2941 : {
2942 0 : aNewAttr.Put(*pItem);
2943 : }
2944 : }
2945 0 : break;
2946 : case SID_ATTR_CHAR_FONTHEIGHT:
2947 0 : if( rReq.GetArgs() )
2948 : {
2949 0 : SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , false );
2950 0 : if (pItem)
2951 : {
2952 0 : aNewAttr.Put(*pItem);
2953 : }
2954 : }
2955 0 : break;
2956 : case SID_ATTR_CHAR_WEIGHT:
2957 0 : if( rReq.GetArgs() )
2958 : {
2959 : //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) );
2960 0 : SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , false );
2961 0 : if (pItem)
2962 : {
2963 0 : aNewAttr.Put(*pItem);
2964 : }
2965 : }
2966 0 : break;
2967 : case SID_ATTR_CHAR_POSTURE:
2968 0 : if( rReq.GetArgs() )
2969 : {
2970 : //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) );
2971 0 : SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , false );
2972 0 : if (pItem)
2973 : {
2974 0 : aNewAttr.Put(*pItem);
2975 : }
2976 : }
2977 0 : break;
2978 : case SID_ATTR_CHAR_UNDERLINE:
2979 0 : if( rReq.GetArgs() )
2980 : {
2981 : //<<modify by wj for sym2_1873
2982 : //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
2983 0 : SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , false );
2984 : //end>>
2985 0 : if (pItem)
2986 : {
2987 0 : aNewAttr.Put(*pItem);
2988 : }
2989 : else
2990 : {
2991 0 : FontUnderline eFU = static_cast<const SvxUnderlineItem&>( aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
2992 0 : aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) );
2993 : }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) );
2994 : }
2995 0 : break;
2996 : case SID_ATTR_CHAR_SHADOWED:
2997 0 : if( rReq.GetArgs() )
2998 : {
2999 0 : SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , false );
3000 0 : if (pItem)
3001 : {
3002 0 : aNewAttr.Put(*pItem);
3003 : }
3004 : }
3005 0 : break;
3006 : case SID_ATTR_CHAR_STRIKEOUT:
3007 0 : if( rReq.GetArgs() )
3008 : {
3009 0 : SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , false );
3010 0 : if (pItem)
3011 : {
3012 0 : aNewAttr.Put(*pItem);
3013 : }
3014 : }
3015 0 : break;
3016 : case SID_ATTR_CHAR_COLOR:
3017 0 : if( rReq.GetArgs() )
3018 : {
3019 0 : SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , false );
3020 0 : if (pItem)
3021 : {
3022 0 : aNewAttr.Put(*pItem);
3023 : }
3024 : }
3025 0 : break;
3026 : case SID_ATTR_CHAR_KERNING:
3027 0 : if( rReq.GetArgs() )
3028 : {
3029 0 : SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , false );
3030 0 : if (pItem)
3031 : {
3032 0 : aNewAttr.Put(*pItem);
3033 : }
3034 : }
3035 0 : break;
3036 : case SID_ATTR_CHAR_CASEMAP:
3037 0 : if( rReq.GetArgs() )
3038 : {
3039 0 : SFX_REQUEST_ARG( rReq, pItem, SvxCaseMapItem, SID_ATTR_CHAR_CASEMAP , false );
3040 0 : if (pItem)
3041 : {
3042 0 : aNewAttr.Put(*pItem);
3043 : }
3044 : }
3045 0 : break;
3046 : case SID_SET_SUB_SCRIPT:
3047 : {
3048 0 : SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
3049 : SvxEscapement eEsc = (SvxEscapement ) static_cast<const SvxEscapementItem&>(
3050 0 : aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
3051 0 : if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
3052 0 : aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
3053 : else
3054 0 : aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
3055 0 : aNewAttr.Put( aItem );
3056 : }
3057 0 : break;
3058 : case SID_SET_SUPER_SCRIPT:
3059 : {
3060 0 : SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
3061 : SvxEscapement eEsc = (SvxEscapement ) static_cast<const SvxEscapementItem&>(
3062 0 : aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
3063 0 : if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
3064 0 : aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
3065 : else
3066 0 : aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
3067 0 : aNewAttr.Put( aItem );
3068 : }
3069 0 : break;
3070 : case SID_SHRINK_FONT_SIZE:
3071 : case SID_GROW_FONT_SIZE:
3072 : {
3073 0 : const SvxFontListItem* pFonts = dynamic_cast<const SvxFontListItem*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
3074 0 : const FontList* pFontList = pFonts ? pFonts->GetFontList() : NULL;
3075 0 : if( pFontList )
3076 : {
3077 0 : FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, NULL, pFontList, mpView );
3078 0 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
3079 : }
3080 : }
3081 : default:
3082 : ;
3083 : }
3084 :
3085 0 : mpDrawView->SetAttributes(aNewAttr);
3086 0 : rReq.Done();
3087 0 : Cancel();
3088 : }
3089 :
3090 : /** This method consists basically of three parts:
3091 : 1. Process the arguments of the SFX request.
3092 : 2. Use the model to create a new page or duplicate an existing one.
3093 : 3. Update the tab control and switch to the new page.
3094 : */
3095 0 : SdPage* DrawViewShell::CreateOrDuplicatePage (
3096 : SfxRequest& rRequest,
3097 : PageKind ePageKind,
3098 : SdPage* pPage,
3099 : const sal_Int32 nInsertPosition)
3100 : {
3101 0 : SdPage* pNewPage = NULL;
3102 0 : if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE)
3103 : {
3104 0 : if ( mpDrawView->IsTextEdit() )
3105 : {
3106 0 : mpDrawView->SdrEndTextEdit();
3107 : }
3108 0 : pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
3109 : }
3110 0 : return pNewPage;
3111 : }
3112 :
3113 0 : void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq)
3114 : {
3115 0 : if(SlideShow::IsRunning( GetViewShellBase() ))
3116 0 : return;
3117 :
3118 0 : SdDrawDocument* pDoc = GetDoc();
3119 0 : if (!pDoc || !mpDrawView)
3120 0 : return;
3121 :
3122 0 : sal_uInt16 nSId = rReq.GetSlot();
3123 0 : SfxItemSet aAttrs( pDoc->GetPool() );
3124 :
3125 0 : switch ( nSId )
3126 : {
3127 : case SID_TABLE_VERT_NONE:
3128 : case SID_TABLE_VERT_CENTER:
3129 : case SID_TABLE_VERT_BOTTOM:
3130 0 : SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
3131 0 : if (nSId == SID_TABLE_VERT_CENTER)
3132 0 : eTVA = SDRTEXTVERTADJUST_CENTER;
3133 0 : else if (nSId == SID_TABLE_VERT_BOTTOM)
3134 0 : eTVA = SDRTEXTVERTADJUST_BOTTOM;
3135 :
3136 0 : aAttrs.Put( SdrTextVertAdjustItem(eTVA) );
3137 0 : mpDrawView->SetAttributes(aAttrs);
3138 :
3139 0 : break;
3140 0 : }
3141 : }
3142 :
3143 3 : void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet)
3144 : {
3145 3 : SfxWhichIter aIter( rSet );
3146 3 : sal_uInt16 nWhich = aIter.FirstWhich();
3147 :
3148 3 : SdDrawDocument* pDoc = GetDoc();
3149 3 : if (!pDoc || !mpDrawView)
3150 3 : return;
3151 :
3152 6 : SfxItemSet aAttrs( pDoc->GetPool() );
3153 3 : mpDrawView->GetAttributes( aAttrs );
3154 :
3155 9 : while ( nWhich )
3156 : {
3157 3 : sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
3158 0 : ? GetPool().GetSlotId(nWhich)
3159 3 : : nWhich;
3160 3 : switch ( nSlotId )
3161 : {
3162 : case SID_TABLE_VERT_NONE:
3163 : case SID_TABLE_VERT_CENTER:
3164 : case SID_TABLE_VERT_BOTTOM:
3165 3 : bool bContour = false;
3166 3 : SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
3167 3 : if( eConState != SfxItemState::DONTCARE )
3168 : {
3169 3 : bContour = static_cast<const SdrOnOffItem&>( aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
3170 : }
3171 3 : if (bContour) break;
3172 :
3173 3 : SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
3174 : //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
3175 :
3176 : //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
3177 3 : if(SfxItemState::DONTCARE != eVState)
3178 : {
3179 3 : SdrTextVertAdjust eTVA = (SdrTextVertAdjust)static_cast<const SdrTextVertAdjustItem&>(aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
3180 1 : bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
3181 5 : (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
3182 4 : (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
3183 3 : rSet.Put(SfxBoolItem(nSlotId, bSet));
3184 : }
3185 : else
3186 : {
3187 0 : rSet.Put(SfxBoolItem(nSlotId, false));
3188 : }
3189 3 : break;
3190 : }
3191 3 : nWhich = aIter.NextWhich();
3192 3 : }
3193 : }
3194 :
3195 66 : } // end of namespace sd
3196 :
3197 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|