Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <hintids.hxx>
31 : : #include <com/sun/star/linguistic2/XThesaurus.hpp>
32 : : #include <com/sun/star/uno/Sequence.hxx>
33 : : #include <svl/aeitem.hxx>
34 : : #include <svl/whiter.hxx>
35 : : #include <svl/cjkoptions.hxx>
36 : :
37 : : #include <sfx2/viewfrm.hxx>
38 : : #include <sfx2/objitem.hxx>
39 : : #include <svl/imageitm.hxx>
40 : : #include <svl/languageoptions.hxx>
41 : : #include <editeng/protitem.hxx>
42 : : #include <sfx2/linkmgr.hxx>
43 : : #include <editeng/langitem.hxx>
44 : : #include <editeng/brshitem.hxx>
45 : : #include <svx/htmlmode.hxx>
46 : : #include <editeng/unolingu.hxx>
47 : : #include <sfx2/msgpool.hxx>
48 : : #include <swmodule.hxx>
49 : : #include <tox.hxx>
50 : : #include <sfx2/dispatch.hxx>
51 : : #include <sfx2/app.hxx>
52 : : #include <view.hxx>
53 : : #include <wrtsh.hxx>
54 : : #include <basesh.hxx>
55 : : #include <uitool.hxx>
56 : : #include <viewopt.hxx>
57 : : #include <tablemgr.hxx>
58 : : #include <pagedesc.hxx>
59 : : #include <wview.hxx>
60 : : #include <globdoc.hxx>
61 : : #include <svl/stritem.hxx>
62 : : #include <unotools/moduleoptions.hxx>
63 : : #include <svl/visitem.hxx>
64 : :
65 : : #include <cmdid.h>
66 : :
67 : : #include <IDocumentRedlineAccess.hxx>
68 : :
69 : : using namespace ::com::sun::star;
70 : :
71 : 7405 : void SwView::GetState(SfxItemSet &rSet)
72 : : {
73 [ + - ]: 7405 : SfxWhichIter aIter(rSet);
74 [ + - ]: 7405 : sal_uInt16 nWhich = aIter.FirstWhich();
75 : 7405 : sal_uInt16 eFrmType = FRMTYPE_NONE;
76 : 7405 : int bGetFrmType = sal_False;
77 [ + - ][ + - ]: 7405 : sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
[ + - ][ + + ]
[ + - ]
78 : :
79 [ + + ]: 20954 : while(nWhich)
80 : : {
81 [ + - + - : 13549 : switch(nWhich)
+ - - - -
- - - - -
- - - - -
- - - + -
- - - + +
- + - - -
- - ]
82 : : {
83 : : case FN_EDIT_LINK_DLG:
84 [ + - ][ + - ]: 14 : if( pWrtShell->GetLinkManager().GetLinks().empty() )
85 [ + - ]: 14 : rSet.DisableItem(nWhich);
86 [ # # ][ # # ]: 0 : else if( pWrtShell->IsSelFrmMode() &&
[ # # ]
87 [ # # ]: 0 : pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
88 [ # # ]: 0 : rSet.DisableItem(nWhich);
89 : 14 : break;
90 : :
91 : : case FN_INSERT_CAPTION:
92 : : {
93 : : // Captions gibt's fuer Grafiken, OLE-Objekte, Rahmen und Tabellen
94 [ # # ]: 0 : if( !bGetFrmType )
95 [ # # ]: 0 : eFrmType = pWrtShell->GetFrmType(0,sal_True), bGetFrmType = sal_True;
96 [ # # ]: 0 : if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && nSelectionType != nsSelectionType::SEL_DRW_TXT)||
97 : : nSelectionType & nsSelectionType::SEL_TBL ||
98 [ # # ][ # # ]: 0 : nSelectionType & nsSelectionType::SEL_DRW) )
[ # # ]
99 [ # # ]: 0 : rSet.DisableItem(nWhich);
100 [ # # ][ # # ]: 0 : else if((pWrtShell->IsObjSelected()||pWrtShell->IsFrmSelected()) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
101 [ # # ]: 0 : (pWrtShell->IsSelObjProtected( FLYPROTECT_PARENT)||
102 [ # # ]: 0 : pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT )))
103 [ # # ]: 0 : rSet.DisableItem(nWhich);
104 [ # # ]: 0 : else if( pWrtShell->IsTableMode() )
105 [ # # ]: 0 : rSet.DisableItem(nWhich);
106 : : }
107 : 0 : break;
108 : :
109 : : case FN_EDIT_FOOTNOTE:
110 : : {
111 [ + - ][ + - ]: 14 : if( !pWrtShell->GetCurFtn() )
112 [ + - ]: 14 : rSet.DisableItem(nWhich);
113 : : }
114 : 14 : break;
115 : :
116 : : case FN_CHANGE_PAGENUM:
117 : : {
118 [ # # ]: 0 : sal_uInt16 nType = pWrtShell->GetFrmType(0,sal_True);
119 [ # # ]: 0 : if( ( FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER |
120 : : FRMTYPE_FOOTNOTE | FRMTYPE_DRAWOBJ ) & nType )
121 [ # # ]: 0 : rSet.DisableItem(nWhich);
122 : : else
123 [ # # ][ # # ]: 0 : rSet.Put(SfxUInt16Item(nWhich, pWrtShell->GetPageOffset()));
[ # # ][ # # ]
124 : : }
125 : 0 : break;
126 : : case SID_PRINTDOC:
127 : : case SID_PRINTDOCDIRECT:
128 [ + - ][ + - ]: 2799 : GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
129 : 2799 : break;
130 : : case SID_ATTR_PAGE:
131 : : case SID_ATTR_PAGE_SIZE:
132 : : case SID_ATTR_PAGE_PAPERBIN:
133 : : case RES_PAPER_BIN:
134 : : case FN_PARAM_FTN_INFO:
135 : : {
136 [ # # ]: 0 : const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
137 [ # # ]: 0 : const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx );
138 [ # # ]: 0 : ::PageDescToItemSet( rDesc, rSet);
139 : : }
140 : 0 : break;
141 : : case RES_BACKGROUND:
142 : : case SID_ATTR_BRUSH:
143 : : {
144 [ # # ]: 0 : const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
145 [ # # ]: 0 : const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx );
146 : 0 : const SwFrmFmt& rMaster = rDesc.GetMaster();
147 : : const SvxBrushItem& rBrush = (const SvxBrushItem&)
148 [ # # ]: 0 : rMaster.GetFmtAttr(RES_BACKGROUND, sal_True);
149 [ # # ]: 0 : rSet.Put(rBrush);
150 : : }
151 : 0 : break;
152 : : case SID_CLEARHISTORY:
153 : : {
154 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, pWrtShell->GetLastUndoInfo(0, 0)));
[ # # ][ # # ]
155 : : }
156 : 0 : break;
157 : : case SID_UNDO:
158 : : {
159 : : // die muss noch nicht vorhanden sein
160 : : // also lasse sie mal anlegen:
161 [ # # ]: 0 : if( !pShell )
162 [ # # ]: 0 : SelectShell();
163 : :
164 [ # # ]: 0 : const SfxPoolItem* pState = pShell->GetSlotState(SID_UNDO);
165 [ # # ]: 0 : if(pState)
166 [ # # ]: 0 : rSet.Put(*pState);
167 : : else
168 [ # # ]: 0 : rSet.DisableItem(nWhich);
169 : : }
170 : 0 : break;
171 : : case FN_INSERT_CTRL:
172 : : {
173 [ # # ][ # # ]: 0 : SfxImageItem aImgItem(nWhich, bWeb ? SwView::nWebInsertCtrlState : SwView::nInsertCtrlState);
174 [ # # ]: 0 : SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
175 [ # # ]: 0 : const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
176 [ # # ][ # # ]: 0 : if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
[ # # ]
177 : : {
178 [ # # ][ # # ]: 0 : if(pWrtShell->IsInVerticalText())
179 [ # # ]: 0 : aImgItem.SetRotation(2700);
180 [ # # ][ # # ]: 0 : if(pWrtShell->IsInRightToLeftText())
181 [ # # ]: 0 : aImgItem.SetMirrored(sal_True);
182 : : }
183 [ # # ][ # # ]: 0 : rSet.Put(aImgItem);
184 : : }
185 : 0 : break;
186 : : case FN_INSERT_OBJ_CTRL:
187 [ # # ]: 0 : if(bWeb)
188 [ # # ]: 0 : rSet.DisableItem(nWhich);
189 : : else
190 : : {
191 [ # # ]: 0 : SfxImageItem aImgItem(nWhich, SwView::nInsertObjectCtrlState);
192 [ # # ]: 0 : SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
193 [ # # ]: 0 : const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
194 [ # # ][ # # ]: 0 : if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
[ # # ]
195 : : {
196 [ # # ][ # # ]: 0 : if(pWrtShell->IsInVerticalText())
197 [ # # ]: 0 : aImgItem.SetRotation(2700);
198 [ # # ][ # # ]: 0 : if(pWrtShell->IsInRightToLeftText())
199 [ # # ]: 0 : aImgItem.SetMirrored(sal_True);
200 : : }
201 [ # # ][ # # ]: 0 : rSet.Put(aImgItem);
202 : : }
203 : 0 : break;
204 : : case FN_UPDATE_TOX:
205 [ # # ][ # # ]: 0 : if(!pWrtShell->GetTOXCount())
206 [ # # ]: 0 : rSet.DisableItem(nWhich);
207 : 0 : break;
208 : : case FN_EDIT_CURRENT_TOX:
209 : : case FN_UPDATE_CUR_TOX:
210 : : {
211 : 0 : const SwTOXBase* pBase = 0;
212 [ # # ][ # # ]: 0 : if(0 == (pBase = pWrtShell->GetCurTOX()) ||
[ # # ][ # # ]
[ # # ]
213 [ # # ]: 0 : (FN_EDIT_CURRENT_TOX == nWhich && pBase->IsTOXBaseInReadonly()))
214 [ # # ]: 0 : rSet.DisableItem(nWhich);
215 : : }
216 : 0 : break;
217 : : case SID_TWAIN_SELECT:
218 : : case SID_TWAIN_TRANSFER:
219 : : #if defined WNT || defined UNX
220 : : {
221 [ # # ][ # # ]: 0 : if(!SW_MOD()->GetScannerManager().is())
[ # # ]
222 [ # # ]: 0 : rSet.DisableItem(nWhich);
223 : : }
224 : : #endif
225 : 0 : break;
226 : : case RES_PARATR_TABSTOP:
227 : : case SID_ATTR_DEFTABSTOP:
228 : : {
229 : : const SvxTabStopItem& rDefTabs =
230 : : (const SvxTabStopItem&)pWrtShell->
231 [ # # ]: 0 : GetDefault(RES_PARATR_TABSTOP);
232 : : rSet.Put( SfxUInt16Item( nWhich,
233 [ # # ][ # # ]: 0 : (sal_uInt16)::GetTabDist(rDefTabs)));
[ # # ][ # # ]
234 : : }
235 : 0 : break;
236 : : case SID_ATTR_LANGUAGE:
237 : : {
238 : : rSet.Put((const SvxLanguageItem&)
239 [ # # ][ # # ]: 0 : pWrtShell->GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
240 : : }
241 : 0 : break;
242 : : case RES_CHRATR_CJK_LANGUAGE:
243 : : rSet.Put((const SvxLanguageItem&)
244 [ # # ][ # # ]: 0 : pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE), RES_CHRATR_CJK_LANGUAGE);
245 : 0 : break;
246 : : case RES_CHRATR_CTL_LANGUAGE:
247 : : rSet.Put((const SvxLanguageItem&)
248 [ # # ][ # # ]: 0 : pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE), RES_CHRATR_CTL_LANGUAGE);
249 : 0 : break;
250 : : case FN_HYPHENATE_OPT_DLG:
251 : : {
252 : 0 : sal_Bool bCheck = sal_False;
253 : :
254 [ # # ][ # # ]: 0 : if (pWrtShell->GetSelectionType() & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_DRW))
255 [ # # ]: 0 : bCheck = IsDrawTextHyphenate();
256 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bCheck));
[ # # ]
257 : : }
258 : 0 : break;
259 : : case FN_REDLINE_ON:
260 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) );
[ # # ][ # # ]
[ # # ]
261 : 0 : break;
262 : : case FN_REDLINE_PROTECT :
263 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, GetDocShell()->HasChangeRecordProtection() ) );
[ # # ][ # # ]
[ # # ]
264 : 0 : break;
265 : : case FN_REDLINE_SHOW:
266 : : {
267 : 0 : sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
268 : : rSet.Put( SfxBoolItem( nWhich,
269 [ # # ][ # # ]: 0 : (pWrtShell->GetRedlineMode() & nMask) == nMask ));
[ # # ][ # # ]
270 : : }
271 : 0 : break;
272 : : case SID_GALLERY :
273 : : case SID_AVMEDIA_PLAYER :
274 : : case FN_REDLINE_ACCEPT :
275 : : {
276 : 2789 : SfxViewFrame* pVFrame = GetViewFrame();
277 [ + - ][ + - ]: 2789 : if (pVFrame->KnowsChildWindow(nWhich))
278 [ + - ][ + - ]: 2789 : rSet.Put(SfxBoolItem( nWhich, pVFrame->HasChildWindow(nWhich)));
[ + - ][ + - ]
279 : : else
280 [ # # ]: 0 : rSet.DisableItem(nWhich);
281 : : }
282 : 2789 : break;
283 : : case FN_REDLINE_ACCEPT_DIRECT:
284 : : case FN_REDLINE_REJECT_DIRECT:
285 : : {
286 [ # # ]: 0 : SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
287 : 0 : Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True );
288 [ # # ][ # # ]: 0 : if( !pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) )
289 [ # # ][ # # ]: 0 : rSet.DisableItem( nWhich );
290 : : }
291 : 0 : break;
292 : : case SID_THESAURUS:
293 : : {
294 : 0 : SwWrtShell &rSh = GetWrtShell();
295 [ # # ][ # # ]: 0 : if (2 <= rSh.GetCrsrCnt()) // multi selection?
296 [ # # ]: 0 : rSet.DisableItem(nWhich);
297 : : else
298 : : {
299 [ # # ]: 0 : LanguageType nLang = rSh.GetCurLang();
300 : :
301 : : // disable "Thesaurus" (menu entry and key shortcut) if the
302 : : // language is not supported (by default it is enabled)
303 [ # # ]: 0 : uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
304 [ # # ][ # # ]: 0 : if (!xThes.is() || nLang == LANGUAGE_NONE ||
[ # # ][ # # ]
305 [ # # ][ # # ]: 0 : !xThes->hasLocale( SvxCreateLocale( nLang ) ))
[ # # ][ # # ]
[ # # ]
306 [ # # ]: 0 : rSet.DisableItem(nWhich);
307 : : }
308 : : }
309 : 0 : break;
310 : : case SID_HANGUL_HANJA_CONVERSION:
311 : : case SID_CHINESE_CONVERSION:
312 : : {
313 [ # # ][ # # ]: 0 : if (!SvtCJKOptions().IsAnyEnabled())
[ # # ][ # # ]
314 : : {
315 [ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
316 [ # # ]: 0 : rSet.DisableItem(nWhich);
317 : : }
318 : : else
319 [ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
320 : : }
321 : 0 : break;
322 : : case SID_MAIL_SCROLLBODY_PAGEDOWN:
323 : : {
324 [ # # ]: 0 : const long nBottom = pWrtShell->GetDocSize().Height() + DOCUMENTBORDER;
325 : 0 : const long nAct = GetVisArea().Bottom();
326 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_MAIL_SCROLLBODY_PAGEDOWN, nAct < nBottom ));
[ # # ]
327 : : }
328 : 0 : break;
329 : :
330 : : case SID_DOCUMENT_COMPARE:
331 : : case SID_DOCUMENT_MERGE:
332 [ + - ][ + - ]: 14 : if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) ||
[ + - ][ + - ]
[ - + # # ]
[ - + ]
333 [ # # ][ # # ]: 0 : (SID_DOCUMENT_MERGE == nWhich && pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength()))
334 [ # # ]: 0 : rSet.DisableItem(nWhich);
335 : 14 : break;
336 : : case SID_VIEW_DATA_SOURCE_BROWSER:
337 [ + - ][ + - ]: 2805 : if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
[ + - ][ - + ]
338 [ # # ][ # # ]: 0 : rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
[ # # ]
339 : : else
340 [ + - ][ + - ]: 2805 : rSet.Put( SfxBoolItem( nWhich, GetViewFrame()->HasChildWindow( SID_BROWSER ) ) );
[ + - ][ + - ]
341 : 2805 : break;
342 : : case SID_READONLY_MODE:
343 : : rSet.Put(SfxBoolItem(nWhich,
344 [ # # ][ # # ]: 0 : pWrtShell->HasReadonlySel()||GetDocShell()->IsReadOnly()));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
345 : 0 : break;
346 : : case SID_IMAGE_ORIENTATION:
347 : : {
348 [ + - ]: 5114 : SfxImageItem aImageItem(nWhich);
349 [ + - ][ - + ]: 5114 : if(pWrtShell->IsInVerticalText())
350 [ # # ]: 0 : aImageItem.SetRotation( 2700 );
351 [ + - ][ - + ]: 5114 : if(pWrtShell->IsInRightToLeftText())
352 [ # # ]: 0 : aImageItem.SetMirrored( sal_True );
353 [ + - ][ + - ]: 5114 : rSet.Put(aImageItem);
354 : : }
355 : 5114 : break;
356 : : case FN_INSERT_FIELD_DATA_ONLY :
357 [ # # ][ # # ]: 0 : if(!bInMailMerge && !GetViewFrame()->HasChildWindow(nWhich))
[ # # ][ # # ]
358 [ # # ]: 0 : rSet.DisableItem(nWhich);
359 : 0 : break;
360 : : case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
361 : 0 : break;
362 : : case FN_MAILMERGE_CHILDWINDOW:
363 : : {
364 [ # # ][ # # ]: 0 : if(!GetMailMergeConfigItem())
365 [ # # ]: 0 : rSet.DisableItem(nWhich);
366 : : }
367 : 0 : break;
368 : : case SID_ALIGN_ANY_LEFT :
369 : : case SID_ALIGN_ANY_HCENTER :
370 : : case SID_ALIGN_ANY_RIGHT :
371 : : case SID_ALIGN_ANY_JUSTIFIED:
372 : : case SID_ALIGN_ANY_TOP :
373 : : case SID_ALIGN_ANY_VCENTER :
374 : : case SID_ALIGN_ANY_BOTTOM :
375 : : case SID_ALIGN_ANY_HDEFAULT :
376 : : case SID_ALIGN_ANY_VDEFAULT :
377 : : {
378 [ # # ]: 0 : if( !pShell )
379 [ # # ]: 0 : SelectShell();
380 : 0 : sal_uInt16 nAlias = 0;
381 : 0 : bool bDraw = false;
382 [ # # ]: 0 : if( nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) )
383 : : {
384 [ # # # # : 0 : switch( nWhich )
# # # # ]
385 : : {
386 : 0 : case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
387 : 0 : case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
388 : 0 : case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
389 : 0 : case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
390 : 0 : case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break;
391 : 0 : case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break;
392 : 0 : case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break;
393 : : }
394 : : }
395 [ # # ]: 0 : else if(nSelectionType & (nsSelectionType::SEL_DRW))
396 : : {
397 : : //the draw shell cannot provide a status per item - only one for SID_OBJECT_ALIGN
398 [ # # ]: 0 : if(nWhich != SID_ALIGN_ANY_JUSTIFIED)
399 : : {
400 : 0 : const SfxPoolItem* pItem = 0;
401 [ # # ]: 0 : GetViewFrame()->GetDispatcher()->QueryState( SID_OBJECT_ALIGN, pItem );
402 [ # # ]: 0 : if(pItem)
403 : 0 : bDraw = true;
404 : : }
405 : : }
406 : : else
407 : : {
408 [ # # # # : 0 : switch( nWhich )
# # # ]
409 : : {
410 : 0 : case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break;
411 : 0 : case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break;
412 : 0 : case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break;
413 : 0 : case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break;
414 : 0 : case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break;
415 : 0 : case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break;
416 : : }
417 : : }
418 : : //these slots are either re-mapped to text or object alignment
419 : 0 : const SfxPoolItem* pState = 0;
420 [ # # ]: 0 : if(nAlias)
421 [ # # ]: 0 : GetViewFrame()->GetDispatcher()->QueryState( nAlias, pState );
422 [ # # ]: 0 : if(pState)
423 [ # # ]: 0 : rSet.Put(*pState, nWhich);
424 [ # # ]: 0 : else if(!bDraw)
425 [ # # ]: 0 : rSet.DisableItem(nWhich);
426 : : }
427 : 0 : break;
428 : : }
429 [ + - ]: 13549 : nWhich = aIter.NextWhich();
430 [ + - ]: 7405 : }
431 : 7405 : }
432 : :
433 : 1237 : void SwView::GetDrawState(SfxItemSet &rSet)
434 : : {
435 [ + - ]: 1237 : SfxWhichIter aIter(rSet);
436 [ + - ][ + - ]: 1237 : sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
[ + - ][ - + ]
[ # # ]
437 : :
438 [ + - ][ + - ]: 2474 : for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich;
[ + + ]
439 : : nWhich = aIter.NextWhich() )
440 [ + - - - : 1237 : switch(nWhich)
- - - ]
441 : : {
442 : : case SID_INSERT_DRAW:
443 [ - + ]: 1237 : if ( bWeb )
444 [ # # ]: 0 : rSet.DisableItem( nWhich );
445 : : else
446 : : {
447 [ + - ]: 1237 : SfxAllEnumItem aEnum(SID_INSERT_DRAW, nDrawSfxId);
448 [ + - ][ + - ]: 1237 : if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
[ + - ][ + - ]
449 : : {
450 [ + - ]: 1237 : aEnum.DisableValue( SID_DRAW_CAPTION_VERTICAL );
451 [ + - ]: 1237 : aEnum.DisableValue( SID_DRAW_TEXT_VERTICAL );
452 : : }
453 [ + - ][ + - ]: 1237 : rSet.Put(aEnum);
454 : : }
455 : 1237 : break;
456 : :
457 : : case SID_SHOW_HIDDEN:
458 : : case SID_SHOW_FORMS:
459 [ # # ]: 0 : rSet.DisableItem( nWhich );
460 : 0 : break;
461 : :
462 : : case SID_DRAW_TEXT_MARQUEE:
463 [ # # ][ # # ]: 0 : if (::GetHtmlMode(GetDocShell()) & HTMLMODE_SOME_STYLES)
[ # # ]
464 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem(nWhich, nDrawSfxId == nWhich));
[ # # ]
465 : : else
466 [ # # ]: 0 : rSet.DisableItem(nWhich);
467 : 0 : break;
468 : : case SID_OBJECT_SELECT:
469 : : rSet.Put( SfxBoolItem(nWhich, nDrawSfxId == nWhich ||
470 [ # # ][ # # ]: 0 : nFormSfxId == nWhich));
[ # # ][ # # ]
[ # # ]
471 : 0 : break;
472 : :
473 : : case SID_FONTWORK_GALLERY_FLOATER :
474 : : {
475 [ # # ]: 0 : if ( bWeb )
476 [ # # ]: 0 : rSet.DisableItem( nWhich );
477 : : }
478 : 0 : break;
479 : :
480 : : case SID_DRAWTBX_CS_BASIC :
481 : : case SID_DRAWTBX_CS_SYMBOL :
482 : : case SID_DRAWTBX_CS_ARROW :
483 : : case SID_DRAWTBX_CS_FLOWCHART :
484 : : case SID_DRAWTBX_CS_CALLOUT :
485 : : case SID_DRAWTBX_CS_STAR :
486 : : {
487 [ # # ]: 0 : if ( bWeb )
488 [ # # ]: 0 : rSet.DisableItem( nWhich );
489 : : else
490 [ # # ][ # # ]: 0 : rSet.Put(SfxStringItem(nWhich, aCurrShapeEnumCommand[ nWhich - SID_DRAWTBX_CS_BASIC ] ));
[ # # ]
491 : : }
492 : 0 : break;
493 : :
494 [ + - ]: 1237 : }
495 : 1237 : }
496 : :
497 : 7346 : sal_Bool SwView::HasUIFeature( sal_uInt32 nFeature )
498 : : {
499 : 7346 : sal_Bool bRet = sal_False;
500 [ + + - ]: 7346 : switch(nFeature)
501 : : {
502 : 3673 : case CHILDWIN_LABEL : bRet = pWrtShell->IsLabelDoc(); break;
503 : 3673 : case CHILDWIN_MAILMERGE : bRet = 0 != GetMailMergeConfigItem(); break;
504 : : }
505 : 7346 : return bRet;
506 : : }
507 : :
508 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|