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