Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / uiview / viewstat.cxx
blob9f44aa2149968a0741c9da79bec4f564820617c0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <memory>
22 #include <hintids.hxx>
23 #include <com/sun/star/linguistic2/XThesaurus.hpp>
24 #include <svl/whiter.hxx>
25 #include <svl/cjkoptions.hxx>
26 #include <sfx2/viewfrm.hxx>
27 #include <svl/imageitm.hxx>
28 #include <sfx2/linkmgr.hxx>
29 #include <editeng/langitem.hxx>
30 #include <editeng/brushitem.hxx>
31 #include <editeng/tstpitem.hxx>
32 #include <sfx2/htmlmode.hxx>
33 #include <swmodule.hxx>
34 #include <tox.hxx>
35 #include <sfx2/dispatch.hxx>
36 #include <view.hxx>
37 #include <wrtsh.hxx>
38 #include <uitool.hxx>
39 #include <viewopt.hxx>
40 #include <pagedesc.hxx>
41 #include <wview.hxx>
42 #include <globdoc.hxx>
43 #include <svl/stritem.hxx>
44 #include <unotools/moduleoptions.hxx>
45 #include <comphelper/lok.hxx>
46 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
47 #include <svl/visitem.hxx>
48 #include <redline.hxx>
49 #include <rootfrm.hxx>
50 #include <docary.hxx>
51 #include <sfx2/infobar.hxx>
52 #include <docsh.hxx>
53 #include <strings.hrc>
55 #include <cmdid.h>
56 #include <IDocumentRedlineAccess.hxx>
58 #include <doc.hxx>
59 #include <workctrl.hxx>
61 using namespace ::com::sun::star;
63 void SwView::GetState(SfxItemSet &rSet)
65 SfxWhichIter aIter(rSet);
66 sal_uInt16 nWhich = aIter.FirstWhich();
67 FrameTypeFlags eFrameType = FrameTypeFlags::NONE;
68 bool bGetFrameType = false;
69 bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr;
71 while(nWhich)
73 switch(nWhich)
75 case SID_ZOOM_IN:
76 case SID_ZOOM_OUT:
78 tools::Long nFact = m_pWrtShell->GetViewOptions()->GetZoom();
79 if ((SID_ZOOM_IN == nWhich && nFact >= tools::Long(600)) ||
80 (SID_ZOOM_OUT == nWhich && nFact <= tools::Long(20)))
82 rSet.DisableItem(nWhich);
85 break;
86 case FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY:
88 bool bDisable(true);
89 if (m_pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton())
91 SwOutlineNodes::size_type nPos = m_pWrtShell->GetOutlinePos();
92 if (nPos != SwOutlineNodes::npos)
93 bDisable = false;
95 if (bDisable)
96 rSet.DisableItem(nWhich);
98 break;
99 case FN_NAV_ELEMENT:
100 // used to update all instances of this control
101 rSet.InvalidateItem( nWhich );
102 break;
103 case FN_SCROLL_PREV:
104 case FN_SCROLL_NEXT:
106 if (s_nMoveType == NID_RECENCY)
108 if (!m_pWrtShell->GetNavigationMgr().forwardEnabled())
109 rSet.DisableItem(FN_SCROLL_NEXT);
110 if (!m_pWrtShell->GetNavigationMgr().backEnabled())
111 rSet.DisableItem(FN_SCROLL_PREV);
114 break;
115 case FN_EDIT_LINK_DLG:
116 if( m_pWrtShell->GetLinkManager().GetLinks().empty() )
117 rSet.DisableItem(nWhich);
118 else if( m_pWrtShell->IsSelFrameMode() &&
119 m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE)
121 rSet.DisableItem(nWhich);
123 break;
125 case SID_DRAWTBX_LINES:
126 if ( bWeb )
127 rSet.DisableItem(nWhich);
128 break;
130 case SID_INSERT_GRAPHIC:
131 if( m_pWrtShell->CursorInsideInputField() )
133 rSet.DisableItem(nWhich);
135 break;
136 case SID_INSERT_SIGNATURELINE:
137 if( !( m_nSelectionType & SelectionType::Text ||
138 m_nSelectionType & SelectionType::NumberList ) )
140 rSet.DisableItem(nWhich);
142 break;
143 case SID_EDIT_SIGNATURELINE:
144 case SID_SIGN_SIGNATURELINE:
145 if (!isSignatureLineSelected() || isSignatureLineSigned())
146 rSet.DisableItem(nWhich);
147 break;
148 case SID_INSERT_QRCODE:
149 if( !( m_nSelectionType & SelectionType::Text ||
150 m_nSelectionType & SelectionType::NumberList ) )
152 rSet.DisableItem(nWhich);
154 break;
155 case SID_EDIT_QRCODE:
156 if (!isQRCodeSelected())
157 rSet.DisableItem(nWhich);
158 break;
159 case FN_INSERT_CAPTION:
161 // There are captions for graphics, OLE objects, frames and tables
162 if( !bGetFrameType )
164 eFrameType = m_pWrtShell->GetFrameType(nullptr, true);
165 bGetFrameType = true;
167 if (! ( ((eFrameType & FrameTypeFlags::FLY_ANY) && m_nSelectionType != SelectionType::DrawObjectEditMode)||
168 m_nSelectionType & SelectionType::Table ||
169 m_nSelectionType & SelectionType::DrawObject) )
171 rSet.DisableItem(nWhich);
173 else if((m_pWrtShell->IsObjSelected() || m_pWrtShell->IsFrameSelected()) &&
174 (m_pWrtShell->IsSelObjProtected( FlyProtectFlags::Parent) != FlyProtectFlags::NONE ||
175 m_pWrtShell->IsSelObjProtected( FlyProtectFlags::Content ) != FlyProtectFlags::NONE))
177 rSet.DisableItem(nWhich);
179 else if( m_pWrtShell->IsTableMode()
180 || isSignatureLineSelected()
181 || m_pWrtShell->CursorInsideInputField() )
183 rSet.DisableItem(nWhich);
186 break;
188 case FN_EDIT_FOOTNOTE:
190 if( !m_pWrtShell->GetCurFootnote() )
191 rSet.DisableItem(nWhich);
193 break;
195 case FN_CHANGE_PAGENUM:
197 FrameTypeFlags nType = m_pWrtShell->GetFrameType(nullptr,true);
198 if( ( FrameTypeFlags::FLY_ANY | FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER |
199 FrameTypeFlags::FOOTNOTE | FrameTypeFlags::DRAWOBJ ) & nType )
200 rSet.DisableItem(nWhich);
201 else
202 rSet.Put(SfxUInt16Item(nWhich, m_pWrtShell->GetPageOffset()));
204 break;
205 case SID_PRINTDOC:
206 case SID_PRINTDOCDIRECT:
207 GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
208 break;
209 case SID_ATTR_PAGE_ORIENTATION:
210 case SID_ATTR_PAGE:
211 case SID_ATTR_PAGE_SIZE:
212 case SID_ATTR_PAGE_PAPERBIN:
213 case RES_PAPER_BIN:
214 case FN_PARAM_FTN_INFO:
216 const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
217 const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx );
219 // set correct parent to get the XFILL_NONE FillStyle as needed
220 if(!rSet.GetParent())
222 const SwFrameFormat& rMaster = rDesc.GetMaster();
224 rSet.SetParent(&rMaster.GetDoc()->GetDfltFrameFormat()->GetAttrSet());
227 ::PageDescToItemSet( rDesc, rSet);
229 if (nWhich == SID_ATTR_PAGE_ORIENTATION && comphelper::LibreOfficeKit::isActive())
231 OString aPayload = ".uno:Orientation=";
232 if (rDesc.GetLandscape())
234 aPayload += "IsLandscape";
236 else
238 aPayload += "IsPortrait";
240 libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload);
243 break;
244 case RES_BACKGROUND:
245 case SID_ATTR_BRUSH:
247 const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
248 const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx );
249 const SwFrameFormat& rMaster = rDesc.GetMaster();
250 const SvxBrushItem& rBrush = rMaster.GetFormatAttr(RES_BACKGROUND);
251 rSet.Put(rBrush);
253 break;
254 case SID_CLEARHISTORY:
256 rSet.Put(SfxBoolItem(nWhich, m_pWrtShell->GetLastUndoInfo(nullptr, nullptr)));
258 break;
259 case SID_UNDO:
261 // which must not be present, so let them create:
262 if( !m_pShell )
263 SelectShell();
265 const SfxPoolItem* pState = m_pShell->GetSlotState(SID_UNDO);
266 if(pState)
267 rSet.Put(*pState);
268 else
269 rSet.DisableItem(nWhich);
271 break;
272 case FN_INSERT_OBJ_CTRL:
273 if( bWeb
274 || m_pWrtShell->CursorInsideInputField() )
276 rSet.DisableItem(nWhich);
278 break;
280 case FN_UPDATE_TOX:
281 if(!m_pWrtShell->GetTOXCount())
282 rSet.DisableItem(nWhich);
283 break;
284 case FN_EDIT_CURRENT_TOX:
285 case FN_UPDATE_CUR_TOX:
287 const SwTOXBase* pBase = nullptr;
288 if(nullptr == (pBase = m_pWrtShell->GetCurTOX()) ||
289 (FN_EDIT_CURRENT_TOX == nWhich && pBase->IsTOXBaseInReadonly()))
290 rSet.DisableItem(nWhich);
292 break;
293 case SID_TWAIN_SELECT:
294 case SID_TWAIN_TRANSFER:
295 #if defined(_WIN32) || defined UNX
297 if(!SW_MOD()->GetScannerManager().is())
298 rSet.DisableItem(nWhich);
300 #endif
301 break;
302 case RES_PARATR_TABSTOP:
303 case SID_ATTR_DEFTABSTOP:
305 const SvxTabStopItem& rDefTabs = m_pWrtShell->GetDefault(RES_PARATR_TABSTOP);
306 rSet.Put( SfxUInt16Item( nWhich,
307 o3tl::narrowing<sal_uInt16>(::GetTabDist(rDefTabs))));
309 break;
310 case SID_ATTR_LANGUAGE:
312 rSet.Put(m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE));
314 break;
315 case RES_CHRATR_CJK_LANGUAGE:
317 rSet.Put(m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE)
318 .CloneSetWhich(RES_CHRATR_CJK_LANGUAGE));
320 break;
321 case RES_CHRATR_CTL_LANGUAGE:
323 rSet.Put(m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE)
324 .CloneSetWhich(RES_CHRATR_CTL_LANGUAGE));
326 break;
327 case FN_REDLINE_ON:
328 rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) );
329 // When the view is new (e.g. on load), show the Hidden Track Changes infobar
330 // if Show Changes is disabled, but recording of changes is enabled
331 // or hidden tracked changes are there already in the document.
332 // Note: the infobar won't be shown, if the Track Changes toolbar is already
333 // enabled, see in sfx2.
334 if ( m_bForceChangesToolbar && m_pWrtShell->GetLayout()->IsHideRedlines() )
336 bool isRecording = GetDocShell()->IsChangeRecording();
337 bool hasRecorded =
338 m_pWrtShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size();
339 if ( isRecording || hasRecorded )
341 GetDocShell()->AppendInfoBarWhenReady(
342 "hiddentrackchanges", SwResId(STR_HIDDEN_CHANGES),
343 SwResId( (isRecording && hasRecorded)
344 ? STR_HIDDEN_CHANGES_DETAIL
345 : isRecording
346 ? STR_HIDDEN_CHANGES_DETAIL2
347 : STR_HIDDEN_CHANGES_DETAIL3 ),
348 InfobarType::INFO);
351 m_bForceChangesToolbar = false;
352 break;
353 case FN_REDLINE_PROTECT :
354 rSet.Put( SfxBoolItem( nWhich, GetDocShell()->HasChangeRecordProtection() ) );
355 break;
356 case FN_REDLINE_SHOW:
358 rSet.Put(SfxBoolItem(nWhich, !m_pWrtShell->GetLayout()->IsHideRedlines()));
360 break;
361 case SID_AVMEDIA_PLAYER :
362 case FN_REDLINE_ACCEPT :
364 SfxViewFrame& rVFrame = GetViewFrame();
365 if (rVFrame.KnowsChildWindow(nWhich))
366 rSet.Put(SfxBoolItem( nWhich, rVFrame.HasChildWindow(nWhich)));
367 else
368 rSet.DisableItem(nWhich);
370 break;
371 case FN_REDLINE_ACCEPT_DIRECT:
372 case FN_REDLINE_REJECT_DIRECT:
373 case FN_REDLINE_ACCEPT_TONEXT:
374 case FN_REDLINE_REJECT_TONEXT:
376 SwDoc *pDoc = m_pWrtShell->GetDoc();
377 SwPaM *pCursor = m_pWrtShell->GetCursor();
378 bool bDisable = false;
379 if (GetDocShell()->HasChangeRecordProtection())
380 bDisable = true;
381 else if (pCursor->HasMark())
383 // If the selection does not contain redlines, disable accepting/rejecting changes.
384 SwRedlineTable::size_type index = 0;
385 const SwRedlineTable& table = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
386 const SwRangeRedline* redline = table.FindAtPosition( *pCursor->Start(), index );
387 if( redline != nullptr && *redline->Start() == *pCursor->End())
388 redline = nullptr;
389 if( redline == nullptr )
391 // for table selections, GetCursor() gives only PaM of the first cell,
392 // so extend the redline limit to end of last cell of the selection
393 // TODO: adjust this for column selections, where the selected columns
394 // don't contain any redlines and any tracked row changes, but the
395 // adjacent not selected columns do to avoid false Enable
396 std::optional<SwPosition> oSelectionEnd;
397 if ( m_pWrtShell->IsTableMode() &&
398 m_pWrtShell->GetTableCursor()->GetSelectedBoxesCount() )
400 const SwSelBoxes& rBoxes = m_pWrtShell->GetTableCursor()->GetSelectedBoxes();
401 const SwStartNode *pSttNd = rBoxes.back()->GetSttNd();
402 const SwNode* pEndNode = pSttNd->GetNodes()[pSttNd->EndOfSectionIndex()];
403 oSelectionEnd.emplace(*pEndNode);
405 else
406 oSelectionEnd.emplace(*pCursor->End());
408 for(; index < table.size(); ++index )
410 const SwRangeRedline* tmp = table[ index ];
411 if( *tmp->Start() >= *oSelectionEnd )
412 break;
413 if( tmp->HasMark() && tmp->IsVisible())
415 redline = tmp;
416 break;
420 if( redline == nullptr )
421 bDisable = true;
423 else
425 // If the cursor position isn't on a redline, disable
426 // accepting/rejecting changes.
427 SwTableBox* pTableBox;
428 if (nullptr == pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), nullptr) &&
429 // except in the case of an inserted or deleted table row
430 ( !m_pWrtShell->IsCursorInTable() ||
431 (pTableBox = pCursor->Start()->GetNode().GetTableBox() ) == nullptr ||
432 (RedlineType::None == pTableBox->GetRedlineType() &&
433 RedlineType::None == pTableBox->GetUpper()->GetRedlineType()) ) )
435 bDisable = true;
439 // LibreOfficeKit wants to handle changes by index, so always allow here.
440 if (bDisable)
441 rSet.DisableItem(nWhich);
442 if (comphelper::LibreOfficeKit::isActive())
444 OString aPayload(".uno:TrackedChangeIndex=");
445 SwRedlineTable::size_type nRedline = 0;
446 if (pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline))
447 aPayload += OString::number(nRedline);
448 libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload);
451 break;
453 case FN_REDLINE_NEXT_CHANGE:
454 case FN_REDLINE_PREV_CHANGE:
456 // Enable change navigation if we have any redlines. Ideally we should disable
457 // "Next Change" if we're at or past the last change, and similarly for
458 // "Previous Change"
459 if (0 == m_pWrtShell->GetRedlineCount())
460 rSet.DisableItem(nWhich);
462 break;
464 case SID_THESAURUS:
466 SwWrtShell &rSh = GetWrtShell();
467 if (2 <= rSh.GetCursorCnt()) // multi selection?
468 rSet.DisableItem(nWhich);
469 else
471 LanguageType nLang = rSh.GetCurLang();
473 // disable "Thesaurus" (menu entry and key shortcut) if the
474 // language is not supported (by default it is enabled)
475 uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
476 if (!xThes.is() || nLang == LANGUAGE_NONE ||
477 !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
478 rSet.DisableItem(nWhich);
481 break;
482 case SID_HANGUL_HANJA_CONVERSION:
483 case SID_CHINESE_CONVERSION:
485 if (!SvtCJKOptions::IsAnyEnabled())
487 GetViewFrame().GetBindings().SetVisibleState( nWhich, false );
488 rSet.DisableItem(nWhich);
490 else
491 GetViewFrame().GetBindings().SetVisibleState( nWhich, true );
493 break;
494 case SID_MAIL_SCROLLBODY_PAGEDOWN:
496 const tools::Long nBottom = m_pWrtShell->GetDocSize().Height() + DOCUMENTBORDER;
497 const tools::Long nAct = GetVisArea().Bottom();
498 rSet.Put(SfxBoolItem(SID_MAIL_SCROLLBODY_PAGEDOWN, nAct < nBottom ));
500 break;
502 case SID_DOCUMENT_COMPARE:
503 case SID_DOCUMENT_MERGE:
504 if( dynamic_cast<const SwGlobalDocShell* >(GetDocShell()) != nullptr||
505 (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements()))
506 rSet.DisableItem(nWhich);
507 break;
508 case SID_VIEW_DATA_SOURCE_BROWSER:
509 if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) )
510 rSet.Put( SfxVisibilityItem( nWhich, false ) );
511 else
512 rSet.Put( SfxBoolItem( nWhich, GetViewFrame().HasChildWindow( SID_BROWSER ) ) );
513 break;
514 case SID_READONLY_MODE:
515 rSet.Put(SfxBoolItem(nWhich,
516 m_pWrtShell->HasReadonlySel()||GetDocShell()->IsReadOnly()));
517 break;
518 case SID_IMAGE_ORIENTATION:
520 SfxImageItem aImageItem(nWhich);
521 if(m_pWrtShell->IsInVerticalText())
522 aImageItem.SetRotation( 2700_deg10 );
523 if(m_pWrtShell->IsInRightToLeftText())
524 aImageItem.SetMirrored( true );
525 rSet.Put(aImageItem);
527 break;
528 case FN_INSERT_FIELD_DATA_ONLY :
529 if(!m_bInMailMerge && !GetViewFrame().HasChildWindow(nWhich))
530 rSet.DisableItem(nWhich);
531 break;
532 case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
533 break;
534 case SID_ALIGN_ANY_LEFT :
535 case SID_ALIGN_ANY_HCENTER :
536 case SID_ALIGN_ANY_RIGHT :
537 case SID_ALIGN_ANY_JUSTIFIED:
538 case SID_ALIGN_ANY_TOP :
539 case SID_ALIGN_ANY_VCENTER :
540 case SID_ALIGN_ANY_BOTTOM :
541 case SID_ALIGN_ANY_HDEFAULT :
542 case SID_ALIGN_ANY_VDEFAULT :
544 if( !m_pShell )
545 SelectShell();
546 sal_uInt16 nAlias = 0;
547 if( m_nSelectionType & (SelectionType::DrawObjectEditMode|SelectionType::Text) )
549 switch( nWhich )
551 case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
552 case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
553 case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
554 case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
555 case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break;
556 case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break;
557 case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break;
560 else
562 switch( nWhich )
564 case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break;
565 case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break;
566 case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break;
567 case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break;
568 case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break;
569 case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break;
572 //these slots are either re-mapped to text or object alignment
573 const SfxPoolItem* pState = nullptr;
574 if(nAlias)
575 GetViewFrame().GetDispatcher()->QueryState( nAlias, pState );
576 if(pState)
578 if (!(m_nSelectionType & SelectionType::DrawObject))
580 rSet.Put(pState->CloneSetWhich(nWhich));
583 else
584 rSet.DisableItem(nWhich);
586 break;
588 nWhich = aIter.NextWhich();
592 void SwView::GetDrawState(SfxItemSet &rSet)
594 SfxWhichIter aIter(rSet);
595 bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr;
597 for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich;
598 nWhich = aIter.NextWhich() )
599 switch(nWhich)
601 case SID_DRAW_LINE:
602 case SID_DRAW_XLINE:
603 case SID_LINE_ARROW_END:
604 case SID_LINE_ARROW_CIRCLE:
605 case SID_LINE_ARROW_SQUARE:
606 case SID_LINE_ARROW_START:
607 case SID_LINE_CIRCLE_ARROW:
608 case SID_LINE_SQUARE_ARROW:
609 case SID_LINE_ARROWS:
610 case SID_DRAW_MEASURELINE:
611 case SID_DRAW_RECT:
612 case SID_DRAW_ELLIPSE:
613 case SID_DRAW_XPOLYGON_NOFILL:
614 case SID_DRAW_XPOLYGON:
615 case SID_DRAW_POLYGON_NOFILL:
616 case SID_DRAW_POLYGON:
617 case SID_DRAW_BEZIER_NOFILL:
618 case SID_DRAW_BEZIER_FILL:
619 case SID_DRAW_FREELINE_NOFILL:
620 case SID_DRAW_FREELINE:
621 case SID_DRAW_ARC:
622 case SID_DRAW_PIE:
623 case SID_DRAW_CIRCLECUT:
624 case SID_DRAW_TEXT:
625 case SID_DRAW_CAPTION:
626 if ( bWeb )
627 rSet.DisableItem( nWhich );
628 else
629 if (nWhich != SID_DRAW_TEXT) //tdf#113171
630 rSet.Put( SfxBoolItem( nWhich, m_nDrawSfxId == nWhich ) );
631 break;
633 case SID_DRAW_TEXT_VERTICAL:
634 case SID_DRAW_CAPTION_VERTICAL:
635 if ( bWeb || !SvtCJKOptions::IsVerticalTextEnabled() )
636 rSet.DisableItem( nWhich );
637 else
638 if (nWhich != SID_DRAW_TEXT_VERTICAL) //tdf#113171
639 rSet.Put( SfxBoolItem( nWhich, m_nDrawSfxId == nWhich ) );
640 break;
642 case SID_DRAW_TEXT_MARQUEE:
643 if (::GetHtmlMode(GetDocShell()) & HTMLMODE_SOME_STYLES)
644 rSet.Put( SfxBoolItem(nWhich, m_nDrawSfxId == nWhich));
645 else
646 rSet.DisableItem(nWhich);
647 break;
648 case SID_OBJECT_SELECT:
649 rSet.Put( SfxBoolItem(nWhich, m_nDrawSfxId == nWhich ||
650 m_nFormSfxId == nWhich));
651 break;
653 case SID_INSERT_DRAW:
654 case SID_FONTWORK_GALLERY_FLOATER :
655 case SID_DRAWTBX_ARROWS:
657 if ( bWeb )
658 rSet.DisableItem( nWhich );
660 break;
662 case SID_DRAWTBX_CS_BASIC :
663 case SID_DRAWTBX_CS_SYMBOL :
664 case SID_DRAWTBX_CS_ARROW :
665 case SID_DRAWTBX_CS_FLOWCHART :
666 case SID_DRAWTBX_CS_CALLOUT :
667 case SID_DRAWTBX_CS_STAR :
669 if ( bWeb )
670 rSet.DisableItem( nWhich );
671 else
672 rSet.Put( SfxStringItem( nWhich, m_nDrawSfxId == nWhich ? m_sDrawCustom : OUString() ) );
674 break;
679 bool SwView::HasUIFeature(SfxShellFeature nFeature) const
681 assert((nFeature & ~SfxShellFeature::SwMask) == SfxShellFeature::NONE);
682 switch(nFeature)
684 case SfxShellFeature::SwChildWindowLabel:
685 return m_pWrtShell->IsLabelDoc();
686 default:
687 return false;
691 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */