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 <com/sun/star/lang/XMultiServiceFactory.hpp>
21 : #include <com/sun/star/lang/Locale.hpp>
22 : #include <com/sun/star/linguistic2/XThesaurus.hpp>
23 : #include <svx/fmglob.hxx>
24 : #include <svx/globl3d.hxx>
25 : #include <svx/svdouno.hxx>
26 : #include <editeng/eeitem.hxx>
27 : #include <editeng/flditem.hxx>
28 : #include <editeng/outlobj.hxx>
29 : #include <officecfg/Office/Common.hxx>
30 : #include <officecfg/Office/Impress.hxx>
31 : #include <svx/svxids.hrc>
32 : #include <svx/svdpagv.hxx>
33 : #include <svx/clipfmtitem.hxx>
34 : #include <svx/fmshell.hxx>
35 : #include <svl/eitem.hxx>
36 : #include <svl/aeitem.hxx>
37 : #include <svl/stritem.hxx>
38 : #include <svl/visitem.hxx>
39 : #include <svl/whiter.hxx>
40 : #include <sfx2/dispatch.hxx>
41 : #include <svx/svdograf.hxx>
42 : #include <editeng/unolingu.hxx>
43 : #include <svx/extrusionbar.hxx>
44 : #include <svx/fontworkbar.hxx>
45 :
46 : // #UndoRedo#
47 : #include <svl/slstitm.hxx>
48 : #include <sfx2/app.hxx>
49 : #include <svtools/insdlg.hxx>
50 : #include <unotools/moduleoptions.hxx>
51 : #include <svl/languageoptions.hxx>
52 : #include <comphelper/processfactory.hxx>
53 : #include <sfx2/request.hxx>
54 :
55 : #include <svx/pfiledlg.hxx>
56 : #include <svx/grafctrl.hxx>
57 : #include <svtools/cliplistener.hxx>
58 : #include <sfx2/viewfrm.hxx>
59 :
60 : #include "app.hrc"
61 : #include "glob.hrc"
62 : #include "res_bmp.hrc"
63 : #include "PresentationViewShell.hxx"
64 :
65 : #include "Outliner.hxx"
66 : #include "drawdoc.hxx"
67 : #include "sdresid.hxx"
68 : #include "sdpage.hxx"
69 : #include "Client.hxx"
70 : #include "DrawDocShell.hxx"
71 : #include "zoomlist.hxx"
72 : #include "slideshow.hxx"
73 : #include "drawview.hxx"
74 : #include "ViewShellBase.hxx"
75 : #include "ViewShellManager.hxx"
76 : #include "LayerTabBar.hxx"
77 : #include "fupoor.hxx"
78 : #include "Window.hxx"
79 : #include "fuediglu.hxx"
80 : #include "fubullet.hxx"
81 : #include "fuformatpaintbrush.hxx"
82 :
83 : using namespace ::com::sun::star;
84 : using namespace ::com::sun::star::uno;
85 : using namespace ::com::sun::star::lang;
86 : using namespace ::com::sun::star::linguistic2;
87 :
88 : /** Create a list of clipboard formats that are supported both from the
89 : current clipboard content and the DrawViewShell.
90 : The list is stored in a new instance of SvxClipboardFmtItem.
91 : */
92 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
93 0 : ::std::auto_ptr<SvxClipboardFmtItem> GetSupportedClipboardFormats (
94 : TransferableDataHelper& rDataHelper)
95 : {
96 : ::std::auto_ptr<SvxClipboardFmtItem> pResult (
97 0 : new SvxClipboardFmtItem(SID_CLIPBOARD_FORMAT_ITEMS));
98 :
99 0 : sal_uInt32 nFormatCount (rDataHelper.GetFormatCount());
100 0 : for (sal_uInt32 i=0; i<nFormatCount; i++)
101 : {
102 0 : const SotFormatStringId nTestFormat = rDataHelper.GetFormat(i);
103 :
104 : // Check if the current format is the same as one that has already
105 : // been handled.
106 0 : bool bDuplicate (false);
107 0 : for (sal_uInt32 j=0; j<i; j++)
108 : {
109 0 : if (nTestFormat == rDataHelper.GetFormat(j))
110 : {
111 0 : bDuplicate = true;
112 0 : break;
113 : }
114 : }
115 :
116 : // Look up the format among those that are supported by the
117 : // DrawViewShell.
118 0 : if ( ! bDuplicate)
119 : {
120 0 : switch (nTestFormat)
121 : {
122 : case SOT_FORMATSTR_ID_EMBED_SOURCE:
123 : {
124 0 : OUString sName;
125 :
126 0 : TransferableObjectDescriptor aDescriptor;
127 0 : if (rDataHelper.GetTransferableObjectDescriptor(
128 : SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDescriptor))
129 : {
130 0 : sName = aDescriptor.maTypeName;
131 : }
132 0 : if (!sName.isEmpty())
133 0 : pResult->AddClipbrdFormat(nTestFormat, sName);
134 : else
135 0 : pResult->AddClipbrdFormat(nTestFormat);
136 :
137 0 : break;
138 : }
139 :
140 : case SOT_FORMATSTR_ID_LINK_SOURCE:
141 : case SOT_FORMATSTR_ID_DRAWING:
142 : case SOT_FORMATSTR_ID_SVXB:
143 : case FORMAT_GDIMETAFILE:
144 : case FORMAT_BITMAP:
145 : case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
146 : case FORMAT_STRING:
147 : case SOT_FORMATSTR_ID_HTML:
148 : case FORMAT_RTF:
149 : case SOT_FORMATSTR_ID_EDITENGINE:
150 0 : pResult->AddClipbrdFormat(nTestFormat);
151 0 : break;
152 : }
153 : }
154 : }
155 :
156 : // Check some OLE formats whose names are handled differently.
157 0 : SotFormatStringId nFormat (SOT_FORMATSTR_ID_EMBED_SOURCE_OLE);
158 0 : bool bHasFormat (rDataHelper.HasFormat(nFormat));
159 0 : if ( ! bHasFormat)
160 : {
161 0 : bHasFormat = rDataHelper.HasFormat(nFormat);
162 : }
163 0 : if (bHasFormat)
164 : {
165 0 : OUString sName;
166 0 : OUString sSource;
167 0 : if (SvPasteObjectHelper::GetEmbeddedName (rDataHelper, sName, sSource, nFormat))
168 0 : pResult->AddClipbrdFormat (nFormat, sName);
169 : }
170 :
171 0 : return pResult;
172 : }
173 : SAL_WNODEPRECATED_DECLARATIONS_POP
174 :
175 : namespace sd {
176 :
177 0 : IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
178 : {
179 0 : if ( pDataHelper )
180 : {
181 0 : mbPastePossible = ( pDataHelper->GetFormatCount() != 0 );
182 :
183 : // Update the list of supported clipboard formats according to the
184 : // new clipboard content.
185 : // There are some stack traces that indicate the possibility of the
186 : // DrawViewShell destructor called during the call to
187 : // GetSupportedClipboardFormats(). If that really has happened then
188 : // exit immediately.
189 : TransferableDataHelper aDataHelper (
190 0 : TransferableDataHelper::CreateFromSystemClipboard(GetActiveWindow()));
191 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
192 0 : ::std::auto_ptr<SvxClipboardFmtItem> pFormats (GetSupportedClipboardFormats(aDataHelper));
193 : SAL_WNODEPRECATED_DECLARATIONS_POP
194 0 : if (mpDrawView == NULL)
195 0 : return 0;
196 0 : mpCurrentClipboardFormats = pFormats;
197 :
198 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
199 0 : rBindings.Invalidate( SID_PASTE );
200 0 : rBindings.Invalidate( SID_PASTE_SPECIAL );
201 0 : rBindings.Invalidate( SID_PASTE_UNFORMATTED );
202 0 : rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
203 : }
204 0 : return 0;
205 : }
206 :
207 0 : void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet)
208 : {
209 0 : SfxItemSet aSet( mpDrawView->GetGeoAttrFromMarked() );
210 0 : rSet.Put(aSet,false);
211 0 : }
212 :
213 0 : void DrawViewShell::GetMenuState( SfxItemSet &rSet )
214 : {
215 0 : if (mpDrawView == NULL)
216 : {
217 : // This assertion and return are here to prevent crashes.
218 : DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
219 0 : return;
220 : }
221 :
222 0 : ViewShell::GetMenuState(rSet);
223 0 : sal_Bool bDisableVerticalText = !SvtLanguageOptions().IsVerticalTextEnabled();
224 :
225 0 : if ( bDisableVerticalText )
226 : {
227 0 : rSet.DisableItem( SID_DRAW_FONTWORK_VERTICAL );
228 0 : rSet.DisableItem( SID_DRAW_CAPTION_VERTICAL );
229 0 : rSet.DisableItem( SID_TEXT_FITTOSIZE_VERTICAL );
230 0 : rSet.DisableItem( SID_DRAW_TEXT_VERTICAL );
231 : }
232 :
233 0 : bool bConvertToPathPossible = mpDrawView->IsConvertToPathObjPossible(false);
234 :
235 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
236 0 : const sal_uLong nMarkCount = rMarkList.GetMarkCount();
237 :
238 : //format paintbrush
239 0 : FuFormatPaintBrush::GetMenuState( *this, rSet );
240 :
241 : // State of SfxChild-Windows (Animator, Fontwork etc.)
242 0 : SetChildWindowState( rSet );
243 :
244 : // map images of toolboxes (only zoom)
245 0 : UpdateToolboxImages( rSet, sal_False );
246 :
247 0 : if(HasCurrentFunction())
248 : {
249 0 : sal_uInt16 nSId = GetCurrentFunction()->GetSlotID();
250 :
251 0 : rSet.Put( SfxBoolItem( nSId, true ) );
252 :
253 : // will cause a uncheck of a simulated slot
254 0 : sal_uInt16 nId = GetIdBySubId( nSId );
255 :
256 : // map images of the toolboxes
257 0 : UpdateToolboxImages( rSet );
258 :
259 0 : if( nId != SID_ZOOM_TOOLBOX &&
260 0 : nSId != SID_DRAWTBX_INSERT &&
261 0 : nSId != SID_POSITION &&
262 : nSId != SID_OBJECT_ALIGN )
263 : {
264 0 : if( nId != SID_OBJECT_CHOOSE_MODE )
265 0 : rSet.Put( TbxImageItem( SID_OBJECT_CHOOSE_MODE, 0 ) );
266 0 : if( nId != SID_DRAWTBX_TEXT )
267 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, 0 ) );
268 0 : if( nId != SID_DRAWTBX_RECTANGLES )
269 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_RECTANGLES, 0 ) );
270 0 : if( nId != SID_DRAWTBX_ELLIPSES )
271 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_ELLIPSES, 0 ) );
272 0 : if( nId != SID_DRAWTBX_LINES )
273 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_LINES, 0 ) );
274 0 : if( nId != SID_DRAWTBX_ARROWS )
275 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_ARROWS, 0 ) );
276 0 : if( nId != SID_DRAWTBX_3D_OBJECTS )
277 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_3D_OBJECTS, 0 ) );
278 0 : if( nId != SID_DRAWTBX_CONNECTORS )
279 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_CONNECTORS, 0 ) );
280 : }
281 : }
282 :
283 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
284 :
285 0 : GetMenuStateSel(rSet);
286 :
287 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT))
288 : {
289 0 : bool bDisable = true;
290 0 : if( pPageView )
291 : {
292 0 : SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
293 :
294 0 : if( pPage && !pPage->IsMasterPage() )
295 : {
296 0 : rSet.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT, static_cast< sal_uInt32 >(pPage->GetAutoLayout()) ) );
297 0 : bDisable = false;
298 : }
299 : }
300 :
301 0 : if(bDisable)
302 : {
303 0 : rSet.DisableItem(SID_ASSIGN_LAYOUT);
304 : }
305 : }
306 :
307 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
308 : {
309 0 : bool bDisable = true;
310 0 : if( pPageView )
311 : {
312 0 : SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
313 :
314 0 : if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
315 : {
316 0 : SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
317 :
318 0 : if (pObj!=NULL )
319 : {
320 0 : if( !pObj->IsEmptyPresObj() )
321 : {
322 0 : bDisable = false;
323 : }
324 : else
325 : {
326 : // check if the object is in edit, than its temporarely not empty
327 0 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
328 0 : if( pTextObj )
329 : {
330 0 : OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
331 0 : if( pParaObj )
332 : {
333 0 : delete pParaObj;
334 0 : bDisable = false;
335 : }
336 : }
337 : }
338 : }
339 : }
340 : }
341 :
342 0 : if(bDisable)
343 : {
344 0 : rSet.DisableItem(SID_EXPAND_PAGE);
345 : }
346 : }
347 :
348 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
349 : {
350 0 : bool bDisable = true;
351 0 : if( pPageView )
352 : {
353 0 : SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
354 :
355 0 : if( pPage && (pPage->GetPageKind() == PK_STANDARD) && !pPage->IsMasterPage() )
356 : {
357 0 : SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
358 :
359 0 : if(pObj && !pObj->IsEmptyPresObj())
360 : {
361 0 : bDisable = false;
362 : }
363 : }
364 : }
365 :
366 0 : if(bDisable)
367 : {
368 0 : rSet.DisableItem(SID_SUMMARY_PAGE);
369 : }
370 : }
371 :
372 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT))
373 : {
374 0 : bool bDisable = true;
375 0 : if( pPageView )
376 : {
377 0 : SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
378 :
379 0 : if( pPage && !pPage->IsMasterPage() )
380 : {
381 0 : rSet.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT, pPage->GetAutoLayout()) );
382 0 : bDisable = false;
383 : }
384 : }
385 :
386 0 : if(bDisable)
387 : {
388 0 : rSet.DisableItem(SID_ASSIGN_LAYOUT);
389 : }
390 : }
391 :
392 : // is it possible to start the presentation?
393 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ||
394 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) )
395 : {
396 0 : sal_Bool bDisable = sal_True;
397 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
398 :
399 0 : for( sal_uInt16 i = 0; i < nCount && bDisable; i++ )
400 : {
401 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
402 :
403 0 : if( !pPage->IsExcluded() )
404 0 : bDisable = sal_False;
405 : }
406 :
407 0 : if( bDisable || GetDocSh()->IsPreview())
408 : {
409 0 : rSet.DisableItem( SID_PRESENTATION );
410 0 : rSet.DisableItem( SID_REHEARSE_TIMINGS );
411 : }
412 : }
413 :
414 : // glue points
415 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_EDITMODE ) ||
416 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_INSERT_POINT ) ||
417 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_PERCENT ) ||
418 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR ) ||
419 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_LEFT ) ||
420 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_RIGHT ) ||
421 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_TOP ) ||
422 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_ESCDIR_BOTTOM ) ||
423 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_CENTER ) ||
424 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_LEFT ) ||
425 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_HORZALIGN_RIGHT ) ||
426 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_CENTER ) ||
427 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_TOP ) ||
428 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GLUE_VERTALIGN_BOTTOM ) )
429 : {
430 : // percent
431 0 : TRISTATE eState = mpDrawView->IsMarkedGluePointsPercent();
432 0 : if( eState == TRISTATE_INDET )
433 0 : rSet.InvalidateItem( SID_GLUE_PERCENT );
434 : else
435 0 : rSet.Put( SfxBoolItem( SID_GLUE_PERCENT, eState == TRISTATE_TRUE ) );
436 :
437 : // alignment has no effect by percent
438 0 : if( eState == TRISTATE_TRUE )
439 : {
440 0 : rSet.DisableItem( SID_GLUE_HORZALIGN_CENTER );
441 0 : rSet.DisableItem( SID_GLUE_HORZALIGN_LEFT );
442 0 : rSet.DisableItem( SID_GLUE_HORZALIGN_RIGHT );
443 0 : rSet.DisableItem( SID_GLUE_VERTALIGN_CENTER );
444 0 : rSet.DisableItem( SID_GLUE_VERTALIGN_TOP );
445 0 : rSet.DisableItem( SID_GLUE_VERTALIGN_BOTTOM );
446 : }
447 : else
448 : {
449 : // horizontal alignment
450 0 : sal_uInt16 nHorz = mpDrawView->GetMarkedGluePointsAlign( false );
451 0 : rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_CENTER, nHorz == SDRHORZALIGN_CENTER ) );
452 0 : rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_LEFT, nHorz == SDRHORZALIGN_LEFT ) );
453 0 : rSet.Put( SfxBoolItem( SID_GLUE_HORZALIGN_RIGHT, nHorz == SDRHORZALIGN_RIGHT ) );
454 : // vertical alignment
455 0 : sal_uInt16 nVert = mpDrawView->GetMarkedGluePointsAlign( true );
456 0 : rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_CENTER, nVert == SDRVERTALIGN_CENTER ) );
457 0 : rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_TOP, nVert == SDRVERTALIGN_TOP ) );
458 0 : rSet.Put( SfxBoolItem( SID_GLUE_VERTALIGN_BOTTOM, nVert == SDRVERTALIGN_BOTTOM ) );
459 : }
460 :
461 : // insert point
462 0 : rSet.Put( SfxBoolItem( SID_GLUE_INSERT_POINT, mpDrawView->IsInsGluePointMode() ) );
463 :
464 : // Escape direction
465 : // left
466 0 : eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_LEFT );
467 0 : if( eState == TRISTATE_INDET )
468 0 : rSet.InvalidateItem( SID_GLUE_ESCDIR_LEFT );
469 : else
470 0 : rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_LEFT, eState == TRISTATE_TRUE ) );
471 : // right
472 0 : eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_RIGHT );
473 0 : if( eState == TRISTATE_INDET )
474 0 : rSet.InvalidateItem( SID_GLUE_ESCDIR_RIGHT );
475 : else
476 0 : rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_RIGHT, eState == TRISTATE_TRUE ) );
477 : // top
478 0 : eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_TOP );
479 0 : if( eState == TRISTATE_INDET )
480 0 : rSet.InvalidateItem( SID_GLUE_ESCDIR_TOP );
481 : else
482 0 : rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_TOP, eState == TRISTATE_TRUE ) );
483 : // bottom
484 0 : eState = mpDrawView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM );
485 0 : if( eState == TRISTATE_INDET )
486 0 : rSet.InvalidateItem( SID_GLUE_ESCDIR_BOTTOM );
487 : else
488 0 : rSet.Put( SfxBoolItem( SID_GLUE_ESCDIR_BOTTOM, eState == TRISTATE_TRUE ) );
489 : }
490 :
491 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GRID_FRONT ) ||
492 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_HELPLINES_FRONT ) )
493 : {
494 0 : rSet.Put( SfxBoolItem( SID_GRID_FRONT, mpDrawView->IsGridFront() ) );
495 0 : rSet.Put( SfxBoolItem( SID_HELPLINES_FRONT, mpDrawView->IsHlplFront() ) );
496 : }
497 :
498 0 : if (!mpDrawView->IsFrameDragSingles())
499 0 : rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, true));
500 : else
501 0 : rSet.Put(SfxBoolItem(SID_BEZIER_EDIT, false));
502 :
503 0 : if(dynamic_cast<FuEditGluePoints*>( GetCurrentFunction().get()))
504 0 : rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, true));
505 : else
506 0 : rSet.Put(SfxBoolItem(SID_GLUE_EDITMODE, false));
507 :
508 0 : if( !mpDrawView->IsMirrorAllowed( true, true ) )
509 : {
510 0 : rSet.DisableItem( SID_HORIZONTAL );
511 0 : rSet.DisableItem( SID_VERTICAL );
512 0 : rSet.DisableItem( SID_FLIP_HORIZONTAL );
513 0 : rSet.DisableItem( SID_FLIP_VERTICAL );
514 : }
515 :
516 0 : if( !mpDrawView->IsMirrorAllowed() )
517 : {
518 0 : rSet.DisableItem( SID_OBJECT_MIRROR );
519 : // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE );
520 : // rSet.DisableItem( SID_CONVERT_TO_3D_LATHE_FAST );
521 : }
522 :
523 : // interactive transparence control
524 0 : if(!mpDrawView->IsTransparenceAllowed())
525 : {
526 0 : rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
527 : }
528 :
529 : // interactive gradient control
530 0 : if(!mpDrawView->IsGradientAllowed())
531 : {
532 0 : rSet.DisableItem( SID_OBJECT_GRADIENT );
533 : }
534 :
535 : // disable morphing if necessary
536 0 : if ( !mpDrawView->IsMorphingAllowed() )
537 0 : rSet.DisableItem( SID_POLYGON_MORPHING );
538 :
539 : // disable vectorizing if necessary
540 0 : if ( !mpDrawView->IsVectorizeAllowed() )
541 0 : rSet.DisableItem( SID_VECTORIZE );
542 :
543 0 : if( !mpDrawView->IsReverseOrderPossible() )
544 : {
545 0 : rSet.DisableItem( SID_REVERSE_ORDER );
546 : }
547 :
548 0 : if ( !bConvertToPathPossible &&
549 0 : !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
550 : {
551 : // implicit transformation into curve not possible
552 0 : rSet.DisableItem(SID_OBJECT_CROOK_ROTATE);
553 0 : rSet.DisableItem(SID_OBJECT_CROOK_SLANT);
554 0 : rSet.DisableItem(SID_OBJECT_CROOK_STRETCH);
555 : }
556 :
557 0 : if ( !mpDrawView->IsGroupEntered() )
558 : {
559 0 : rSet.DisableItem( SID_LEAVE_GROUP );
560 0 : rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, false ) );
561 0 : rSet.ClearItem( SID_LEAVE_ALL_GROUPS );
562 0 : rSet.DisableItem( SID_LEAVE_ALL_GROUPS );
563 : }
564 : else
565 0 : rSet.Put( SfxBoolItem( SID_LEAVE_ALL_GROUPS, true ) );
566 :
567 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
568 : {
569 0 : if ( !mpDrawView->IsTextEdit() )
570 : {
571 0 : rSet.DisableItem( SID_THESAURUS );
572 : }
573 : else
574 : {
575 0 : LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
576 0 : Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
577 :
578 0 : if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale( LanguageTag::convertToLocale( eLang)) )
579 0 : rSet.DisableItem( SID_THESAURUS );
580 : }
581 : }
582 :
583 0 : if ( !mpDrawView->IsTextEdit() )
584 : {
585 0 : rSet.DisableItem( SID_THESAURUS );
586 : }
587 :
588 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) ||
589 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SIZE_ALL ) )
590 : {
591 0 : if( pPageView && pPageView->GetObjList()->GetObjCount() == 0 )
592 : {
593 : // should be disabled if there is no object on the draw area:
594 0 : rSet.DisableItem( SID_SELECTALL );
595 0 : rSet.DisableItem( SID_SIZE_ALL );
596 : }
597 : }
598 :
599 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONTEXT ) )
600 0 : rSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
601 :
602 : // clipboard (paste)
603 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) ||
604 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_SPECIAL ) ||
605 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_UNFORMATTED ) ||
606 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
607 : {
608 0 : if ( !mpClipEvtLstnr )
609 : {
610 : // avoid clipboard initialization for
611 : // read-only presentation views (workaround for NT4.0
612 : // clipboard prob...)
613 0 : if( !ISA(PresentationViewShell) )
614 : {
615 : // create listener
616 0 : mpClipEvtLstnr = new TransferableClipboardListener( LINK( this, DrawViewShell, ClipboardChanged ) );
617 0 : mpClipEvtLstnr->acquire();
618 0 : mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), true );
619 :
620 : // get initial state
621 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
622 0 : mbPastePossible = ( aDataHelper.GetFormatCount() != 0 );
623 : }
624 : else
625 0 : mbPastePossible = sal_False;
626 : }
627 :
628 0 : if( !mbPastePossible )
629 : {
630 0 : rSet.DisableItem( SID_PASTE );
631 0 : rSet.DisableItem( SID_PASTE_SPECIAL );
632 0 : rSet.DisableItem( SID_PASTE_UNFORMATTED );
633 0 : rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
634 : }
635 0 : else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
636 : {
637 0 : if (mpCurrentClipboardFormats.get() != NULL)
638 0 : rSet.Put(*mpCurrentClipboardFormats);
639 : }
640 : }
641 :
642 0 : if ( !bConvertToPathPossible )
643 : {
644 0 : rSet.DisableItem(SID_CHANGEBEZIER);
645 : }
646 :
647 0 : if (mpDrawView == NULL)
648 : {
649 : // The mpDrawView was not NULL but is now.
650 : // The reason for this may be that the DrawViewShell has been
651 : // destroyed in the mean time.
652 : // We can only return immediately and hope that the deleted
653 : // DrawViewShell is not called again.
654 : DBG_ASSERT(mpDrawView!=NULL, "Please report this assertion to the Impress team.");
655 0 : return;
656 : }
657 :
658 0 : if( !( mpDrawView->IsConvertToPolyObjPossible(false) || mpDrawView->IsVectorizeAllowed() ) )
659 0 : rSet.DisableItem(SID_CHANGEPOLYGON);
660 :
661 0 : if( !( mpDrawView->IsConvertToPolyObjPossible(false) || mpDrawView->IsConvertToContourPossible() ) )
662 0 : rSet.DisableItem(SID_CONVERT_TO_CONTOUR);
663 :
664 0 : if ( !mpDrawView->IsConvertTo3DObjPossible() )
665 : {
666 0 : rSet.DisableItem(SID_CONVERT_TO_3D);
667 0 : rSet.DisableItem(SID_CONVERT_TO_3D_LATHE);
668 0 : rSet.DisableItem(SID_CONVERT_TO_3D_LATHE_FAST);
669 : }
670 :
671 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MANAGE_LINKS ) )
672 : {
673 0 : if ( GetDoc()->GetLinkCount() == 0 )
674 : {
675 0 : rSet.DisableItem(SID_MANAGE_LINKS);
676 : }
677 : }
678 :
679 0 : if (mePageKind == PK_HANDOUT)
680 : {
681 0 : rSet.DisableItem(SID_PRESENTATION_LAYOUT);
682 0 : rSet.DisableItem(SID_SELECT_BACKGROUND);
683 : }
684 :
685 0 : if (mePageKind == PK_NOTES)
686 : {
687 0 : rSet.DisableItem(SID_INSERTPAGE);
688 0 : rSet.DisableItem(SID_RENAMEPAGE);
689 0 : rSet.DisableItem(SID_RENAMEPAGE_QUICK);
690 0 : rSet.DisableItem(SID_DUPLICATE_PAGE);
691 0 : rSet.ClearItem(SID_ANIMATION_OBJECTS);
692 0 : rSet.DisableItem(SID_ANIMATION_OBJECTS);
693 0 : rSet.DisableItem(SID_ANIMATION_EFFECTS);
694 :
695 0 : if (meEditMode == EM_MASTERPAGE)
696 0 : rSet.DisableItem(SID_MODIFYPAGE);
697 :
698 0 : rSet.DisableItem(SID_SELECT_BACKGROUND);
699 0 : rSet.DisableItem(SID_INSERTLAYER);
700 0 : rSet.DisableItem(SID_LAYERMODE);
701 0 : rSet.DisableItem(SID_INSERTFILE);
702 : }
703 0 : else if (mePageKind == PK_HANDOUT)
704 : {
705 0 : rSet.DisableItem(SID_INSERTPAGE);
706 0 : rSet.DisableItem(SID_DUPLICATE_PAGE);
707 0 : rSet.ClearItem(SID_ANIMATION_OBJECTS);
708 0 : rSet.DisableItem(SID_ANIMATION_OBJECTS);
709 0 : rSet.DisableItem(SID_ANIMATION_EFFECTS);
710 0 : rSet.DisableItem(SID_RENAMEPAGE);
711 0 : rSet.DisableItem(SID_RENAMEPAGE_QUICK);
712 0 : rSet.DisableItem(SID_INSERTLAYER);
713 0 : rSet.DisableItem(SID_MODIFYLAYER);
714 0 : rSet.DisableItem(SID_RENAMELAYER);
715 0 : rSet.DisableItem(SID_LAYERMODE);
716 0 : rSet.DisableItem(SID_INSERTFILE);
717 0 : rSet.DisableItem(SID_PAGEMODE);
718 0 : rSet.DisableItem(SID_SELECT_BACKGROUND);
719 : }
720 : else
721 : {
722 0 : if (meEditMode == EM_MASTERPAGE)
723 : {
724 0 : rSet.DisableItem(SID_INSERTPAGE);
725 0 : rSet.DisableItem(SID_DUPLICATE_PAGE);
726 0 : rSet.DisableItem(SID_MODIFYPAGE);
727 0 : rSet.ClearItem(SID_ANIMATION_OBJECTS);
728 0 : rSet.DisableItem(SID_ANIMATION_OBJECTS);
729 : }
730 :
731 0 : rSet.Put (SfxBoolItem (SID_LAYERMODE, IsLayerModeActive()));
732 : }
733 :
734 0 : if ( ! IsLayerModeActive())
735 : {
736 0 : rSet.DisableItem( SID_INSERTLAYER );
737 0 : rSet.DisableItem( SID_MODIFYLAYER );
738 0 : rSet.DisableItem( SID_DELETE_LAYER );
739 0 : rSet.DisableItem( SID_RENAMELAYER );
740 : }
741 :
742 0 : if (meEditMode == EM_PAGE)
743 : {
744 : /**********************************************************************
745 : * page mode
746 : **********************************************************************/
747 0 : rSet.Put(SfxBoolItem(SID_PAGEMODE, true));
748 0 : rSet.Put(SfxBoolItem(SID_MASTERPAGE, false));
749 0 : rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, false));
750 0 : rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, false));
751 0 : rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, false));
752 :
753 0 : if (mePageKind == PK_STANDARD &&
754 0 : rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
755 : {
756 : // Is there a page with the AutoLayout "Title"?
757 0 : sal_Bool bDisable = sal_True;
758 0 : sal_uInt16 i = 0;
759 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
760 :
761 0 : while (i < nCount && bDisable)
762 : {
763 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
764 :
765 0 : if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
766 : {
767 0 : bDisable = sal_False;
768 : }
769 :
770 0 : i++;
771 : }
772 :
773 0 : if (bDisable)
774 : {
775 0 : rSet.DisableItem(SID_TITLE_MASTERPAGE);
776 : }
777 : else
778 : {
779 0 : rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, false));
780 : }
781 : }
782 : else
783 : {
784 0 : rSet.DisableItem(SID_TITLE_MASTERPAGE);
785 : }
786 :
787 0 : rSet.DisableItem (SID_INSERT_MASTER_PAGE);
788 0 : rSet.DisableItem (SID_DELETE_MASTER_PAGE);
789 0 : rSet.DisableItem (SID_RENAME_MASTER_PAGE);
790 0 : rSet.DisableItem (SID_CLOSE_MASTER_VIEW);
791 : }
792 : else
793 : {
794 0 : rSet.Put(SfxBoolItem(SID_PAGEMODE, false));
795 0 : rSet.Put(SfxBoolItem(SID_MASTERPAGE, true));
796 :
797 : /**********************************************************************
798 : * Background page mode
799 : **********************************************************************/
800 0 : if (mePageKind == PK_STANDARD)
801 : {
802 0 : rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, true));
803 0 : rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, false));
804 0 : rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, false));
805 :
806 0 : if (rSet.GetItemState(SID_TITLE_MASTERPAGE) == SFX_ITEM_AVAILABLE)
807 : {
808 0 : sal_Bool bCheck = sal_False;
809 0 : sal_Bool bDisable = sal_True;
810 0 : if( pPageView )
811 : {
812 0 : SdPage* pMPage = dynamic_cast< SdPage* >( pPageView->GetPage() );
813 :
814 0 : sal_uInt16 i = 0;
815 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
816 :
817 : // Is there a reference to the current master page from a page
818 : // with the AutoLayout "Title"?
819 0 : while (i < nCount && !bCheck && bDisable)
820 : {
821 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
822 :
823 : // page does reference the current master page
824 0 : if (pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
825 : {
826 : // a page does have a AutoLayout "Title"
827 0 : bDisable = sal_False;
828 :
829 0 : SdPage& rRefMPage = (SdPage&)(pPage->TRG_GetMasterPage());
830 :
831 0 : if(&rRefMPage == pMPage)
832 : {
833 : // a page with the AutoLayout "Title" does reference
834 : // the current master page
835 0 : bCheck = sal_True;
836 : }
837 : }
838 :
839 0 : i++;
840 : }
841 : }
842 :
843 0 : if (bCheck)
844 : {
845 0 : rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, false));
846 : }
847 :
848 0 : rSet.Put(SfxBoolItem(SID_TITLE_MASTERPAGE, bCheck));
849 :
850 0 : if (bDisable)
851 : {
852 0 : rSet.ClearItem(SID_TITLE_MASTERPAGE);
853 0 : rSet.DisableItem(SID_TITLE_MASTERPAGE);
854 : }
855 : }
856 : }
857 0 : else if (mePageKind == PK_NOTES)
858 : {
859 0 : rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, false));
860 0 : rSet.DisableItem(SID_TITLE_MASTERPAGE);
861 0 : rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, true));
862 0 : rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, false));
863 : }
864 0 : else if (mePageKind == PK_HANDOUT)
865 : {
866 0 : rSet.Put(SfxBoolItem(SID_SLIDE_MASTERPAGE, false));
867 0 : rSet.DisableItem(SID_TITLE_MASTERPAGE);
868 0 : rSet.Put(SfxBoolItem(SID_NOTES_MASTERPAGE, false));
869 0 : rSet.Put(SfxBoolItem(SID_HANDOUT_MASTERPAGE, true));
870 : }
871 : }
872 :
873 : // set state of the ruler
874 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_RULER ) )
875 0 : rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
876 :
877 : // do not delete the last page or a master page
878 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_PAGE )
879 0 : || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) )
880 : {
881 0 : if (maTabControl.GetPageCount() == 1 ||
882 0 : meEditMode == EM_MASTERPAGE ||
883 0 : mePageKind == PK_NOTES ||
884 0 : mePageKind == PK_HANDOUT ||
885 0 : (GetShellType()!=ST_DRAW&&IsLayerModeActive()))
886 : {
887 0 : if (rSet.GetItemState(SID_DELETE_PAGE) == SFX_ITEM_AVAILABLE)
888 0 : rSet.DisableItem(SID_DELETE_PAGE);
889 0 : if (rSet.GetItemState(SID_DELETE_MASTER_PAGE)==SFX_ITEM_AVAILABLE)
890 0 : rSet.DisableItem(SID_DELETE_MASTER_PAGE);
891 : }
892 : }
893 :
894 : // is it allowed to delete the current layer?
895 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) )
896 : {
897 0 : if(GetLayerTabControl()) // #i87182#
898 : {
899 0 : sal_uInt16 nCurrentLayer = GetLayerTabControl()->GetCurPageId();
900 0 : const OUString& rName = GetLayerTabControl()->GetPageText(nCurrentLayer);
901 :
902 0 : bool bDisableIt = !IsLayerModeActive();
903 0 : bDisableIt |= (rName == SD_RESSTR(STR_LAYER_LAYOUT));
904 0 : bDisableIt |= (rName == SD_RESSTR(STR_LAYER_BCKGRND));
905 0 : bDisableIt |= (rName == SD_RESSTR(STR_LAYER_BCKGRNDOBJ));
906 0 : bDisableIt |= (rName == SD_RESSTR(STR_LAYER_CONTROLS));
907 0 : bDisableIt |= (rName == SD_RESSTR(STR_LAYER_MEASURELINES));
908 :
909 0 : if (bDisableIt)
910 : {
911 0 : rSet.DisableItem(SID_DELETE_LAYER);
912 0 : rSet.DisableItem(SID_RENAMELAYER);
913 0 : }
914 : }
915 : else
916 : {
917 : OSL_ENSURE(false, "No LayerTabBar (!)");
918 : }
919 : }
920 :
921 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CUT ) ||
922 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COPY ) ||
923 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTLINE_BULLET ))
924 : {
925 0 : OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
926 :
927 : // special treatment of for SID_OUTLINE_BULLET if objects with different
928 : // kinds of NumBullets are marked
929 0 : sal_Bool bHasOutliner = sal_False;
930 0 : sal_Bool bHasOther = sal_False;
931 0 : for(sal_uLong nNum = 0; nNum < nMarkCount; nNum++)
932 : {
933 0 : SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
934 0 : if( pObj->GetObjInventor() == SdrInventor )
935 : {
936 0 : if( pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
937 : {
938 0 : bHasOutliner = sal_True;
939 0 : if(bHasOther)
940 0 : break;
941 : }
942 : else
943 : {
944 0 : bHasOther = sal_True;
945 0 : if(bHasOutliner)
946 0 : break;
947 : }
948 : }
949 : }
950 :
951 0 : if( bHasOther && bHasOutliner )
952 0 : rSet.DisableItem( SID_OUTLINE_BULLET );
953 :
954 0 : if (pOlView)
955 : {
956 0 : if (pOlView->GetSelected().isEmpty())
957 : {
958 0 : rSet.DisableItem( SID_CUT );
959 0 : rSet.DisableItem( SID_COPY );
960 : }
961 : }
962 :
963 : }
964 :
965 0 : FuBullet::GetSlotState( rSet, this, GetViewFrame() );
966 :
967 0 : if ( GetDocSh()->IsUIActive() )
968 : {
969 0 : rSet.DisableItem( SID_INSERT_OBJECT );
970 0 : rSet.DisableItem( SID_INSERT_PLUGIN );
971 0 : rSet.DisableItem( SID_INSERT_SOUND );
972 0 : rSet.DisableItem( SID_INSERT_VIDEO );
973 0 : rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
974 0 : rSet.DisableItem( SID_INSERT_MATH );
975 0 : rSet.DisableItem( SID_INSERT_DIAGRAM );
976 0 : rSet.DisableItem( SID_ATTR_TABLE );
977 0 : rSet.DisableItem( SID_SIZE_REAL );
978 0 : rSet.DisableItem( SID_SIZE_OPTIMAL );
979 0 : rSet.DisableItem( SID_SIZE_ALL );
980 0 : rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
981 0 : rSet.DisableItem( SID_SIZE_PAGE );
982 0 : rSet.DisableItem( SID_DUPLICATE_PAGE );
983 0 : rSet.DisableItem( SID_ZOOM_TOOLBOX );
984 : }
985 :
986 : // Zoom-State
987 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
988 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT )||
989 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_PANNING ) )
990 : {
991 0 : if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
992 : {
993 0 : rSet.DisableItem( SID_ZOOM_IN );
994 0 : rSet.DisableItem( SID_ZOOM_PANNING );
995 : }
996 0 : if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
997 0 : rSet.DisableItem( SID_ZOOM_OUT );
998 : }
999 :
1000 0 : if (!mpZoomList->IsNextPossible())
1001 : {
1002 0 : rSet.DisableItem(SID_ZOOM_NEXT);
1003 : }
1004 0 : if (!mpZoomList->IsPreviousPossible())
1005 : {
1006 0 : rSet.DisableItem(SID_ZOOM_PREV);
1007 : }
1008 :
1009 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REMOTE_DLG ) )
1010 : {
1011 :
1012 0 : bool bDisableSdremoteForGood = false;
1013 : #ifndef ENABLE_SDREMOTE
1014 : bDisableSdremoteForGood = true;
1015 : #endif
1016 0 : uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
1017 0 : if ( xContext.is() )
1018 : bDisableSdremoteForGood |= ! ( /*officecfg::Office::Common::Misc::ExperimentalMode::get( xContext ) &&*/
1019 :
1020 0 : officecfg::Office::Impress::Misc::Start::EnableSdremote::get( xContext ) );
1021 :
1022 : // This dialog is only useful for TCP/IP remote control
1023 : // which is unusual, under-tested and a security issue.
1024 0 : if ( bDisableSdremoteForGood )
1025 : {
1026 0 : rSet.Put(SfxVisibilityItem(SID_REMOTE_DLG, false));
1027 0 : }
1028 : }
1029 :
1030 : // EditText active
1031 0 : if (GetViewShellBase().GetViewShellManager()->GetShell(RID_DRAW_TEXT_TOOLBOX) != NULL)
1032 : {
1033 0 : sal_uInt16 nCurrentSId = SID_ATTR_CHAR;
1034 :
1035 0 : if(HasCurrentFunction())
1036 : {
1037 0 : nCurrentSId = GetCurrentFunction()->GetSlotID();
1038 : }
1039 0 : if( nCurrentSId != SID_TEXT_FITTOSIZE &&
1040 0 : nCurrentSId != SID_TEXT_FITTOSIZE_VERTICAL &&
1041 : nCurrentSId != SID_ATTR_CHAR_VERTICAL )
1042 0 : nCurrentSId = SID_ATTR_CHAR;
1043 :
1044 0 : rSet.Put( SfxBoolItem( nCurrentSId, true ) );
1045 :
1046 : // Short version of UpdateToolboxImages()
1047 0 : rSet.Put( TbxImageItem( SID_DRAWTBX_TEXT, nCurrentSId ) );
1048 : }
1049 :
1050 0 : if ( GetDocSh()->IsReadOnly() )
1051 : {
1052 0 : rSet.DisableItem( SID_AUTOSPELL_CHECK );
1053 : }
1054 : else
1055 : {
1056 0 : if (GetDoc()->GetOnlineSpell())
1057 : {
1058 0 : rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, true));
1059 : }
1060 : else
1061 : {
1062 0 : rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, false));
1063 : }
1064 : }
1065 :
1066 0 : SdrPageView* pPV = mpDrawView->GetSdrPageView();
1067 0 : OUString aActiveLayer = mpDrawView->GetActiveLayer();
1068 :
1069 0 : if ( ( !aActiveLayer.isEmpty() && pPV && ( pPV->IsLayerLocked(aActiveLayer) ||
1070 0 : !pPV->IsLayerVisible(aActiveLayer) ) ) ||
1071 0 : SD_MOD()->GetWaterCan() )
1072 : {
1073 0 : rSet.DisableItem( SID_PASTE );
1074 0 : rSet.DisableItem( SID_PASTE_SPECIAL );
1075 0 : rSet.DisableItem( SID_PASTE_UNFORMATTED );
1076 0 : rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
1077 :
1078 0 : rSet.DisableItem( SID_INSERT_FLD_DATE_FIX );
1079 0 : rSet.DisableItem( SID_INSERT_FLD_DATE_VAR );
1080 0 : rSet.DisableItem( SID_INSERT_FLD_TIME_FIX );
1081 0 : rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
1082 0 : rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
1083 0 : rSet.DisableItem( SID_INSERT_FLD_PAGE );
1084 0 : rSet.DisableItem( SID_INSERT_FLD_PAGES );
1085 0 : rSet.DisableItem( SID_INSERT_FLD_FILE );
1086 :
1087 0 : rSet.DisableItem( SID_INSERT_GRAPHIC );
1088 0 : rSet.DisableItem( SID_INSERT_AVMEDIA );
1089 0 : rSet.DisableItem( SID_INSERT_DIAGRAM );
1090 0 : rSet.DisableItem( SID_INSERT_OBJECT );
1091 0 : rSet.DisableItem( SID_INSERT_PLUGIN );
1092 0 : rSet.DisableItem( SID_INSERT_SOUND );
1093 0 : rSet.DisableItem( SID_INSERT_VIDEO );
1094 0 : rSet.DisableItem( SID_INSERT_FLOATINGFRAME );
1095 :
1096 0 : rSet.DisableItem( SID_INSERT_MATH );
1097 0 : rSet.DisableItem( SID_INSERT_FRAME );
1098 0 : rSet.DisableItem( SID_INSERTFILE );
1099 0 : rSet.DisableItem( SID_ATTR_TABLE );
1100 0 : rSet.DisableItem( SID_COPYOBJECTS );
1101 :
1102 0 : rSet.DisableItem( SID_SCAN );
1103 0 : rSet.DisableItem( SID_TWAIN_SELECT );
1104 0 : rSet.DisableItem( SID_TWAIN_TRANSFER );
1105 :
1106 : // rSet.DisableItem( SID_BEZIER_EDIT );
1107 0 : rSet.DisableItem( SID_GLUE_EDITMODE );
1108 0 : rSet.DisableItem( SID_OBJECT_ROTATE );
1109 0 : rSet.DisableItem( SID_OBJECT_SHEAR );
1110 0 : rSet.DisableItem( SID_OBJECT_MIRROR );
1111 0 : rSet.DisableItem( SID_OBJECT_CROP );
1112 0 : rSet.DisableItem( SID_ATTR_GRAF_CROP );
1113 0 : rSet.DisableItem( SID_OBJECT_TRANSPARENCE );
1114 0 : rSet.DisableItem( SID_OBJECT_GRADIENT );
1115 0 : rSet.DisableItem( SID_OBJECT_CROOK_ROTATE );
1116 0 : rSet.DisableItem( SID_OBJECT_CROOK_SLANT );
1117 0 : rSet.DisableItem( SID_OBJECT_CROOK_STRETCH );
1118 :
1119 : // Disable all object-creating tools
1120 0 : rSet.ClearItem( SID_ATTR_CHAR );
1121 0 : rSet.DisableItem( SID_ATTR_CHAR );
1122 0 : rSet.ClearItem( SID_ATTR_CHAR_VERTICAL );
1123 0 : rSet.DisableItem( SID_ATTR_CHAR_VERTICAL );
1124 0 : rSet.ClearItem(SID_DRAW_LINE);
1125 0 : rSet.DisableItem(SID_DRAW_LINE);
1126 0 : rSet.ClearItem(SID_DRAW_MEASURELINE);
1127 0 : rSet.DisableItem(SID_DRAW_MEASURELINE);
1128 0 : rSet.ClearItem(SID_DRAW_XLINE);
1129 0 : rSet.DisableItem(SID_DRAW_XLINE);
1130 0 : rSet.ClearItem( SID_LINE_ARROW_START );
1131 0 : rSet.DisableItem( SID_LINE_ARROW_START );
1132 0 : rSet.ClearItem( SID_LINE_ARROW_END );
1133 0 : rSet.DisableItem( SID_LINE_ARROW_END );
1134 0 : rSet.ClearItem( SID_LINE_ARROWS );
1135 0 : rSet.DisableItem( SID_LINE_ARROWS );
1136 0 : rSet.ClearItem( SID_LINE_ARROW_CIRCLE );
1137 0 : rSet.DisableItem( SID_LINE_ARROW_CIRCLE );
1138 0 : rSet.ClearItem( SID_LINE_CIRCLE_ARROW );
1139 0 : rSet.DisableItem( SID_LINE_CIRCLE_ARROW );
1140 0 : rSet.ClearItem( SID_LINE_ARROW_SQUARE );
1141 0 : rSet.DisableItem( SID_LINE_ARROW_SQUARE );
1142 0 : rSet.ClearItem( SID_LINE_SQUARE_ARROW );
1143 0 : rSet.DisableItem( SID_LINE_SQUARE_ARROW );
1144 :
1145 0 : rSet.ClearItem(SID_DRAW_RECT);
1146 0 : rSet.DisableItem(SID_DRAW_RECT);
1147 0 : rSet.ClearItem(SID_DRAW_RECT_NOFILL);
1148 0 : rSet.DisableItem(SID_DRAW_RECT_NOFILL);
1149 0 : rSet.ClearItem(SID_DRAW_RECT_ROUND);
1150 0 : rSet.DisableItem(SID_DRAW_RECT_ROUND);
1151 0 : rSet.ClearItem(SID_DRAW_RECT_ROUND_NOFILL);
1152 0 : rSet.DisableItem(SID_DRAW_RECT_ROUND_NOFILL);
1153 0 : rSet.ClearItem(SID_DRAW_SQUARE);
1154 0 : rSet.DisableItem(SID_DRAW_SQUARE);
1155 0 : rSet.ClearItem(SID_DRAW_SQUARE_NOFILL);
1156 0 : rSet.DisableItem(SID_DRAW_SQUARE_NOFILL);
1157 0 : rSet.ClearItem(SID_DRAW_SQUARE_ROUND);
1158 0 : rSet.DisableItem(SID_DRAW_SQUARE_ROUND);
1159 0 : rSet.ClearItem(SID_DRAW_SQUARE_ROUND_NOFILL);
1160 0 : rSet.DisableItem(SID_DRAW_SQUARE_ROUND_NOFILL);
1161 0 : rSet.ClearItem(SID_DRAW_ELLIPSE);
1162 0 : rSet.DisableItem(SID_DRAW_ELLIPSE);
1163 0 : rSet.ClearItem(SID_DRAW_ELLIPSE_NOFILL);
1164 0 : rSet.DisableItem(SID_DRAW_ELLIPSE_NOFILL);
1165 0 : rSet.ClearItem(SID_DRAW_CIRCLE);
1166 0 : rSet.DisableItem(SID_DRAW_CIRCLE);
1167 0 : rSet.ClearItem(SID_DRAW_CIRCLE_NOFILL);
1168 0 : rSet.DisableItem(SID_DRAW_CIRCLE_NOFILL);
1169 0 : rSet.ClearItem(SID_DRAW_CAPTION);
1170 0 : rSet.DisableItem(SID_DRAW_CAPTION);
1171 0 : rSet.ClearItem(SID_DRAW_FONTWORK);
1172 0 : rSet.DisableItem(SID_DRAW_FONTWORK);
1173 0 : rSet.ClearItem(SID_DRAW_FONTWORK_VERTICAL);
1174 0 : rSet.DisableItem(SID_DRAW_FONTWORK_VERTICAL);
1175 0 : rSet.ClearItem(SID_DRAW_CAPTION_VERTICAL);
1176 0 : rSet.DisableItem(SID_DRAW_CAPTION_VERTICAL);
1177 0 : rSet.ClearItem(SID_TEXT_FITTOSIZE);
1178 0 : rSet.DisableItem(SID_TEXT_FITTOSIZE);
1179 0 : rSet.ClearItem(SID_TEXT_FITTOSIZE_VERTICAL);
1180 0 : rSet.DisableItem(SID_TEXT_FITTOSIZE_VERTICAL);
1181 0 : rSet.ClearItem(SID_TOOL_CONNECTOR);
1182 0 : rSet.DisableItem(SID_TOOL_CONNECTOR);
1183 0 : rSet.ClearItem(SID_CONNECTOR_ARROW_START);
1184 0 : rSet.DisableItem(SID_CONNECTOR_ARROW_START);
1185 0 : rSet.ClearItem(SID_CONNECTOR_ARROW_END);
1186 0 : rSet.DisableItem(SID_CONNECTOR_ARROW_END);
1187 0 : rSet.ClearItem(SID_CONNECTOR_ARROWS);
1188 0 : rSet.DisableItem(SID_CONNECTOR_ARROWS);
1189 0 : rSet.ClearItem(SID_CONNECTOR_CIRCLE_START);
1190 0 : rSet.DisableItem(SID_CONNECTOR_CIRCLE_START);
1191 0 : rSet.ClearItem(SID_CONNECTOR_CIRCLE_END);
1192 0 : rSet.DisableItem(SID_CONNECTOR_CIRCLE_END);
1193 0 : rSet.ClearItem(SID_CONNECTOR_CIRCLES);
1194 0 : rSet.DisableItem(SID_CONNECTOR_CIRCLES);
1195 0 : rSet.ClearItem(SID_CONNECTOR_LINE);
1196 0 : rSet.DisableItem(SID_CONNECTOR_LINE);
1197 0 : rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_START);
1198 0 : rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_START);
1199 0 : rSet.ClearItem(SID_CONNECTOR_LINE_ARROW_END);
1200 0 : rSet.DisableItem(SID_CONNECTOR_LINE_ARROW_END);
1201 0 : rSet.ClearItem(SID_CONNECTOR_LINE_ARROWS);
1202 0 : rSet.DisableItem(SID_CONNECTOR_LINE_ARROWS);
1203 0 : rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_START);
1204 0 : rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_START);
1205 0 : rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLE_END);
1206 0 : rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLE_END);
1207 0 : rSet.ClearItem(SID_CONNECTOR_LINE_CIRCLES);
1208 0 : rSet.DisableItem(SID_CONNECTOR_LINE_CIRCLES);
1209 0 : rSet.ClearItem(SID_CONNECTOR_CURVE);
1210 0 : rSet.DisableItem(SID_CONNECTOR_CURVE);
1211 0 : rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_START);
1212 0 : rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_START);
1213 0 : rSet.ClearItem(SID_CONNECTOR_CURVE_ARROW_END);
1214 0 : rSet.DisableItem(SID_CONNECTOR_CURVE_ARROW_END);
1215 0 : rSet.ClearItem(SID_CONNECTOR_CURVE_ARROWS);
1216 0 : rSet.DisableItem(SID_CONNECTOR_CURVE_ARROWS);
1217 0 : rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_START);
1218 0 : rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_START);
1219 0 : rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLE_END);
1220 0 : rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLE_END);
1221 0 : rSet.ClearItem(SID_CONNECTOR_CURVE_CIRCLES);
1222 0 : rSet.DisableItem(SID_CONNECTOR_CURVE_CIRCLES);
1223 0 : rSet.ClearItem(SID_CONNECTOR_LINES);
1224 0 : rSet.DisableItem(SID_CONNECTOR_LINES);
1225 0 : rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_START);
1226 0 : rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_START);
1227 0 : rSet.ClearItem(SID_CONNECTOR_LINES_ARROW_END);
1228 0 : rSet.DisableItem(SID_CONNECTOR_LINES_ARROW_END);
1229 0 : rSet.ClearItem(SID_CONNECTOR_LINES_ARROWS);
1230 0 : rSet.DisableItem(SID_CONNECTOR_LINES_ARROWS);
1231 0 : rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_START);
1232 0 : rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_START);
1233 0 : rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLE_END);
1234 0 : rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLE_END);
1235 0 : rSet.ClearItem(SID_CONNECTOR_LINES_CIRCLES);
1236 0 : rSet.DisableItem(SID_CONNECTOR_LINES_CIRCLES);
1237 0 : rSet.ClearItem(SID_DRAW_ARC);
1238 0 : rSet.DisableItem(SID_DRAW_ARC);
1239 0 : rSet.ClearItem(SID_DRAW_CIRCLEARC);
1240 0 : rSet.DisableItem(SID_DRAW_CIRCLEARC);
1241 0 : rSet.ClearItem(SID_DRAW_PIE);
1242 0 : rSet.DisableItem(SID_DRAW_PIE);
1243 0 : rSet.ClearItem(SID_DRAW_PIE_NOFILL);
1244 0 : rSet.DisableItem(SID_DRAW_PIE_NOFILL);
1245 0 : rSet.ClearItem(SID_DRAW_CIRCLEPIE);
1246 0 : rSet.DisableItem(SID_DRAW_CIRCLEPIE);
1247 0 : rSet.ClearItem(SID_DRAW_CIRCLEPIE_NOFILL);
1248 0 : rSet.DisableItem(SID_DRAW_CIRCLEPIE_NOFILL);
1249 0 : rSet.ClearItem(SID_DRAW_ELLIPSECUT);
1250 0 : rSet.DisableItem(SID_DRAW_ELLIPSECUT);
1251 0 : rSet.ClearItem(SID_DRAW_ELLIPSECUT_NOFILL);
1252 0 : rSet.DisableItem(SID_DRAW_ELLIPSECUT_NOFILL);
1253 0 : rSet.ClearItem(SID_DRAW_CIRCLECUT);
1254 0 : rSet.DisableItem(SID_DRAW_CIRCLECUT);
1255 0 : rSet.ClearItem(SID_DRAW_CIRCLECUT_NOFILL);
1256 0 : rSet.DisableItem(SID_DRAW_CIRCLECUT_NOFILL);
1257 0 : rSet.ClearItem(SID_DRAW_POLYGON);
1258 0 : rSet.DisableItem(SID_DRAW_POLYGON);
1259 0 : rSet.ClearItem(SID_DRAW_POLYGON_NOFILL);
1260 0 : rSet.DisableItem(SID_DRAW_POLYGON_NOFILL);
1261 0 : rSet.ClearItem(SID_DRAW_FREELINE);
1262 0 : rSet.DisableItem(SID_DRAW_FREELINE);
1263 0 : rSet.ClearItem(SID_DRAW_FREELINE_NOFILL);
1264 0 : rSet.DisableItem(SID_DRAW_FREELINE_NOFILL);
1265 0 : rSet.ClearItem(SID_DRAW_XPOLYGON);
1266 0 : rSet.DisableItem(SID_DRAW_XPOLYGON);
1267 0 : rSet.ClearItem(SID_DRAW_XPOLYGON_NOFILL);
1268 0 : rSet.DisableItem(SID_DRAW_XPOLYGON_NOFILL);
1269 0 : rSet.ClearItem(SID_DRAW_BEZIER_FILL);
1270 0 : rSet.DisableItem(SID_DRAW_BEZIER_FILL);
1271 0 : rSet.ClearItem(SID_DRAW_BEZIER_NOFILL);
1272 0 : rSet.DisableItem(SID_DRAW_BEZIER_NOFILL);
1273 0 : rSet.ClearItem(SID_3D_CUBE);
1274 0 : rSet.DisableItem(SID_3D_CUBE);
1275 0 : rSet.ClearItem(SID_3D_SHELL);
1276 0 : rSet.DisableItem(SID_3D_SHELL);
1277 0 : rSet.ClearItem(SID_3D_SPHERE);
1278 0 : rSet.DisableItem(SID_3D_SPHERE);
1279 0 : rSet.ClearItem(SID_3D_HALF_SPHERE);
1280 0 : rSet.DisableItem(SID_3D_HALF_SPHERE);
1281 0 : rSet.ClearItem(SID_3D_CYLINDER);
1282 0 : rSet.DisableItem(SID_3D_CYLINDER);
1283 0 : rSet.ClearItem(SID_3D_CONE);
1284 0 : rSet.DisableItem(SID_3D_CONE);
1285 0 : rSet.ClearItem(SID_3D_TORUS);
1286 0 : rSet.DisableItem(SID_3D_TORUS);
1287 0 : rSet.ClearItem(SID_3D_PYRAMID);
1288 0 : rSet.DisableItem(SID_3D_PYRAMID);
1289 : }
1290 :
1291 : // are the modules available?
1292 :
1293 0 : if (!SvtModuleOptions().IsCalc())
1294 : {
1295 : // remove menu entry if module is not available
1296 0 : rSet.Put( SfxVisibilityItem( SID_ATTR_TABLE, false ) );
1297 : }
1298 0 : if (!SvtModuleOptions().IsChart())
1299 : {
1300 0 : rSet.DisableItem( SID_INSERT_DIAGRAM );
1301 : }
1302 0 : if (!SvtModuleOptions().IsMath())
1303 : {
1304 0 : rSet.DisableItem( SID_INSERT_MATH );
1305 : }
1306 :
1307 0 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1308 0 : if( (xSlideshow.is() && xSlideshow->isRunning() && (xSlideshow->getAnimationMode() != ANIMATIONMODE_PREVIEW) ) || GetDocSh()->IsPreview() )
1309 : {
1310 : // Own Slots
1311 0 : rSet.DisableItem( SID_PRESENTATION );
1312 0 : rSet.DisableItem( SID_ZOOM_IN );
1313 0 : rSet.DisableItem( SID_ZOOM_OUT );
1314 0 : rSet.DisableItem( SID_ZOOM_PANNING );
1315 0 : rSet.DisableItem( SID_ZOOM_NEXT );
1316 0 : rSet.DisableItem( SID_ZOOM_PREV );
1317 0 : rSet.DisableItem( SID_SIZE_REAL );
1318 0 : rSet.DisableItem( SID_SIZE_OPTIMAL );
1319 0 : rSet.DisableItem( SID_SIZE_ALL );
1320 0 : rSet.DisableItem( SID_SIZE_PAGE_WIDTH );
1321 0 : rSet.DisableItem( SID_SIZE_PAGE );
1322 0 : rSet.DisableItem( SID_INSERTPAGE );
1323 0 : rSet.DisableItem( SID_DUPLICATE_PAGE );
1324 0 : rSet.DisableItem( SID_MODIFYPAGE );
1325 0 : rSet.DisableItem( SID_RENAMEPAGE );
1326 0 : rSet.DisableItem( SID_RENAMEPAGE_QUICK );
1327 0 : rSet.DisableItem( SID_DELETE_PAGE );
1328 0 : rSet.DisableItem( SID_PAGESETUP );
1329 :
1330 0 : if( xSlideshow.is() && xSlideshow->isRunning() )
1331 : {
1332 0 : rSet.ClearItem(SID_OBJECT_ALIGN);
1333 0 : rSet.ClearItem(SID_ZOOM_TOOLBOX);
1334 0 : rSet.ClearItem(SID_OBJECT_CHOOSE_MODE);
1335 0 : rSet.ClearItem(SID_DRAWTBX_TEXT);
1336 0 : rSet.ClearItem(SID_DRAWTBX_RECTANGLES);
1337 0 : rSet.ClearItem(SID_DRAWTBX_ELLIPSES);
1338 0 : rSet.ClearItem(SID_DRAWTBX_LINES);
1339 0 : rSet.ClearItem(SID_DRAWTBX_ARROWS);
1340 0 : rSet.ClearItem(SID_DRAWTBX_3D_OBJECTS);
1341 0 : rSet.ClearItem(SID_DRAWTBX_CONNECTORS);
1342 0 : rSet.ClearItem(SID_OBJECT_CHOOSE_MODE );
1343 0 : rSet.ClearItem(SID_DRAWTBX_INSERT);
1344 0 : rSet.ClearItem(SID_INSERTFILE);
1345 0 : rSet.ClearItem(SID_OBJECT_ROTATE);
1346 0 : rSet.ClearItem(SID_OBJECT_ALIGN);
1347 0 : rSet.ClearItem(SID_POSITION);
1348 0 : rSet.ClearItem(SID_FM_CONFIG);
1349 0 : rSet.ClearItem(SID_ANIMATION_EFFECTS);
1350 0 : rSet.ClearItem(SID_ANIMATION_OBJECTS);
1351 0 : rSet.ClearItem(SID_3D_WIN);
1352 :
1353 0 : rSet.DisableItem(SID_OBJECT_ALIGN);
1354 0 : rSet.DisableItem(SID_ZOOM_TOOLBOX);
1355 0 : rSet.DisableItem(SID_OBJECT_CHOOSE_MODE);
1356 0 : rSet.DisableItem(SID_DRAWTBX_TEXT);
1357 0 : rSet.DisableItem(SID_DRAWTBX_RECTANGLES);
1358 0 : rSet.DisableItem(SID_DRAWTBX_ELLIPSES);
1359 0 : rSet.DisableItem(SID_DRAWTBX_LINES);
1360 0 : rSet.DisableItem(SID_DRAWTBX_ARROWS);
1361 0 : rSet.DisableItem(SID_DRAWTBX_3D_OBJECTS);
1362 0 : rSet.DisableItem(SID_DRAWTBX_CONNECTORS);
1363 0 : rSet.DisableItem(SID_OBJECT_CHOOSE_MODE );
1364 0 : rSet.DisableItem(SID_DRAWTBX_INSERT);
1365 0 : rSet.DisableItem(SID_INSERTFILE);
1366 0 : rSet.DisableItem(SID_OBJECT_ROTATE);
1367 0 : rSet.DisableItem(SID_OBJECT_ALIGN);
1368 0 : rSet.DisableItem(SID_POSITION);
1369 0 : rSet.DisableItem(SID_FM_CONFIG);
1370 0 : rSet.DisableItem(SID_ANIMATION_EFFECTS);
1371 0 : rSet.DisableItem(SID_ANIMATION_OBJECTS);
1372 0 : rSet.DisableItem(SID_3D_WIN);
1373 : }
1374 : }
1375 :
1376 :
1377 : // Menuoption: Change->Convert->To Bitmap, Change->Convert->To Metafile
1378 : // disable, if there only Bitmap or Metafiles marked
1379 : // Menuoption: Format->Area, Format->Line
1380 : // disabled, if the marked objects not able to handle
1381 : // these attributes
1382 :
1383 :
1384 0 : bool bSingleGraphicSelected = false;
1385 :
1386 0 : if (!mpDrawView->AreObjectsMarked())
1387 : {
1388 0 : rSet.DisableItem (SID_CONVERT_TO_METAFILE);
1389 0 : rSet.DisableItem (SID_CONVERT_TO_BITMAP);
1390 : }
1391 : else
1392 : {
1393 : // get marklist
1394 0 : SdrMarkList aMarkList = mpDrawView->GetMarkedObjectList();
1395 :
1396 0 : sal_Bool bFoundBitmap = sal_False;
1397 0 : sal_Bool bFoundMetafile = sal_False;
1398 0 : sal_Bool bFoundObjNoLine = sal_False;
1399 0 : sal_Bool bFoundObjNoArea = sal_False;
1400 0 : sal_Bool bFoundNoGraphicObj = sal_False;
1401 0 : sal_Bool bFoundAny = sal_False;
1402 0 : bool bFoundTable = false;
1403 :
1404 : // const int nMarkCount = (int) aMarkList.GetMarkCount();
1405 0 : for (sal_uLong i=0; i < nMarkCount && !bFoundAny; i++)
1406 : {
1407 0 : SdrObject* pObj= aMarkList.GetMark(i)->GetMarkedSdrObj();
1408 0 : sal_uInt16 nId = pObj->GetObjIdentifier();
1409 0 : sal_uInt32 nInv = pObj->GetObjInventor();
1410 :
1411 0 : if(nInv == SdrInventor)
1412 : {
1413 : // 2D objects
1414 0 : switch( nId )
1415 : {
1416 : case OBJ_PATHLINE :
1417 : case OBJ_PLIN :
1418 : case OBJ_LINE:
1419 : case OBJ_FREELINE :
1420 : case OBJ_EDGE:
1421 : case OBJ_CARC :
1422 0 : bFoundObjNoArea = sal_True;
1423 0 : bFoundNoGraphicObj = sal_True;
1424 0 : break;
1425 : case OBJ_OLE2 :
1426 : // #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
1427 0 : bSingleGraphicSelected = nMarkCount == 1;
1428 0 : bFoundBitmap = true;
1429 0 : bFoundMetafile = true;
1430 0 : break;
1431 : case OBJ_GRAF :
1432 : {
1433 0 : bSingleGraphicSelected = nMarkCount == 1;
1434 0 : const SdrGrafObj* pSdrGrafObj = static_cast< const SdrGrafObj* >(pObj);
1435 0 : switch(pSdrGrafObj->GetGraphicType())
1436 : {
1437 : case GRAPHIC_BITMAP :
1438 0 : bFoundBitmap = sal_True;
1439 0 : if(pSdrGrafObj->isEmbeddedSvg())
1440 : {
1441 0 : bFoundMetafile = true;
1442 : }
1443 0 : break;
1444 : case GRAPHIC_GDIMETAFILE :
1445 0 : bFoundMetafile = sal_True;
1446 0 : break;
1447 : default:
1448 0 : break;
1449 : }
1450 0 : break;
1451 : }
1452 : case OBJ_TABLE:
1453 0 : bFoundTable = true;
1454 0 : break;
1455 : default :
1456 0 : bFoundAny = sal_True;
1457 : }
1458 : }
1459 0 : else if(nInv == E3dInventor)
1460 : {
1461 : // 3D objects
1462 0 : bFoundAny = sal_True;
1463 : }
1464 : }
1465 :
1466 0 : if( bFoundTable )
1467 0 : rSet.DisableItem( SID_ATTRIBUTES_LINE );
1468 :
1469 0 : if (!bFoundAny)
1470 : {
1471 : // Disable menuitem for area-dialog
1472 0 : if( bFoundObjNoArea ) // #i25616#
1473 0 : rSet.DisableItem( SID_ATTRIBUTES_AREA );
1474 :
1475 : // Disable menuitem for line-dialog
1476 0 : if( bFoundObjNoLine )
1477 0 : rSet.DisableItem( SID_ATTRIBUTES_LINE );
1478 :
1479 0 : if( bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj ) // only Bitmaps marked
1480 0 : rSet.DisableItem( SID_CONVERT_TO_BITMAP );
1481 0 : else if( !bFoundBitmap && bFoundMetafile && !bFoundNoGraphicObj ) // only Metafiles marked
1482 0 : rSet.DisableItem( SID_CONVERT_TO_METAFILE );
1483 0 : else if( !bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj ) // nothing to do
1484 : {
1485 0 : rSet.DisableItem( SID_CONVERT_TO_BITMAP );
1486 0 : rSet.DisableItem( SID_CONVERT_TO_METAFILE );
1487 : }
1488 0 : }
1489 : }
1490 :
1491 0 : if( !bSingleGraphicSelected )
1492 : {
1493 0 : rSet.DisableItem (SID_OBJECT_CROP);
1494 0 : rSet.DisableItem (SID_ATTR_GRAF_CROP);
1495 : }
1496 :
1497 :
1498 : // Menuoption: Edit->Hyperlink
1499 : // Disable, if there is no hyperlink
1500 :
1501 0 : sal_Bool bDisableEditHyperlink = sal_True;
1502 0 : if( mpDrawView->AreObjectsMarked() && ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) )
1503 : {
1504 0 : if( mpDrawView->IsTextEdit() )
1505 : {
1506 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1507 0 : if (pOLV)
1508 : {
1509 0 : const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1510 0 : if (pFieldItem)
1511 : {
1512 0 : ESelection aSel = pOLV->GetSelection();
1513 0 : if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
1514 : {
1515 0 : const SvxFieldData* pField = pFieldItem->GetField();
1516 0 : if ( pField->ISA(SvxURLField) )
1517 0 : bDisableEditHyperlink = sal_False;
1518 : }
1519 : }
1520 : }
1521 : }
1522 : else
1523 : {
1524 0 : SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
1525 :
1526 0 : if ( pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor() )
1527 : {
1528 0 : uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel() );
1529 0 : if( xControlModel.is() )
1530 : {
1531 0 : uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
1532 0 : if( xPropSet.is() )
1533 : {
1534 0 : uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo() );
1535 0 : if( xPropInfo.is() && xPropInfo->hasPropertyByName( "TargetURL") )
1536 : {
1537 0 : bDisableEditHyperlink = sal_False;
1538 0 : }
1539 0 : }
1540 0 : }
1541 : }
1542 : }
1543 : }
1544 :
1545 : //highlight selected custom shape
1546 : {
1547 0 : sal_uInt16 nCurrentSId = 0;
1548 0 : if(HasCurrentFunction())
1549 0 : nCurrentSId = GetCurrentFunction()->GetSlotID();
1550 :
1551 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_BASIC ) )
1552 0 : rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_BASIC, SID_DRAWTBX_CS_BASIC == nCurrentSId ));
1553 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_SYMBOL ) )
1554 0 : rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_SYMBOL, SID_DRAWTBX_CS_SYMBOL == nCurrentSId ));
1555 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_ARROW ) )
1556 0 : rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_ARROW, SID_DRAWTBX_CS_ARROW == nCurrentSId ));
1557 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_FLOWCHART ) )
1558 0 : rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_FLOWCHART, SID_DRAWTBX_CS_FLOWCHART == nCurrentSId ));
1559 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_CALLOUT ) )
1560 0 : rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_CALLOUT,SID_DRAWTBX_CS_CALLOUT == nCurrentSId ));
1561 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DRAWTBX_CS_STAR ) )
1562 0 : rSet.Put(SfxBoolItem(SID_DRAWTBX_CS_STAR, SID_DRAWTBX_CS_STAR == nCurrentSId ));
1563 : }
1564 :
1565 0 : if ( bDisableEditHyperlink || GetDocSh()->IsReadOnly() )
1566 0 : rSet.DisableItem( SID_EDIT_HYPERLINK );
1567 :
1568 0 : if ( bDisableEditHyperlink )
1569 0 : rSet.DisableItem( SID_OPEN_HYPERLINK );
1570 :
1571 : #if defined WNT || defined UNX
1572 0 : if( !mxScannerManager.is() )
1573 : {
1574 0 : rSet.DisableItem( SID_TWAIN_SELECT );
1575 0 : rSet.DisableItem( SID_TWAIN_TRANSFER );
1576 : }
1577 : #endif
1578 :
1579 : // Set the state of two entries in the 'Slide' context sub-menu
1580 : // concerning the visibility of master page background and master page
1581 : // shapes.
1582 0 : if (rSet.GetItemState(SID_DISPLAY_MASTER_BACKGROUND) == SFX_ITEM_AVAILABLE
1583 0 : || rSet.GetItemState(SID_DISPLAY_MASTER_OBJECTS) == SFX_ITEM_AVAILABLE)
1584 : {
1585 0 : SdPage* pPage = GetActualPage();
1586 0 : if (pPage != NULL
1587 0 : && GetDoc() != NULL)
1588 : {
1589 0 : SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1590 0 : SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
1591 0 : sal_uInt8 aBackgroundId = rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRND), false);
1592 0 : sal_uInt8 aObjectId = rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRNDOBJ), false);
1593 : rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_BACKGROUND,
1594 0 : aVisibleLayers.IsSet(aBackgroundId)));
1595 : rSet.Put(SfxBoolItem(SID_DISPLAY_MASTER_OBJECTS,
1596 0 : aVisibleLayers.IsSet(aObjectId)));
1597 : }
1598 : }
1599 :
1600 0 : GetModeSwitchingMenuState (rSet);
1601 : }
1602 :
1603 0 : void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet)
1604 : {
1605 : //draview
1606 0 : rSet.Put(SfxBoolItem(SID_DIAMODE, false));
1607 0 : rSet.Put(SfxBoolItem(SID_OUTLINEMODE, false));
1608 0 : if (mePageKind == PK_NOTES)
1609 : {
1610 0 : rSet.Put(SfxBoolItem(SID_DRAWINGMODE, false));
1611 0 : rSet.Put(SfxBoolItem(SID_NOTESMODE, true));
1612 0 : rSet.Put(SfxBoolItem(SID_HANDOUTMODE, false));
1613 : }
1614 0 : else if (mePageKind == PK_HANDOUT)
1615 : {
1616 0 : rSet.Put(SfxBoolItem(SID_DRAWINGMODE, false));
1617 0 : rSet.Put(SfxBoolItem(SID_NOTESMODE, false));
1618 0 : rSet.Put(SfxBoolItem(SID_HANDOUTMODE, true));
1619 : }
1620 : else
1621 : {
1622 0 : rSet.Put(SfxBoolItem(SID_DRAWINGMODE, true));
1623 0 : rSet.Put(SfxBoolItem(SID_NOTESMODE, false));
1624 0 : rSet.Put(SfxBoolItem(SID_HANDOUTMODE, false));
1625 : }
1626 :
1627 : // Removed [GetDocSh()->GetCurrentFunction() ||] from the following
1628 : // clause because the current function of the docshell can only be
1629 : // search and replace or spell checking and in that case switching the
1630 : // view mode is allowed.
1631 0 : const bool bIsRunning = SlideShow::IsRunning(GetViewShellBase());
1632 :
1633 0 : if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning)
1634 : {
1635 0 : if ( !GetViewFrame()->GetFrame().IsInPlace() )
1636 : {
1637 0 : rSet.ClearItem( SID_DRAWINGMODE );
1638 0 : rSet.DisableItem( SID_DRAWINGMODE );
1639 : }
1640 :
1641 0 : rSet.ClearItem( SID_NOTESMODE );
1642 0 : rSet.DisableItem( SID_NOTESMODE );
1643 :
1644 0 : rSet.ClearItem( SID_HANDOUTMODE );
1645 0 : rSet.DisableItem( SID_HANDOUTMODE );
1646 :
1647 0 : rSet.ClearItem( SID_OUTLINEMODE );
1648 0 : rSet.DisableItem( SID_OUTLINEMODE );
1649 :
1650 0 : rSet.ClearItem( SID_DIAMODE );
1651 0 : rSet.DisableItem( SID_DIAMODE );
1652 : }
1653 :
1654 0 : if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)
1655 : {
1656 : // Outplace-Edit: do not allow switch
1657 0 : rSet.ClearItem( SID_OUTLINEMODE );
1658 0 : rSet.DisableItem( SID_OUTLINEMODE );
1659 :
1660 0 : rSet.ClearItem( SID_DIAMODE );
1661 0 : rSet.DisableItem( SID_DIAMODE );
1662 :
1663 0 : rSet.ClearItem( SID_NOTESMODE );
1664 0 : rSet.DisableItem( SID_NOTESMODE );
1665 :
1666 0 : rSet.ClearItem( SID_HANDOUTMODE );
1667 0 : rSet.DisableItem( SID_HANDOUTMODE );
1668 : }
1669 :
1670 0 : svx::ExtrusionBar::getState( mpDrawView, rSet );
1671 0 : svx::FontworkBar::getState( mpDrawView, rSet );
1672 0 : }
1673 :
1674 :
1675 :
1676 0 : void DrawViewShell::GetState (SfxItemSet& rSet)
1677 : {
1678 : // Iterate over all requested items in the set.
1679 0 : SfxWhichIter aIter( rSet );
1680 0 : sal_uInt16 nWhich = aIter.FirstWhich();
1681 0 : while (nWhich)
1682 : {
1683 0 : switch (nWhich)
1684 : {
1685 : case SID_SEARCH_ITEM:
1686 : case SID_SEARCH_OPTIONS:
1687 : // Forward this request to the common (old) code of the
1688 : // document shell.
1689 0 : GetDocSh()->GetState (rSet);
1690 0 : break;
1691 : default:
1692 : OSL_TRACE ("DrawViewShell::GetState(): can not handle which id %d", nWhich);
1693 0 : break;
1694 : }
1695 0 : nWhich = aIter.NextWhich();
1696 0 : }
1697 0 : }
1698 :
1699 :
1700 :
1701 :
1702 0 : void DrawViewShell::Execute (SfxRequest& rReq)
1703 : {
1704 0 : if(SlideShow::IsRunning(GetViewShellBase()))
1705 : {
1706 : // Do not execute anything during a native slide show.
1707 0 : return;
1708 : }
1709 :
1710 0 : switch (rReq.GetSlot())
1711 : {
1712 : case SID_SEARCH_ITEM:
1713 : // Forward this request to the common (old) code of the
1714 : // document shell.
1715 0 : GetDocSh()->Execute (rReq);
1716 0 : break;
1717 :
1718 : case SID_SPELL_DIALOG:
1719 : {
1720 0 : SfxViewFrame* pViewFrame = GetViewFrame();
1721 0 : if (rReq.GetArgs() != NULL)
1722 : pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
1723 0 : ((const SfxBoolItem&) (rReq.GetArgs()->
1724 0 : Get(SID_SPELL_DIALOG))).GetValue());
1725 : else
1726 0 : pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
1727 :
1728 0 : pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
1729 0 : rReq.Ignore ();
1730 : }
1731 0 : break;
1732 :
1733 : default:
1734 : OSL_TRACE ("DrawViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
1735 0 : break;
1736 : }
1737 : }
1738 :
1739 : } // end of namespace sd
1740 :
1741 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|