LibreOffice Module sw (master)  1
view.cxx
Go to the documentation of this file.
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 <string_view>
23 
24 #include <config_features.h>
25 #include <config_wasm_strip.h>
26 
27 #include <stdlib.h>
28 #include <hintids.hxx>
29 #include <comphelper/string.hxx>
30 #include <o3tl/any.hxx>
31 #include <o3tl/string_view.hxx>
32 #include <officecfg/Office/Common.hxx>
33 #include <vcl/graph.hxx>
34 #include <vcl/inputctx.hxx>
35 #include <svl/eitem.hxx>
36 #include <unotools/configmgr.hxx>
37 #include <unotools/lingucfg.hxx>
38 #include <unotools/useroptions.hxx>
39 #include <sfx2/dispatch.hxx>
40 #include <sfx2/docfile.hxx>
41 #include <sfx2/objface.hxx>
42 #include <sfx2/request.hxx>
43 #include <svx/ruler.hxx>
44 #include <svx/srchdlg.hxx>
45 #include <svx/fmshell.hxx>
46 #include <svx/extrusionbar.hxx>
47 #include <svx/fontworkbar.hxx>
48 #include <svx/fmview.hxx>
49 #include <unotxvw.hxx>
50 #include <cmdid.h>
51 #include <svl/hint.hxx>
52 #include <swmodule.hxx>
53 #include <inputwin.hxx>
54 #include <uivwimp.hxx>
55 #include <edtwin.hxx>
56 #include <textsh.hxx>
57 #include <listsh.hxx>
58 #include <tabsh.hxx>
59 #include <grfsh.hxx>
60 #include <mediash.hxx>
61 #include <docsh.hxx>
62 #include <frmsh.hxx>
63 #include <olesh.hxx>
64 #include <drawsh.hxx>
65 #include <drawbase.hxx>
66 #include <drformsh.hxx>
67 #include <drwtxtsh.hxx>
68 #include <beziersh.hxx>
69 #include <navsh.hxx>
70 #include <globdoc.hxx>
71 #include <scroll.hxx>
72 #include <gloshdl.hxx>
73 #include <usrpref.hxx>
74 #include <srcview.hxx>
75 #include <doc.hxx>
76 #include <IDocumentUndoRedo.hxx>
80 #include <IDocumentState.hxx>
82 #include <drawdoc.hxx>
83 #include <wdocsh.hxx>
84 #include <wrtsh.hxx>
85 #include <barcfg.hxx>
86 #include <pview.hxx>
87 #include <swdtflvr.hxx>
88 #include <prtopt.hxx>
89 #include <com/sun/star/frame/FrameSearchFlag.hpp>
90 #include <com/sun/star/frame/XLayoutManager.hpp>
91 #include <com/sun/star/scanner/ScannerContext.hpp>
92 #include <com/sun/star/scanner/XScannerManager2.hpp>
93 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
94 #include <com/sun/star/sdb/XDatabaseContext.hpp>
95 #include <com/sun/star/sdb/DatabaseContext.hpp>
97 #include <sal/log.hxx>
98 
99 #include <formatclipboard.hxx>
100 #include <PostItMgr.hxx>
101 #include <annotsh.hxx>
102 #include <swruler.hxx>
103 
104 #include <com/sun/star/document/XDocumentProperties.hpp>
105 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
106 
108 #include <sfx2/lokhelper.hxx>
109 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
110 #include <svtools/embedhlp.hxx>
111 #include <tools/UnitConversion.hxx>
112 
113 using namespace ::com::sun::star;
114 using namespace ::com::sun::star::uno;
115 using namespace ::com::sun::star::lang;
116 using namespace ::com::sun::star::scanner;
117 using namespace ::com::sun::star::sdb;
118 using namespace ::com::sun::star::sdbc;
119 
120 #define SWVIEWFLAGS SfxViewShellFlags::HAS_PRINTOPTIONS
121 
122 // Statics. OMG.
123 
124 bool bDocSzUpdated = true;
125 
127 
128 bool SwView::s_bExtra = false;
129 bool SwView::s_bFound = false;
130 bool SwView::s_bJustOpened = false;
131 
132 std::unique_ptr<SearchAttrItemList> SwView::s_xSearchList;
133 std::unique_ptr<SearchAttrItemList> SwView::s_xReplaceList;
134 
136 {
137  return *GetViewFrame()->GetDispatcher();
138 }
139 
141 {
142  bool bResetVerbs = m_bVerbsActive;
143  if ( !GetViewFrame()->GetFrame().IsInPlace() &&
145  {
146  FlyProtectFlags eProtectFlags = m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content);
147  if (eProtectFlags == FlyProtectFlags::NONE || nSelType & SelectionType::Ole)
148  {
149  if ( nSelType & SelectionType::Ole )
150  {
151  SetVerbs( GetWrtShell().GetOLEObject()->getSupportedVerbs() );
152  m_bVerbsActive = true;
153  bResetVerbs = false;
154  }
155  }
156  }
157  if ( bResetVerbs )
158  {
159  SetVerbs( Sequence< embed::VerbDescriptor >() );
160  m_bVerbsActive = false;
161  }
162 }
163 
164 // Called by the SwEditWin when it gets the focus.
165 
166 void SwView::GotFocus() const
167 {
168  // if we got the focus, and the form shell *is* on the top of the dispatcher
169  // stack, then we need to rebuild the stack (the form shell doesn't belong to
170  // the top then)
171  const SfxDispatcher& rDispatcher = const_cast< SwView* >( this )->GetDispatcher();
172  SfxShell* pTopShell = rDispatcher.GetShell( 0 );
173  FmFormShell* pAsFormShell = dynamic_cast<FmFormShell*>( pTopShell );
174  if ( pAsFormShell )
175  {
176  pAsFormShell->ForgetActiveControl();
177  const_cast< SwView* >( this )->AttrChangedNotify(nullptr);
178  }
179  else if ( m_pPostItMgr )
180  {
181  SwAnnotationShell* pAsAnnotationShell = dynamic_cast<SwAnnotationShell*>( pTopShell );
182  if ( pAsAnnotationShell )
183  {
184  m_pPostItMgr->SetActiveSidebarWin(nullptr);
185  const_cast< SwView* >( this )->AttrChangedNotify(nullptr);
186  }
187  }
188  if( GetWrtShellPtr() )
189  {
190  SwWrtShell& rWrtShell = GetWrtShell();
193  rWrtShell.GetViewOptions()->getBrowseMode() );
194  }
195 }
196 
197 // called by the FormShell when a form control is focused. This is
198 // a request to put the form shell on the top of the dispatcher stack
199 
200 IMPL_LINK_NOARG(SwView, FormControlActivated, LinkParamNone*, void)
201 {
202  // if a form control has been activated, and the form shell is not on the top
203  // of the dispatcher stack, then we need to activate it
204  const SfxDispatcher& rDispatcher = GetDispatcher();
205  const SfxShell* pTopShell = rDispatcher.GetShell( 0 );
206  const FmFormShell* pAsFormShell = dynamic_cast<const FmFormShell*>( pTopShell );
207  if ( !pAsFormShell )
208  {
209  // if we're editing text currently, cancel this
210  SdrView *pSdrView = m_pWrtShell ? m_pWrtShell->GetDrawView() : nullptr;
211  if ( pSdrView && pSdrView->IsTextEdit() )
212  pSdrView->SdrEndTextEdit( true );
213 
214  AttrChangedNotify(nullptr);
215  }
216 }
217 
218 namespace
219 {
220 uno::Reference<frame::XLayoutManager> getLayoutManager(const SfxViewFrame& rViewFrame)
221 {
222  uno::Reference<frame::XLayoutManager> xLayoutManager;
223  uno::Reference<beans::XPropertySet> xPropSet(rViewFrame.GetFrame().GetFrameInterface(),
224  uno::UNO_QUERY);
225  if (xPropSet.is())
226  {
227  try
228  {
229  xLayoutManager.set(xPropSet->getPropertyValue("LayoutManager"), uno::UNO_QUERY);
230  }
231  catch (const Exception& e)
232  {
233  SAL_WARN("sw.ui", "Failure getting layout manager: " + e.Message);
234  }
235  }
236  return xLayoutManager;
237 }
238 }
239 
240 void SwView::ShowUIElement(const OUString& sElementURL) const
241 {
242  if (auto xLayoutManager = getLayoutManager(*GetViewFrame()))
243  {
244  if (!xLayoutManager->getElement(sElementURL).is())
245  {
246  xLayoutManager->createElement(sElementURL);
247  xLayoutManager->showElement(sElementURL);
248  }
249  }
250 }
251 
253 {
254  // Attention: Maintain the SelectShell for the WebView additionally
255 
256  if(m_bInDtor)
257  return;
258 
259  // Decision if the UpdateTable has to be called
260  bool bUpdateTable = false;
261  const SwFrameFormat* pCurTableFormat = m_pWrtShell->GetTableFormat();
262  if(pCurTableFormat && pCurTableFormat != m_pLastTableFormat)
263  {
264  bUpdateTable = true; // can only be executed later
265  }
266  m_pLastTableFormat = pCurTableFormat;
267 
268  //SEL_TBL and SEL_TBL_CELLS can be ORed!
269  SelectionType nNewSelectionType = m_pWrtShell->GetSelectionType()
270  & ~SelectionType::TableCell;
271 
273  nNewSelectionType |= SelectionType::FormControl;
274 
275  if ( nNewSelectionType == m_nSelectionType )
276  {
277  GetViewFrame()->GetBindings().InvalidateAll( false );
280  // For graphs and OLE the verb can be modified of course!
281  ImpSetVerb( nNewSelectionType );
282  }
283  else
284  {
285 
286  SfxDispatcher &rDispatcher = GetDispatcher();
287  SwToolbarConfigItem *pBarCfg = SW_MOD()->GetToolbarConfig();
288 
289  if ( m_pShell )
290  {
291  rDispatcher.Flush(); // Really erase all cached shells
292  //Remember to the old selection which toolbar was visible
293  ToolbarId eId = rDispatcher.GetObjectBarId(SFX_OBJECTBAR_OBJECT);
294  if (eId != ToolbarId::None)
295  pBarCfg->SetTopToolbar(m_nSelectionType, eId);
296 
297  for ( sal_uInt16 i = 0; true; ++i )
298  {
299  SfxShell *pSfxShell = rDispatcher.GetShell( i );
300  if ( dynamic_cast< const SwBaseShell *>( pSfxShell ) != nullptr
301  || dynamic_cast< const SwDrawTextShell *>( pSfxShell ) != nullptr
302  || dynamic_cast< const svx::ExtrusionBar*>( pSfxShell ) != nullptr
303  || dynamic_cast< const svx::FontworkBar*>( pSfxShell ) != nullptr
304  || dynamic_cast< const SwAnnotationShell *>( pSfxShell ) != nullptr
305  )
306  {
307  rDispatcher.Pop( *pSfxShell, SfxDispatcherPopFlags::POP_DELETE );
308  }
309  else if ( dynamic_cast< const FmFormShell *>( pSfxShell ) != nullptr )
310  {
311  rDispatcher.Pop( *pSfxShell );
312  }
313  else
314  break;
315  }
316  }
317 
318  bool bInitFormShell = false;
319  if (!m_pFormShell)
320  {
321  bInitFormShell = true;
322  m_pFormShell = new FmFormShell( this );
323  m_pFormShell->SetControlActivationHandler( LINK( this, SwView, FormControlActivated ) );
325  }
326 
327  bool bSetExtInpCntxt = false;
328  m_nSelectionType = nNewSelectionType;
329  ShellMode eShellMode;
330 
332  rDispatcher.Push( *m_pFormShell );
333 
334  m_pShell = new SwNavigationShell( *this );
335  rDispatcher.Push( *m_pShell );
336 
338  {
339  eShellMode = ShellMode::Object;
340  m_pShell = new SwOleShell( *this );
341  rDispatcher.Push( *m_pShell );
342  }
345  {
346  eShellMode = ShellMode::Frame;
347  m_pShell = new SwFrameShell( *this );
348  rDispatcher.Push( *m_pShell );
349  if(m_nSelectionType & SelectionType::Graphic )
350  {
351  eShellMode = ShellMode::Graphic;
352  m_pShell = new SwGrfShell( *this );
353  rDispatcher.Push( *m_pShell );
354  }
355  }
357  {
358  eShellMode = ShellMode::Draw;
359  m_pShell = new SwDrawShell( *this );
360  rDispatcher.Push( *m_pShell );
361 
363  {
364  eShellMode = ShellMode::Bezier;
365  m_pShell = new SwBezierShell( *this );
366  rDispatcher.Push( *m_pShell );
367  }
368 #if HAVE_FEATURE_AVMEDIA
370  {
371  eShellMode = ShellMode::Media;
372  m_pShell = new SwMediaShell( *this );
373  rDispatcher.Push( *m_pShell );
374  }
375 #endif
377  {
378  eShellMode = ShellMode::ExtrudedCustomShape;
379  m_pShell = new svx::ExtrusionBar(this);
380  rDispatcher.Push( *m_pShell );
381  }
383  {
384  eShellMode = ShellMode::FontWork;
385  m_pShell = new svx::FontworkBar(this);
386  rDispatcher.Push( *m_pShell );
387  }
388  }
390  {
391  eShellMode = ShellMode::DrawForm;
392  m_pShell = new SwDrawFormShell( *this );
393 
394  rDispatcher.Push( *m_pShell );
395  }
397  {
398  bSetExtInpCntxt = true;
399  eShellMode = ShellMode::DrawText;
400  rDispatcher.Push( *(new SwBaseShell( *this )) );
401  m_pShell = new SwDrawTextShell( *this );
402  rDispatcher.Push( *m_pShell );
403  }
405  {
406  eShellMode = ShellMode::PostIt;
407  m_pShell = new SwAnnotationShell( *this );
408  rDispatcher.Push( *m_pShell );
409  }
410  else
411  {
412  bSetExtInpCntxt = true;
413  eShellMode = ShellMode::Text;
415  {
416  eShellMode = ShellMode::ListText;
417  m_pShell = new SwListShell( *this );
418  rDispatcher.Push( *m_pShell );
419  }
420  m_pShell = new SwTextShell(*this);
421  rDispatcher.Push( *m_pShell );
423  {
424  eShellMode = eShellMode == ShellMode::ListText ? ShellMode::TableListText
426  m_pShell = new SwTableShell( *this );
427  rDispatcher.Push( *m_pShell );
428  }
429  }
430 
431  if ( m_nSelectionType & SelectionType::FormControl )
432  rDispatcher.Push( *m_pFormShell );
433 
434  m_pViewImpl->SetShellMode(eShellMode);
436 
437  if( !GetDocShell()->IsReadOnly() )
438  {
439  if( bSetExtInpCntxt && GetWrtShell().HasReadonlySel() )
440  bSetExtInpCntxt = false;
441 
442  InputContext aCntxt( GetEditWin().GetInputContext() );
443  aCntxt.SetOptions( bSetExtInpCntxt
444  ? (aCntxt.GetOptions() |
445  ( InputContextFlags::Text |
446  InputContextFlags::ExtText ))
447  : (aCntxt.GetOptions() & ~
448  InputContextFlags( InputContextFlags::Text |
449  InputContextFlags::ExtText )) );
450  GetEditWin().SetInputContext( aCntxt );
451  }
452 
453  // Show Mail Merge toolbar initially for documents with Database fields
454  if (!m_bInitOnceCompleted && GetWrtShell().IsAnyDatabaseFieldInDoc())
455  ShowUIElement("private:resource/toolbar/mailmerge");
456 
457  // Activate the toolbar to the new selection which also was active last time.
458  // Before a flush () must be, but does not affect the UI according to MBA and
459  // is not a performance problem.
460  // TODO/LATER: maybe now the Flush() command is superfluous?!
461  rDispatcher.Flush();
462 
463  Point aPnt = GetEditWin().OutputToScreenPixel(GetEditWin().GetPointerPosPixel());
464  aPnt = GetEditWin().PixelToLogic(aPnt);
465  GetEditWin().UpdatePointer(aPnt);
466 
467  SdrView* pDView = GetWrtShell().GetDrawView();
468  if ( bInitFormShell && pDView )
469  m_pFormShell->SetView(dynamic_cast<FmFormView*>( pDView) );
470 
471  }
472  // Opportune time for the communication with OLE objects?
473  if ( GetDocShell()->GetDoc()->IsOLEPrtNotifyPending() )
474  GetDocShell()->GetDoc()->PrtOLENotify( false );
475 
476  // now the table-update
477  if(bUpdateTable)
478  m_pWrtShell->UpdateTable();
479 
481 
482  m_bInitOnceCompleted = true;
483 }
484 
485 // Interaction: AttrChangedNotify() and TimeoutHdl.
486 // No Update if actions are still open, since the cursor on the core side
487 // can be somewhere in no man's land.
488 // But since we can no longer supply status and we want instead lock
489 // the dispatcher.
490 
491 extern "C"
492 {
493  static int lcl_CmpIds( const void *pFirst, const void *pSecond)
494  {
495  return *static_cast<sal_uInt16 const *>(pFirst) - *static_cast<sal_uInt16 const *>(pSecond);
496  }
497 }
498 
499 IMPL_LINK_NOARG(SwView, AttrChangedNotify, LinkParamNone*, void)
500 {
501  if ( GetEditWin().IsChainMode() )
502  GetEditWin().SetChainMode( false );
503 
504  //Opt: Not if PaintLocked. During unlock a notify will be once more triggered.
505  if( !m_pWrtShell->IsPaintLocked() && !g_bNoInterrupt &&
506  GetDocShell()->IsReadOnly() )
507  CheckReadonlyState();
508 
509  if( !m_pWrtShell->IsPaintLocked() && !g_bNoInterrupt )
510  CheckReadonlySelection();
511 
512  if( !m_bAttrChgNotified )
513  {
514  if (m_pWrtShell->ActionPend() || g_bNoInterrupt ||
515  GetDispatcher().IsLocked() || //do not confuse the SFX
516  GetViewFrame()->GetBindings().IsInUpdate() )//do not confuse the SFX
517  {
518  m_bAttrChgNotified = true;
519  m_aTimer.Start();
520 
521  const SfxBoolItem *pItem =
522  GetObjectShell()->GetMedium()->GetItemSet()->
523  GetItemIfSet( SID_HIDDEN, false );
524  if ( !pItem || !pItem->GetValue() )
525  {
526  GetViewFrame()->GetBindings().ENTERREGISTRATIONS();
527  m_bAttrChgNotifiedWithRegistrations = true;
528  }
529 
530  }
531  else
532  SelectShell();
533 
534  }
535 
536  // change ui if cursor is at a SwPostItField
537  if (m_pPostItMgr)
538  {
539  // only perform the code that is needed to determine, if at the
540  // actual cursor position is a post-it field
541  m_pPostItMgr->SetShadowState( m_pWrtShell->GetPostItFieldAtCursor() );
542  }
543 }
544 
545 IMPL_LINK_NOARG(SwView, TimeoutHdl, Timer *, void)
546 {
547  if (m_pWrtShell->ActionPend() || g_bNoInterrupt)
548  {
549  m_aTimer.Start();
550  return;
551  }
552 
553  if ( m_bAttrChgNotifiedWithRegistrations )
554  {
555  GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
556  m_bAttrChgNotifiedWithRegistrations = false;
557  }
558 
559  CheckReadonlyState();
560  CheckReadonlySelection();
561 
562  bool bOldUndo = m_pWrtShell->DoesUndo();
563  m_pWrtShell->DoUndo( false );
564  SelectShell();
565  m_pWrtShell->DoUndo( bOldUndo );
566  m_bAttrChgNotified = false;
567  GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
568 }
569 
571 {
572  SfxDispatcher &rDis = GetDispatcher();
573  // To be able to recognize if it is already disabled!
574  SfxItemState eStateRO, eStateProtAll;
575  const SfxPoolItem *pItem;
576  // Query the status from a slot which is only known to us.
577  // Otherwise the slot is known from other; like the BasicIde
578  eStateRO = rDis.QueryState( FN_INSERT_BOOKMARK, pItem );
579  eStateProtAll = rDis.QueryState( FN_EDIT_REGION, pItem );
580  bool bChgd = false;
581 
582  if ( !m_pWrtShell->IsCursorReadonly() )
583  {
584  static sal_uInt16 aROIds[] =
585  {
586  SID_DELETE, FN_BACKSPACE, FN_SHIFT_BACKSPACE,
587  SID_UNDO,
588  SID_REDO, SID_REPEAT, SID_PASTE,
589  SID_PASTE_UNFORMATTED, FN_PASTE_NESTED_TABLE, FN_TABLE_PASTE_ROW_BEFORE,
590  FN_TABLE_PASTE_COL_BEFORE, SID_PASTE_SPECIAL, SID_SBA_BRW_INSERT,
591  SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK, SID_CHARMAP_CONTROL,
592  SID_CHARMAP, SID_EMOJI_CONTROL, FN_INSERT_SOFT_HYPHEN,
593  FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_NNBSP,
601  FN_CALCULATE, FN_FORMAT_RESET,
602  FN_POSTIT, FN_JAVAEDIT, SID_ATTR_PARA_ADJUST_LEFT,
603  SID_ATTR_PARA_ADJUST_RIGHT, SID_ATTR_PARA_ADJUST_CENTER,SID_ATTR_PARA_ADJUST_BLOCK,
604  SID_ATTR_PARA_LINESPACE_10, SID_ATTR_PARA_LINESPACE_15, SID_ATTR_PARA_LINESPACE_20,
605  SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR_BACKGROUND,
606  SID_ATTR_CHAR_COLOR_BACKGROUND_EXT, SID_ATTR_CHAR_COLOR_EXT,
607  SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_WEIGHT, SID_ATTR_CHAR_POSTURE,
608  SID_ATTR_CHAR_OVERLINE,
609  SID_ATTR_CHAR_UNDERLINE, SID_ATTR_FLASH, SID_ATTR_CHAR_STRIKEOUT,
610  SID_ULINE_VAL_SINGLE, SID_ULINE_VAL_DOUBLE, SID_ULINE_VAL_DOTTED,
611  SID_ATTR_CHAR_CONTOUR, SID_ATTR_CHAR_SHADOWED,
612  SID_ATTR_CHAR_AUTOKERN, SID_ATTR_CHAR_ESCAPEMENT, FN_SET_SUPER_SCRIPT,
613  FN_SET_SUB_SCRIPT, SID_ATTR_CHAR_CASEMAP, SID_ATTR_CHAR_LANGUAGE,
614  SID_ATTR_CHAR_KERNING, SID_CHAR_DLG, SID_ATTR_CHAR_WORDLINEMODE,
616  FN_FORMAT_DROPCAPS, SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_LINESPACE,
617  SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_KEEP, SID_ATTR_PARA_WIDOWS,
618  SID_ATTR_PARA_ORPHANS,
619  SID_ATTR_PARA_MODEL, SID_PARA_DLG,
620  FN_SELECT_PARA, SID_DEC_INDENT,
621  SID_INC_INDENT
622  };
623  static bool bFirst = true;
624  if ( bFirst )
625  {
626  qsort( static_cast<void*>(aROIds), SAL_N_ELEMENTS(aROIds), sizeof(sal_uInt16), lcl_CmpIds );
627  bFirst = false;
628  }
629  if ( SfxItemState::DISABLED == eStateRO )
630  {
631  rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY, aROIds );
632  bChgd = true;
633  }
634  }
635  else if( m_pWrtShell->IsAllProtect() )
636  {
637  if ( SfxItemState::DISABLED == eStateProtAll )
638  {
639  static sal_uInt16 aAllProtIds[] = { SID_SAVEDOC, FN_EDIT_REGION };
640  static bool bAllProtFirst = true;
641  if ( bAllProtFirst )
642  {
643  qsort( static_cast<void*>(aAllProtIds), SAL_N_ELEMENTS(aAllProtIds), sizeof(sal_uInt16), lcl_CmpIds );
644  bAllProtFirst = false;
645  }
646  rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY, aAllProtIds );
647  bChgd = true;
648  }
649  }
650  else if ( SfxItemState::DISABLED != eStateRO ||
651  SfxItemState::DISABLED != eStateProtAll )
652  {
653  bChgd = true;
654  rDis.SetSlotFilter();
655  }
656  if ( bChgd )
658 }
659 
661 {
662  SfxDisableFlags nDisableFlags = SfxDisableFlags::NONE;
663  SfxDispatcher &rDis = GetDispatcher();
664 
665  if( m_pWrtShell->HasReadonlySel() &&
666  ( !m_pWrtShell->GetDrawView() ||
667  !m_pWrtShell->GetDrawView()->GetMarkedObjectList().GetMarkCount() ))
668  nDisableFlags |= SfxDisableFlags::SwOnProtectedCursor;
669 
670  if( (SfxDisableFlags::SwOnProtectedCursor & nDisableFlags ) !=
671  (SfxDisableFlags::SwOnProtectedCursor & rDis.GetDisableFlags() ) )
672  {
673  // Additionally move at the Window the InputContext, so that
674  // in japanese / chinese versions the external input will be
675  // turned on or off. This but only if the correct shell is on
676  // the stack.
677  switch( m_pViewImpl->GetShellMode() )
678  {
679  case ShellMode::Text:
680  case ShellMode::ListText:
683  {
684 // Temporary solution!!! Should set the font of the current insertion point
685 // at each cursor movement, so outside of this "if". But TH does not
686 // evaluates the font at this time and the "purchase" appears to me
687 // as too expensive.
688 // Moreover, we don't have a font, but only attributes from which the
689 // text formatting and the correct font will be build together.
690 
691  InputContext aCntxt( GetEditWin().GetInputContext() );
692  aCntxt.SetOptions( SfxDisableFlags::SwOnProtectedCursor & nDisableFlags
693  ? (aCntxt.GetOptions() & ~
694  InputContextFlags( InputContextFlags::Text |
695  InputContextFlags::ExtText ))
696  : (aCntxt.GetOptions() |
697  ( InputContextFlags::Text |
698  InputContextFlags::ExtText )) );
699  GetEditWin().SetInputContext( aCntxt );
700  }
701  break;
702  default:
703  ;
704  }
705 
706  }
707 
708  if( nDisableFlags != rDis.GetDisableFlags() )
709  {
710  rDis.SetDisableFlags( nDisableFlags );
712  }
713 }
714 
716  : SfxViewShell( _pFrame, SWVIEWFLAGS ),
717  m_aTimer( "sw::SwView m_aTimer" ),
718  m_nNewPage(USHRT_MAX),
719  m_nOldPageNum(0),
720  m_pNumRuleNodeFromDoc(nullptr),
721  m_pEditWin( VclPtr<SwEditWin>::Create( &_pFrame->GetWindow(), *this ) ),
722  m_pShell(nullptr),
723  m_pFormShell(nullptr),
724  m_pHScrollbar(nullptr),
725  m_pVScrollbar(nullptr),
726  m_pScrollFill(VclPtr<ScrollBarBox>::Create( &_pFrame->GetWindow(), WB_SIZEABLE )),
727  m_pVRuler(VclPtr<SvxRuler>::Create(&GetViewFrame()->GetWindow(), m_pEditWin,
730  GetViewFrame()->GetBindings(),
732  m_pLastTableFormat(nullptr),
733  m_pFormatClipboard(new SwFormatClipboard()),
734  m_nSelectionType( SelectionType::All ),
735  m_nPageCnt(0),
736  m_nDrawSfxId( USHRT_MAX ),
737  m_nFormSfxId( USHRT_MAX ),
738  m_eFormObjKind(SdrObjKind::NONE),
739  m_nLastPasteDestination( static_cast<SotExchangeDest>(0xFFFF) ),
740  m_nLeftBorderDistance( 0 ),
741  m_nRightBorderDistance( 0 ),
742  m_eLastSearchCommand( static_cast<SvxSearchCmd>(0xFFFF) ),
743  m_bWheelScrollInProgress(false),
744  m_bCenterCursor(false),
745  m_bTopCursor(false),
746  m_bTabColFromDoc(false),
747  m_bTabRowFromDoc(false),
748  m_bSetTabColFromDoc(false),
749  m_bSetTabRowFromDoc(false),
750  m_bAttrChgNotified(false),
751  m_bAttrChgNotifiedWithRegistrations(false),
752  m_bVerbsActive(false),
753  m_bDrawRotate(false),
754  m_bDrawSelMode(true),
755  m_bShowAtResize(true),
756  m_bInOuterResizePixel(false),
757  m_bInInnerResizePixel(false),
758  m_bPasteState(false),
759  m_bPasteSpecialState(false),
760  m_bInMailMerge(false),
761  m_bInDtor(false),
762  m_bOldShellWasPagePreview(false),
763  m_bIsPreviewDoubleClick(false),
764  m_bMakeSelectionVisible(false),
765  m_bForceChangesToolbar(true),
766  m_nLOKPageUpDownOffset(0)
767 {
768  static bool bRequestDoubleBuffering = getenv("VCL_DOUBLEBUFFERING_ENABLE");
769  if (bRequestDoubleBuffering)
771 
772  // According to discussion with MBA and further
773  // investigations, no old SfxViewShell will be set as parameter <pOldSh>,
774  // if function "New Window" is performed to open an additional view beside
775  // an already existing one.
776  // If the view is switch from one to another, the 'old' view is given by
777  // parameter <pOldSh>.
778 
779  bDocSzUpdated = true;
780 
781  CreateScrollbar( true );
782  CreateScrollbar( false );
783 
784  m_pViewImpl.reset(new SwView_Impl(this));
785  SetName("View");
787 
788  m_aTimer.SetTimeout( 120 );
789 
790  SwDocShell& rDocSh = dynamic_cast<SwDocShell&>(*_pFrame->GetObjectShell());
791  bool bOldModifyFlag = rDocSh.IsEnableSetModified();
792  if (bOldModifyFlag)
793  rDocSh.EnableSetModified( false );
794  // HACK: SwDocShell has some cached font info, VCL informs about font updates,
795  // but loading of docs with embedded fonts happens after SwDocShell is created
796  // but before SwEditWin (which handles the VCL event) is created. So update
797  // manually.
799  rDocSh.UpdateFontList();
800  bool bWebDShell = dynamic_cast<const SwWebDocShell*>(&rDocSh) != nullptr;
801 
802  const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(bWebDShell);
803  SwViewOption aUsrPref( *pUsrPref);
804 
806  SvtLinguOptions aLinguOpt;
807  SvtLinguConfig().GetOptions( aLinguOpt );
808  aUsrPref.SetOnlineSpell( aLinguOpt.bIsSpellAuto );
809 
810  bool bOldShellWasSrcView = false;
811 
812  // determine if there is an existing view for
813  // document
814  SfxViewShell* pExistingSh = nullptr;
815  if ( pOldSh )
816  {
817  pExistingSh = pOldSh;
818  // determine type of existing view
819  if (SwPagePreview* pPagePreview = dynamic_cast<SwPagePreview *>(pExistingSh))
820  {
821  m_sSwViewData = pPagePreview->GetPrevSwViewData();
822  m_sNewCursorPos = pPagePreview->GetNewCursorPos();
823  m_nNewPage = pPagePreview->GetNewPage();
825  m_bIsPreviewDoubleClick = !m_sNewCursorPos.isEmpty() || m_nNewPage != USHRT_MAX;
826  }
827  else if (dynamic_cast<const SwSrcView *>(pExistingSh) != nullptr)
828  bOldShellWasSrcView = true;
829  }
830 
831  SAL_INFO( "sw.ui", "before create WrtShell" );
832  if (SwView *pView = dynamic_cast<SwView*>(pExistingSh))
833  {
834  m_pWrtShell.reset(new SwWrtShell(*pView->m_pWrtShell, m_pEditWin, *this));
835  }
836  else if (SwWrtShell *pWrtShell = dynamic_cast<SwWrtShell*>(rDocSh.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()))
837  {
838  m_pWrtShell.reset(new SwWrtShell(*pWrtShell, m_pEditWin, *this));
839  }
840  else
841  {
842  SwDoc& rDoc = *rDocSh.GetDoc();
843 
844  if( !bOldShellWasSrcView && bWebDShell && !m_bOldShellWasPagePreview )
845  aUsrPref.setBrowseMode( true );
846  else
848 
849  //For the BrowseMode we do not assume a factor.
850  if( aUsrPref.getBrowseMode() && aUsrPref.GetZoomType() != SvxZoomType::PERCENT )
851  {
852  aUsrPref.SetZoomType( SvxZoomType::PERCENT );
853  aUsrPref.SetZoom( 100 );
854  }
855  if (rDocSh.IsPreview())
856  {
857  aUsrPref.SetZoomType( SvxZoomType::WHOLEPAGE );
858  aUsrPref.SetViewLayoutBookMode( false );
859  aUsrPref.SetViewLayoutColumns( 1 );
860  }
861  m_pWrtShell.reset(new SwWrtShell(rDoc, m_pEditWin, *this, &aUsrPref));
862  // creating an SwView from a SwPagePreview needs to
863  // add the SwViewShell to the ring of the other SwViewShell(s)
865  {
866  SwViewShell& rPreviewViewShell = *static_cast<SwPagePreview*>(pExistingSh)->GetViewShell();
867  m_pWrtShell->MoveTo(&rPreviewViewShell);
868  // to update the field command et.al. if necessary
869  const SwViewOption* pPreviewOpt = rPreviewViewShell.GetViewOptions();
870  if( pPreviewOpt->IsFieldName() != aUsrPref.IsFieldName() ||
871  pPreviewOpt->IsShowHiddenField() != aUsrPref.IsShowHiddenField() ||
872  pPreviewOpt->IsShowHiddenPara() != aUsrPref.IsShowHiddenPara() ||
873  pPreviewOpt->IsShowHiddenChar() != aUsrPref.IsShowHiddenChar() )
874  rPreviewViewShell.ApplyViewOptions(aUsrPref);
875  // reset design mode at draw view for form
876  // shell, if needed.
877  if ( static_cast<SwPagePreview*>(pExistingSh)->ResetFormDesignMode() &&
878  m_pWrtShell->HasDrawView() )
879  {
880  SdrView* pDrawView = m_pWrtShell->GetDrawView();
881  pDrawView->SetDesignMode( static_cast<SwPagePreview*>(pExistingSh)->FormDesignModeToReset() );
882  }
883  }
884  }
885  SAL_INFO( "sw.ui", "after create WrtShell" );
887  SvxRulerSupportFlags::TABS |
888  SvxRulerSupportFlags::PARAGRAPH_MARGINS |
889  SvxRulerSupportFlags::BORDERS |
890  SvxRulerSupportFlags::NEGATIVE_MARGINS|
891  SvxRulerSupportFlags::REDUCED_METRIC,
894 
895  // assure that modified state of document
896  // isn't reset, if document is already modified.
897  const bool bIsDocModified = m_pWrtShell->GetDoc()->getIDocumentState().IsModified();
898 
899  // Thus among other things, the HRuler is not displayed in the read-only case.
900  aUsrPref.SetReadonly( m_pWrtShell->GetViewOptions()->IsReadonly() );
901 
902  // no margin for OLE!
903  Size aBrwsBorder;
904  if( SfxObjectCreateMode::EMBEDDED != rDocSh.GetCreateMode() )
905  aBrwsBorder = GetMargin();
906 
907  m_pWrtShell->SetBrowseBorder( aBrwsBorder );
908 
909  // In CTOR no shell changes may take place, which must be temporarily stored
910  // with the timer. Otherwise, the SFX removes them from the stack!
911  bool bOld = g_bNoInterrupt;
912  g_bNoInterrupt = true;
913 
914  m_pHRuler->SetActive();
915  m_pVRuler->SetActive();
916 
917  SfxViewFrame* pViewFrame = GetViewFrame();
918 
919  StartListening(*pViewFrame, DuplicateHandling::Prevent);
920  StartListening(rDocSh, DuplicateHandling::Prevent);
921 
922  // Set Zoom-factor from HRuler
923  Fraction aZoomFract( aUsrPref.GetZoom(), 100 );
924  m_pHRuler->SetZoom( aZoomFract );
925  m_pVRuler->SetZoom( aZoomFract );
926  m_pHRuler->SetDoubleClickHdl(LINK( this, SwView, ExecRulerClick ));
927  FieldUnit eMetric = pUsrPref->GetHScrollMetric();
928  m_pHRuler->SetUnit( eMetric );
929 
930  eMetric = pUsrPref->GetVScrollMetric();
931  m_pVRuler->SetUnit( eMetric );
932 
933  m_pHRuler->SetCharWidth( 371 ); // default character width
934  m_pVRuler->SetLineHeight( 551 ); // default line height
935 
936  // Set DocShell
937  m_xGlueDocShell.reset(new SwViewGlueDocShell(*this, rDocSh));
938  m_pPostItMgr.reset(new SwPostItMgr(this));
939 
940  // Check and process the DocSize. Via the handler, the shell could not
941  // be found, because the shell is not known in the SFX management
942  // within the CTOR phase.
943  DocSzChgd( m_pWrtShell->GetDocSize() );
944 
945  // Set AttrChangedNotify link
946  m_pWrtShell->SetChgLnk(LINK(this, SwView, AttrChangedNotify));
947 
948  if (rDocSh.GetCreateMode() == SfxObjectCreateMode::EMBEDDED &&
949  !rDocSh.GetVisArea(ASPECT_CONTENT).IsEmpty())
950  SetVisArea(rDocSh.GetVisArea(ASPECT_CONTENT),false);
951 
952  SAL_WARN_IF(
954  "sw.ui", "/org.openoffice.Office.Common/Undo/Steps <= 0");
956  {
957  m_pWrtShell->DoUndo();
958  }
959 
960  const bool bBrowse = m_pWrtShell->GetViewOptions()->getBrowseMode();
961  // Disable "multiple window"
962  SetNewWindowAllowed(!bBrowse);
963  // End of disabled multiple window
964 
967  m_pHScrollbar->SetAuto(bBrowse);
968  if( aUsrPref.IsViewHRuler() )
969  CreateTab();
970  if( aUsrPref.IsViewVRuler() )
971  CreateVRuler();
972 
973  m_pWrtShell->SetUIOptions( aUsrPref );
974  m_pWrtShell->SetReadOnlyAvailable( aUsrPref.IsCursorInProtectedArea() );
975 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
976  m_pWrtShell->ApplyAccessibilityOptions(SW_MOD()->GetAccessibilityOptions());
977 #endif
978 
979  if( m_pWrtShell->GetDoc()->getIDocumentState().IsUpdateExpField() )
980  {
981  if (m_pWrtShell->GetDoc()->GetDocumentFieldsManager().containsUpdatableFields())
982  {
983  CurrShell aCurr(m_pWrtShell.get());
984  m_pWrtShell->StartAction();
985  m_pWrtShell->CalcLayout();
986  m_pWrtShell->GetDoc()->getIDocumentFieldsAccess().UpdateFields(false);
987  m_pWrtShell->EndAction();
988  }
989  m_pWrtShell->GetDoc()->getIDocumentState().SetUpdateExpFieldStat( false );
990  }
991 
992  // Update all tables if necessary:
993  if( m_pWrtShell->GetDoc()->IsUpdateTOX() )
994  {
995  SfxRequest aSfxRequest( FN_UPDATE_TOX, SfxCallMode::SLOT, GetPool() );
996  Execute( aSfxRequest );
997  m_pWrtShell->GetDoc()->SetUpdateTOX( false ); // reset again
998  m_pWrtShell->SttEndDoc(true);
999  }
1000 
1001  // No ResetModified, if there is already a view to this doc.
1002  SfxViewFrame* pVFrame = GetViewFrame();
1003  SfxViewFrame* pFirst = SfxViewFrame::GetFirst(&rDocSh);
1004  // Currently(360) the view is registered firstly after the CTOR,
1005  // the following expression is also working if this changes.
1006  // If the modification cannot be canceled by undo, then do NOT set
1007  // the modify back.
1008  // no reset of modified state, if document
1009  // was already modified.
1010  if (!m_pWrtShell->GetDoc()->GetIDocumentUndoRedo().IsUndoNoResetModified() &&
1011  ( !pFirst || pFirst == pVFrame ) &&
1012  !bIsDocModified )
1013  {
1014  m_pWrtShell->ResetModified();
1015  }
1016 
1017  g_bNoInterrupt = bOld;
1018 
1019  // If a new GlobalDoc will be created, the navigator will also be generated.
1020  if( dynamic_cast<const SwGlobalDocShell*>(&rDocSh) != nullptr &&
1021  !pVFrame->GetChildWindow( SID_NAVIGATOR ))
1022  {
1023  SfxBoolItem aNavi(SID_NAVIGATOR, true);
1024  GetDispatcher().ExecuteList(SID_NAVIGATOR, SfxCallMode::ASYNCHRON, { &aNavi });
1025  }
1026 
1027  uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame().GetFrameInterface();
1028 
1029  uno::Reference< frame::XFrame > xBeamerFrame = xFrame->findFrame(
1030  "_beamer", frame::FrameSearchFlag::CHILDREN);
1031  if(xBeamerFrame.is())
1032  {
1033  SwDBData aData = m_pWrtShell->GetDBData();
1034  SwModule::ShowDBObj( *this, aData );
1035  }
1036 
1037  // has anybody calls the attrchanged handler in the constructor?
1039  {
1040  GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
1041  if( m_aTimer.IsActive() )
1042  m_aTimer.Stop();
1043  }
1044 
1045  m_aTimer.SetInvokeHandler(LINK(this, SwView, TimeoutHdl));
1047  if (bOldModifyFlag)
1048  rDocSh.EnableSetModified();
1049  InvalidateBorder();
1050 
1051  if( !m_pHScrollbar->IsVisible( true ) )
1052  ShowHScrollbar( false );
1053  if( !m_pVScrollbar->IsVisible( true ) )
1054  ShowVScrollbar( false );
1055 
1056  if (m_pWrtShell && m_pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton())
1057  m_pWrtShell->InvalidateOutlineContentVisibility();
1058 
1059  GetViewFrame()->GetWindow().AddChildEventListener( LINK( this, SwView, WindowChildEventListener ) );
1060 }
1061 
1063  : m_rView(rView)
1064 {
1065  // Set DocShell
1066  rDocSh.SetView(&m_rView);
1067  SW_MOD()->SetView(&m_rView);
1068 }
1069 
1071 {
1072  SwDocShell* pDocSh = m_rView.GetDocShell();
1073  if (pDocSh && pDocSh->GetView() == &m_rView)
1074  pDocSh->SetView(nullptr);
1075  if (SW_MOD()->GetView() == &m_rView)
1076  SW_MOD()->SetView(nullptr);
1077 }
1078 
1080 {
1081  // Notify other LOK views that we are going away.
1082  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false");
1083  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "");
1084  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
1085 
1086  // Need to remove activated field's button before disposing EditWin.
1088 
1089  GetViewFrame()->GetWindow().RemoveChildEventListener( LINK( this, SwView, WindowChildEventListener ) );
1090  m_pPostItMgr.reset();
1091 
1092  m_bInDtor = true;
1093  m_pEditWin->Hide(); // prevent problems with painting
1094 
1095  // Set pointer in SwDocShell to the view again
1096  m_xGlueDocShell.reset();
1097 
1099  GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
1100 
1101  // the last view must end the text edit
1102  SdrView *pSdrView = m_pWrtShell ? m_pWrtShell->GetDrawView() : nullptr;
1103  if( pSdrView && pSdrView->IsTextEdit() )
1104  pSdrView->SdrEndTextEdit( true );
1105  else if (pSdrView)
1106  {
1107  pSdrView->DisposeUndoManager();
1108  }
1109 
1110  SetWindow( nullptr );
1111 
1112  m_pViewImpl->Invalidate();
1113  EndListening(*GetViewFrame());
1114  EndListening(*GetDocShell());
1116  m_pWrtShell.reset(); // reset here so that it is not accessible by the following dtors.
1121  m_pGlosHdl.reset();
1122  m_pViewImpl.reset();
1123 
1124  // If this was enabled in the ctor for the frame, then disable it here.
1125  static bool bRequestDoubleBuffering = getenv("VCL_DOUBLEBUFFERING_ENABLE");
1126  if (bRequestDoubleBuffering)
1129 
1130  m_pFormatClipboard.reset();
1131 }
1132 
1134 {
1135  SfxObjectShell* pDocShell = GetViewFrame()->GetObjectShell();
1136  return dynamic_cast<SwDocShell*>( pDocShell );
1137 }
1138 
1139 // Remember CursorPos
1140 
1141 void SwView::WriteUserData( OUString &rUserData, bool bBrowse )
1142 {
1143  // The browse flag will be passed from Sfx when documents are browsed
1144  // (not to be confused with the BrowseMode).
1145  // Then that stored data are not persistent!
1146 
1147  const SwRect& rRect = m_pWrtShell->GetCharRect();
1148  const tools::Rectangle& rVis = GetVisArea();
1149 
1150  rUserData = OUString::number( rRect.Left() );
1151  rUserData += ";";
1152  rUserData += OUString::number( rRect.Top() );
1153  rUserData += ";";
1154  rUserData += OUString::number( m_pWrtShell->GetViewOptions()->GetZoom() );
1155  rUserData += ";";
1156  rUserData += OUString::number( rVis.Left() );
1157  rUserData += ";";
1158  rUserData += OUString::number( rVis.Top() );
1159  rUserData += ";";
1160  rUserData += OUString::number( bBrowse ? SAL_MIN_INT32 : rVis.Right());
1161  rUserData += ";";
1162  rUserData += OUString::number( bBrowse ? SAL_MIN_INT32 : rVis.Bottom());
1163  rUserData += ";";
1164  rUserData += OUString::number(
1165  static_cast<sal_uInt16>(m_pWrtShell->GetViewOptions()->GetZoomType()));//eZoom;
1166  rUserData += ";";
1167  rUserData += FrameTypeFlags::NONE == m_pWrtShell->GetSelFrameType() ? std::u16string_view(u"0") : std::u16string_view(u"1");
1168 }
1169 
1170 // Set CursorPos
1171 
1172 static bool lcl_IsOwnDocument( SwView& rView )
1173 {
1174  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1175  rView.GetDocShell()->GetModel(), uno::UNO_QUERY_THROW);
1176  uno::Reference<document::XDocumentProperties> xDocProps
1177  = xDPS->getDocumentProperties();
1178  OUString Created = xDocProps->getAuthor();
1179  OUString Changed = xDocProps->getModifiedBy();
1180  OUString FullName = SW_MOD()->GetUserOptions().GetFullName();
1181  return !FullName.isEmpty()
1182  && (Changed == FullName || (Changed.isEmpty() && Created == FullName));
1183 }
1184 
1185 void SwView::ReadUserData( const OUString &rUserData, bool bBrowse )
1186 {
1187  if ( !(rUserData.indexOf(';')>=0 && // more than one token
1188  // For document without layout only in the onlinelayout or
1189  // while forward/backward
1190  (!m_pWrtShell->IsNewLayout() || m_pWrtShell->GetViewOptions()->getBrowseMode() || bBrowse)) )
1191  return;
1192 
1193  bool bIsOwnDocument = lcl_IsOwnDocument( *this );
1194 
1195  CurrShell aCurr(m_pWrtShell.get());
1196 
1197  sal_Int32 nPos = 0;
1198 
1199  // No it is *not* a good idea to call GetToken within Point constr. immediately,
1200  // because which parameter is evaluated first?
1201  tools::Long nX = o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos )),
1202  nY = o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos ));
1203  Point aCursorPos( nX, nY );
1204 
1205  sal_uInt16 nZoomFactor =
1206  static_cast< sal_uInt16 >( o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos )) );
1207 
1208  tools::Long nLeft = o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos )),
1209  nTop = o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos )),
1210  nRight = o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos )),
1211  nBottom= o3tl::toInt32(o3tl::getToken(rUserData, 0, ';', nPos ));
1212 
1213  const tools::Long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
1214  if ( nBottom > (m_pWrtShell->GetDocSize().Height()+nAdd) )
1215  return;
1216 
1217  m_pWrtShell->EnableSmooth( false );
1218 
1219  const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
1220 
1221  sal_Int32 nOff = 0;
1222  SvxZoomType eZoom;
1223  if( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
1224  eZoom = static_cast<SvxZoomType>(o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rUserData, nOff, ';', nPos ))));
1225  else
1226  {
1227  eZoom = SvxZoomType::PERCENT;
1228  ++nOff;
1229  }
1230 
1231  bool bSelectObj = (0 != o3tl::toInt32(o3tl::getToken(rUserData, nOff, ';', nPos )))
1232  && m_pWrtShell->IsObjSelectable( aCursorPos );
1233 
1234  // restore editing position
1235  m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
1236  // set flag value to avoid macro execution.
1237  bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
1238  m_pWrtShell->SetMacroExecAllowed( false );
1239 // os: changed: The user data has to be read if the view is switched back from page preview
1240 // go to the last editing position when opening own files
1241  if(m_bOldShellWasPagePreview || bIsOwnDocument)
1242  {
1243  m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
1244  if( bSelectObj )
1245  {
1246  m_pWrtShell->SelectObj( aCursorPos );
1247  m_pWrtShell->EnterSelFrameMode( &aCursorPos );
1248  }
1249  }
1250 
1251  // reset flag value
1252  m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
1253 
1254  // set visible area before applying
1255  // information from print preview. Otherwise, the applied information
1256  // is lost.
1257 // os: changed: The user data has to be read if the view is switched back from page preview
1258 // go to the last editing position when opening own files
1259  if(m_bOldShellWasPagePreview || bIsOwnDocument )
1260  {
1261  if ( bBrowse )
1262  SetVisArea( aVis.TopLeft() );
1263  else
1264  SetVisArea( aVis );
1265  }
1266 
1267  //apply information from print preview - if available
1268  if( !m_sNewCursorPos.isEmpty() )
1269  {
1270  sal_Int32 nIdx{ 0 };
1271  const tools::Long nXTmp = o3tl::toInt32(o3tl::getToken(m_sNewCursorPos, 0, ';', nIdx ));
1272  const tools::Long nYTmp = o3tl::toInt32(o3tl::getToken(m_sNewCursorPos, 0, ';', nIdx ));
1273  Point aCursorPos2( nXTmp, nYTmp );
1274  bSelectObj = m_pWrtShell->IsObjSelectable( aCursorPos2 );
1275 
1276  m_pWrtShell->SwCursorShell::SetCursor( aCursorPos2 );
1277  if( bSelectObj )
1278  {
1279  m_pWrtShell->SelectObj( aCursorPos2 );
1280  m_pWrtShell->EnterSelFrameMode( &aCursorPos2 );
1281  }
1282  m_pWrtShell->MakeSelVisible();
1283  m_sNewCursorPos.clear();
1284  }
1285  else if(USHRT_MAX != m_nNewPage)
1286  {
1287  m_pWrtShell->GotoPage(m_nNewPage, true);
1288  m_nNewPage = USHRT_MAX;
1289  }
1290 
1291  SelectShell();
1292 
1293  m_pWrtShell->StartAction();
1294  const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions();
1295  if( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom )
1296  SetZoom( eZoom, nZoomFactor);
1297 
1298  m_pWrtShell->LockView( true );
1299  m_pWrtShell->EndAction();
1300  m_pWrtShell->LockView( false );
1301  m_pWrtShell->EnableSmooth( true );
1302 }
1303 
1304 void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >& rSequence )
1305 {
1306  if(GetDocShell()->IsPreview()||m_bIsPreviewDoubleClick)
1307  return;
1308  bool bIsOwnDocument = lcl_IsOwnDocument( *this );
1309 
1310  CurrShell aCurr(m_pWrtShell.get());
1311  const SwRect& rRect = m_pWrtShell->GetCharRect();
1312  const tools::Rectangle &rVis = GetVisArea();
1313  const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions();
1314 
1315  sal_Int64 nX = rRect.Left(), nY = rRect.Top(), nLeft = rVis.Left(), nTop = rVis.Top();
1316  sal_Int64 nRight = nLeft;
1317  sal_Int64 nBottom = LONG_MIN;
1318  sal_Int16 nZoomType = static_cast< sal_Int16 >(pVOpt->GetZoomType());
1319  sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom());
1320  bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode();
1321  sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
1322  bool bHideWhitespace = pVOpt->IsHideWhitespaceMode();
1323 
1324  bool bSelectedFrame = ( m_pWrtShell->GetSelFrameType() != FrameTypeFlags::NONE ),
1325  bGotVisibleLeft = false,
1326  bGotVisibleTop = false, bGotVisibleRight = false,
1327  bGotVisibleBottom = false, bGotZoomType = false,
1328  bGotZoomFactor = false, bGotIsSelectedFrame = false,
1329  bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
1330  bGotHideWhitespace = false,
1331  bBrowseMode = false, bGotBrowseMode = false;
1332  bool bKeepRatio = pVOpt->IsKeepRatio();
1333  bool bGotKeepRatio = false;
1334 
1335  for (const beans::PropertyValue& rValue : rSequence)
1336  {
1337  if ( rValue.Name == "ViewLeft" )
1338  {
1339  rValue.Value >>= nX;
1341  }
1342  else if ( rValue.Name == "ViewTop" )
1343  {
1344  rValue.Value >>= nY;
1346  }
1347  else if ( rValue.Name == "VisibleLeft" )
1348  {
1349  rValue.Value >>= nLeft;
1350  nLeft = o3tl::toTwips(nLeft, o3tl::Length::mm100);
1351  bGotVisibleLeft = true;
1352  }
1353  else if ( rValue.Name == "VisibleTop" )
1354  {
1355  rValue.Value >>= nTop;
1356  nTop = o3tl::toTwips(nTop, o3tl::Length::mm100);
1357  bGotVisibleTop = true;
1358  }
1359  else if ( rValue.Name == "VisibleRight" )
1360  {
1361  rValue.Value >>= nRight;
1362  nRight = o3tl::toTwips(nRight, o3tl::Length::mm100);
1363  bGotVisibleRight = true;
1364  }
1365  else if ( rValue.Name == "VisibleBottom" )
1366  {
1367  rValue.Value >>= nBottom;
1368  nBottom = o3tl::toTwips(nBottom, o3tl::Length::mm100);
1369  bGotVisibleBottom = true;
1370  }
1371  else if ( rValue.Name == "ZoomType" )
1372  {
1373  rValue.Value >>= nZoomType;
1374  bGotZoomType = true;
1375  }
1376  else if ( rValue.Name == "ZoomFactor" )
1377  {
1378  rValue.Value >>= nZoomFactor;
1379  bGotZoomFactor = true;
1380  }
1381  else if ( rValue.Name == "ViewLayoutColumns" )
1382  {
1383  rValue.Value >>= nViewLayoutColumns;
1384  bGotViewLayoutColumns = true;
1385  }
1386  else if ( rValue.Name == "ViewLayoutBookMode" )
1387  {
1388  bViewLayoutBookMode = *o3tl::doAccess<bool>(rValue.Value);
1389  bGotViewLayoutBookMode = true;
1390  }
1391  else if ( rValue.Name == "IsSelectedFrame" )
1392  {
1393  rValue.Value >>= bSelectedFrame;
1394  bGotIsSelectedFrame = true;
1395  }
1396  else if (rValue.Name == "ShowOnlineLayout")
1397  {
1398  rValue.Value >>= bBrowseMode;
1399  bGotBrowseMode = true;
1400  }
1401  else if (rValue.Name == "KeepRatio")
1402  {
1403  rValue.Value >>= bKeepRatio;
1404  bGotKeepRatio = true;
1405  }
1406  else if (rValue.Name == "HideWhitespace")
1407  {
1408  rValue.Value >>= bHideWhitespace;
1409  bGotHideWhitespace = true;
1410  }
1411  // Fallback to common SdrModel processing
1412  else
1414  }
1415  if (bGotBrowseMode)
1416  {
1417  // delegate further
1418  GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout", uno::Any(bBrowseMode));
1419  }
1420 
1421  SelectShell();
1422 
1423  if (!bGotVisibleBottom)
1424  return;
1425 
1426  Point aCursorPos( nX, nY );
1427  const tools::Long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
1428  if (nBottom > (m_pWrtShell->GetDocSize().Height()+nAdd) )
1429  return;
1430 
1431  m_pWrtShell->EnableSmooth( false );
1432  const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
1433 
1434  SvxZoomType eZoom;
1435  if ( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
1436  eZoom = static_cast < SvxZoomType > ( nZoomType );
1437  else
1438  {
1439  eZoom = SvxZoomType::PERCENT;
1440  }
1441  if (bGotIsSelectedFrame)
1442  {
1443  bool bSelectObj = bSelectedFrame && m_pWrtShell->IsObjSelectable( aCursorPos );
1444 
1445  // set flag value to avoid macro execution.
1446  bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
1447  m_pWrtShell->SetMacroExecAllowed( false );
1448 // os: changed: The user data has to be read if the view is switched back from page preview
1449 // go to the last editing position when opening own files
1450  m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
1451  if(m_bOldShellWasPagePreview|| bIsOwnDocument)
1452  {
1453  m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
1454 
1455  // Update the shell to toggle Header/Footer edit if needed
1456  bool bInHeader = true;
1457  if ( m_pWrtShell->IsInHeaderFooter( &bInHeader ) )
1458  {
1459  if ( !bInHeader )
1460  {
1461  m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Footer, true );
1462  m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Header, false );
1463  }
1464  else
1465  {
1466  m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Header, true );
1467  m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Footer, false );
1468  }
1469 
1470  // Force repaint
1471  m_pWrtShell->GetWin()->Invalidate();
1472  }
1473  if ( m_pWrtShell->IsInHeaderFooter() != m_pWrtShell->IsHeaderFooterEdit() )
1474  m_pWrtShell->ToggleHeaderFooterEdit();
1475 
1476  if( bSelectObj )
1477  {
1478  m_pWrtShell->SelectObj( aCursorPos );
1479  m_pWrtShell->EnterSelFrameMode( &aCursorPos );
1480  }
1481  }
1482 
1483  // reset flag value
1484  m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
1485  }
1486 
1487  SwViewOption aUsrPref(*pVOpt);
1488  bool bUsrPrefModified = false;
1489  if (bGotKeepRatio && bKeepRatio != pVOpt->IsKeepRatio())
1490  {
1491  // Got a custom value, then it makes sense to trigger notifications.
1492  aUsrPref.SetKeepRatio(bKeepRatio);
1493  bUsrPrefModified = true;
1494  }
1495  if (bGotHideWhitespace && bHideWhitespace != pVOpt->IsHideWhitespaceMode())
1496  {
1497  aUsrPref.SetHideWhitespaceMode(bHideWhitespace);
1498  bUsrPrefModified = true;
1499  }
1500  if (bUsrPrefModified)
1501  {
1502  SW_MOD()->ApplyUsrPref(aUsrPref, this);
1503  }
1504 
1505  // Set ViewLayoutSettings
1506  const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
1507  ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
1508 
1509  const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
1510  ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
1511 
1512  // In case we have a 'fixed' view layout of 2 or more columns,
1513  // we have to apply the view options *before* starting the action.
1514  // Otherwise the SetZoom function cannot work correctly, because
1515  // the view layout hasn't been calculated.
1516  const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
1517  1 < nViewLayoutColumns &&
1518  bSetViewSettings &&
1519  eZoom != SvxZoomType::PERCENT;
1520 
1521  if ( !bZoomNeedsViewLayout )
1522  m_pWrtShell->StartAction();
1523 
1524  if ( bSetViewLayoutSettings )
1525  SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, true );
1526 
1527  if ( bZoomNeedsViewLayout )
1528  m_pWrtShell->StartAction();
1529 
1530  if ( bSetViewSettings )
1531  SetZoom( eZoom, nZoomFactor, true );
1532 
1533 // os: changed: The user data has to be read if the view is switched back from page preview
1534 // go to the last editing position when opening own files
1535  if(m_bOldShellWasPagePreview||bIsOwnDocument)
1536  {
1537  if ( bGotVisibleLeft && bGotVisibleTop )
1538  {
1539  Point aTopLeft(aVis.TopLeft());
1540  // make sure the document is still centered
1541  const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
1542  SwTwips nEditWidth = GetEditWin().GetOutDev()->GetOutputSize().Width();
1543  if(nEditWidth > (m_aDocSz.Width() + lBorder ))
1544  aTopLeft.setX( ( m_aDocSz.Width() + lBorder - nEditWidth ) / 2 );
1545  else
1546  {
1547  //check if the values are possible
1549  if( aTopLeft.X() > nXMax )
1550  aTopLeft.setX( nXMax < 0 ? 0 : nXMax );
1551  }
1552  SetVisArea( aTopLeft );
1553  }
1554  else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
1555  SetVisArea( aVis );
1556  }
1557 
1558  m_pWrtShell->LockView( true );
1559  m_pWrtShell->EndAction();
1560  m_pWrtShell->LockView( false );
1561  m_pWrtShell->EnableSmooth( true );
1562 
1563 }
1564 
1565 void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence )
1566 {
1567  const SwRect& rRect = m_pWrtShell->GetCharRect();
1568  const tools::Rectangle& rVis = GetVisArea();
1569 
1570  std::vector<beans::PropertyValue> aVector;
1571 
1572  sal_uInt16 nViewID( GetViewFrame()->GetCurViewId());
1573  aVector.push_back(comphelper::makePropertyValue("ViewId", "view" + OUString::number(nViewID)));
1574 
1575  aVector.push_back(comphelper::makePropertyValue("ViewLeft", convertTwipToMm100 ( rRect.Left() )));
1576 
1577  aVector.push_back(comphelper::makePropertyValue("ViewTop", convertTwipToMm100 ( rRect.Top() )));
1578 
1579  auto visibleLeft = convertTwipToMm100 ( rVis.Left() );
1580  aVector.push_back(comphelper::makePropertyValue("VisibleLeft", visibleLeft));
1581 
1582  auto visibleTop = convertTwipToMm100 ( rVis.Top() );
1583  aVector.push_back(comphelper::makePropertyValue("VisibleTop", visibleTop));
1584 
1585  auto visibleRight = rVis.IsWidthEmpty() ? visibleLeft : convertTwipToMm100 ( rVis.Right() );
1586  aVector.push_back(comphelper::makePropertyValue("VisibleRight", visibleRight));
1587 
1588  auto visibleBottom = rVis.IsHeightEmpty() ? visibleTop : convertTwipToMm100 ( rVis.Bottom() );
1589  aVector.push_back(comphelper::makePropertyValue("VisibleBottom", visibleBottom));
1590 
1591  const sal_Int16 nZoomType = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetZoomType());
1592  aVector.push_back(comphelper::makePropertyValue("ZoomType", nZoomType));
1593 
1594  const sal_Int16 nViewLayoutColumns = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetViewLayoutColumns());
1595  aVector.push_back(comphelper::makePropertyValue("ViewLayoutColumns", nViewLayoutColumns));
1596 
1597  aVector.push_back(comphelper::makePropertyValue("ViewLayoutBookMode", m_pWrtShell->GetViewOptions()->IsViewLayoutBookMode()));
1598 
1599  aVector.push_back(comphelper::makePropertyValue("ZoomFactor", static_cast < sal_Int16 > (m_pWrtShell->GetViewOptions()->GetZoom())));
1600 
1601  aVector.push_back(comphelper::makePropertyValue("IsSelectedFrame", FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType()));
1602 
1603  aVector.push_back(
1604  comphelper::makePropertyValue("KeepRatio", m_pWrtShell->GetViewOptions()->IsKeepRatio()));
1605 
1606  aVector.push_back(comphelper::makePropertyValue(
1607  "HideWhitespace", m_pWrtShell->GetViewOptions()->IsHideWhitespaceMode()));
1608 
1609  rSequence = comphelper::containerToSequence(aVector);
1610 
1611  // Common SdrModel processing
1613 }
1614 
1615 void SwView::ShowCursor( bool bOn )
1616 {
1617  //don't scroll the cursor into the visible area
1618  bool bUnlockView = !m_pWrtShell->IsViewLocked();
1619  m_pWrtShell->LockView( true ); //lock visible section
1620 
1621  if( !bOn )
1622  m_pWrtShell->HideCursor();
1623  else if( !m_pWrtShell->IsFrameSelected() && !m_pWrtShell->IsObjSelected() )
1624  m_pWrtShell->ShowCursor();
1625 
1626  if( bUnlockView )
1627  m_pWrtShell->LockView( false );
1628 }
1629 
1630 ErrCode SwView::DoVerb(sal_Int32 nVerb)
1631 {
1632  if ( !GetViewFrame()->GetFrame().IsInPlace() )
1633  {
1634  SwWrtShell &rSh = GetWrtShell();
1635  const SelectionType nSel = rSh.GetSelectionType();
1636  if ( nSel & SelectionType::Ole )
1637  rSh.LaunchOLEObj( nVerb );
1638  }
1639  return ERRCODE_NONE;
1640 }
1641 
1642 // only return true for a text selection
1643 
1644 bool SwView::HasSelection( bool bText ) const
1645 {
1646  return bText ? GetWrtShell().SwCursorShell::HasSelection()
1647  : GetWrtShell().HasSelection();
1648 }
1649 
1650 OUString SwView::GetSelectionText( bool bCompleteWrds )
1651 {
1652  return GetSelectionTextParam( bCompleteWrds, true );
1653 }
1654 
1655 OUString SwView::GetSelectionTextParam( bool bCompleteWrds, bool bEraseTrail )
1656 {
1657  OUString sReturn;
1658  if( bCompleteWrds && !GetWrtShell().HasSelection() )
1659  GetWrtShell().SelWrd();
1660 
1661  GetWrtShell().GetSelectedText( sReturn );
1662  if( bEraseTrail )
1663  sReturn = comphelper::string::stripEnd(sReturn, ' ');
1664  return sReturn;
1665 }
1666 
1668 {
1669  if(!m_pGlosHdl)
1670  m_pGlosHdl.reset(new SwGlossaryHdl(GetViewFrame(), m_pWrtShell.get()));
1671  return m_pGlosHdl.get();
1672 }
1673 
1674 void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
1675 {
1676  bool bCallBase = true;
1677  if(auto pChangedHint = dynamic_cast<const FmDesignModeChangedHint*>(&rHint))
1678  {
1679  bool bDesignMode = pChangedHint->GetDesignMode();
1680  if (!bDesignMode && GetDrawFuncPtr())
1681  {
1683  SetDrawFuncPtr(nullptr);
1684  LeaveDrawCreate();
1685  AttrChangedNotify(nullptr);
1686  }
1687  }
1688  else
1689  {
1690  SfxHintId nId = rHint.GetId();
1691 
1692  switch ( nId )
1693  {
1694  // sub shells will be destroyed by the
1695  // dispatcher, if the view frame is dying. Thus, reset member <pShell>.
1696  case SfxHintId::Dying:
1697  {
1698  if ( &rBC == GetViewFrame() )
1699  {
1700  ResetSubShell();
1701  }
1702  }
1703  break;
1704  case SfxHintId::ModeChanged:
1705  {
1706  // Modal mode change-over?
1707  bool bModal = GetDocShell()->IsInModalMode();
1708  m_pHRuler->SetActive( !bModal );
1709  m_pVRuler->SetActive( !bModal );
1710  }
1711 
1712  [[fallthrough]];
1713 
1714  case SfxHintId::TitleChanged:
1715  if ( GetDocShell()->IsReadOnly() != GetWrtShell().GetViewOptions()->IsReadonly() )
1716  {
1717  SwWrtShell &rSh = GetWrtShell();
1719 
1720  if ( rSh.GetViewOptions()->IsViewVRuler() )
1721  CreateVRuler();
1722  else
1723  KillVRuler();
1724  if ( rSh.GetViewOptions()->IsViewHRuler() )
1725  CreateTab();
1726  else
1727  KillTab();
1728  bool bReadonly = GetDocShell()->IsReadOnly();
1729  // if document is to be opened in alive-mode then this has to be
1730  // regarded while switching from readonly-mode to edit-mode
1731  if( !bReadonly )
1732  {
1734  if (pDrawDoc)
1735  {
1736  if( !pDrawDoc->GetOpenInDesignMode() )
1737  break;// don't touch the design mode
1738  }
1739  }
1740  SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadonly);
1741  GetDispatcher().ExecuteList(SID_FM_DESIGN_MODE,
1742  SfxCallMode::ASYNCHRON, { &aItem });
1743  }
1744  break;
1745 
1746  case SfxHintId::SwDrawViewsCreated:
1747  {
1748  bCallBase = false;
1749  if ( GetFormShell() )
1750  {
1751  GetFormShell()->SetView(dynamic_cast<FmFormView*>(GetWrtShell().GetDrawView()));
1752  SfxBoolItem aItem( SID_FM_DESIGN_MODE, !GetDocShell()->IsReadOnly());
1753  GetDispatcher().ExecuteList(SID_FM_DESIGN_MODE,
1754  SfxCallMode::SYNCHRON, { &aItem });
1755  }
1756  }
1757  break;
1758  case SfxHintId::RedlineChanged:
1759  {
1760  static sal_uInt16 const aSlotRedLine[] = {
1767  0
1768  };
1769  GetViewFrame()->GetBindings().Invalidate(aSlotRedLine);
1770  }
1771  break;
1772  default: break;
1773  }
1774  }
1775 
1776  if ( bCallBase )
1777  SfxViewShell::Notify(rBC, rHint);
1778 }
1779 
1780 #if defined(_WIN32) || defined UNX
1781 
1783 {
1784  uno::Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager();
1785  if( xScanMgr.is() )
1786  {
1787  const ScannerContext aContext( xScanMgr->getAvailableScanners().getConstArray()[ 0 ] );
1788  const ScanError eError = xScanMgr->getError( aContext );
1789 
1790  if( ScanError_ScanErrorNone == eError )
1791  {
1792  const uno::Reference< awt::XBitmap > xBitmap( xScanMgr->getBitmap( aContext ) );
1793 
1794  if( xBitmap.is() )
1795  {
1796  const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
1797 
1798  if( !aScanBmp.IsEmpty() )
1799  {
1800  Graphic aGrf(aScanBmp);
1801  m_pWrtShell->InsertGraphic( OUString(), OUString(), aGrf );
1802  }
1803  }
1804  }
1805  }
1806  SfxBindings& rBind = GetViewFrame()->GetBindings();
1807  rBind.Invalidate( SID_TWAIN_SELECT );
1808  rBind.Invalidate( SID_TWAIN_TRANSFER );
1809 }
1810 #endif
1811 
1813 {
1814  if(m_aTimer.IsActive())
1815  {
1816  m_aTimer.Stop();
1818  {
1819  GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
1821  }
1822  SelectShell();
1823  m_bAttrChgNotified = false;
1824  }
1825 }
1826 
1827 bool SwView::PrepareClose( bool bUI )
1828 {
1829  SfxViewFrame* pVFrame = GetViewFrame();
1830  pVFrame->SetChildWindow( SwInputChild::GetChildWindowId(), false );
1831  if( pVFrame->GetDispatcher()->IsLocked() )
1832  pVFrame->GetDispatcher()->Lock(false);
1833 
1834  if ( m_pFormShell && !m_pFormShell->PrepareClose( bUI ) )
1835  {
1836  return false;
1837  }
1838  return SfxViewShell::PrepareClose( bUI );
1839 }
1840 
1841 // status methods for clipboard.
1842 // Status changes now notified from the clipboard.
1844 {
1846  if( m_nLastPasteDestination != nPasteDestination )
1847  {
1848  TransferableDataHelper aDataHelper(
1850  &GetEditWin()) );
1851  if( aDataHelper.GetXTransferable().is() )
1852  {
1855  *m_pWrtShell, aDataHelper );
1856  }
1857  else
1859 
1860  if( static_cast<SotExchangeDest>(0xFFFF) == m_nLastPasteDestination ) // the init value
1861  m_pViewImpl->AddClipboardListener();
1862  m_nLastPasteDestination = nPasteDestination;
1863  }
1864  return m_bPasteState;
1865 }
1866 
1868 {
1870  return false;
1871 
1873  if( m_nLastPasteDestination != nPasteDestination )
1874  {
1875  TransferableDataHelper aDataHelper(
1877  &GetEditWin()) );
1878  if( aDataHelper.GetXTransferable().is() )
1879  {
1882  *m_pWrtShell, aDataHelper );
1883  }
1884  else
1886 
1887  if( static_cast<SotExchangeDest>(0xFFFF) == m_nLastPasteDestination ) // the init value
1888  m_pViewImpl->AddClipboardListener();
1889  }
1890  return m_bPasteSpecialState;
1891 }
1892 
1893 bool SwView::IsPasteSpreadsheet(bool bHasOwnTableCopied)
1894 {
1895  TransferableDataHelper aDataHelper(
1897  &GetEditWin()) );
1898  if( aDataHelper.GetXTransferable().is() )
1899  {
1900  if (bHasOwnTableCopied && SwTransferable::IsPasteOwnFormat( aDataHelper ))
1901  return true;
1902  return aDataHelper.HasFormat( SotClipboardFormatId::SYLK ) || aDataHelper.HasFormat( SotClipboardFormatId::SYLK_BIGCAPS );
1903  }
1904  return false;
1905 }
1906 
1908 {
1910 }
1911 
1912 // Printing
1913 
1915 {
1916  SwXTextView *const pTempImpl = GetViewImpl()->GetUNOObject_Impl();
1917  return pTempImpl->BuildTmpSelectionDoc();
1918 }
1919 
1921 {
1922  GetViewImpl()->AddTransferable(rTransferable);
1923 }
1924 
1926 {
1927  SwViewShell* pVwSh = GetWrtShellPtr();
1928  if (pVwSh)
1929  return pVwSh->getLOKVisibleArea();
1930  else
1931  return tools::Rectangle();
1932 }
1933 
1935 {
1936  SwWrtShell* pSh = GetWrtShellPtr();
1937  assert(pSh);
1939 }
1940 
1941 OString SwView::getLOKPayload(int nType, int nViewId, bool* ignore) const
1942 {
1943  SwWrtShell* pSh = GetWrtShellPtr();
1944  assert(pSh);
1945  return pSh->getLOKPayload(nType, nViewId, ignore);
1946 }
1947 
1949 {
1950  uno::Reference<lang::XMultiServiceFactory> xFactory(GetDocShell()->GetModel(), uno::UNO_QUERY);
1951  uno::Reference<beans::XPropertySet> xSettings(
1952  xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
1953  OUString sDataSourceName = "";
1954  xSettings->getPropertyValue("CurrentDatabaseDataSource") >>= sDataSourceName;
1955 
1956  return sDataSourceName;
1957 }
1958 
1959 bool SwView::IsDataSourceAvailable(const OUString sDataSourceName)
1960 {
1961  uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
1962  Reference< XDatabaseContext> xDatabaseContext = DatabaseContext::create(xContext);
1963 
1964  return xDatabaseContext->hasByName(sDataSourceName);
1965 }
1966 
1967 namespace sw {
1968 
1969 void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb)
1970 {
1971  o_rData = *SW_MOD()->GetPrtOptions(bWeb);
1972 }
1973 
1974 } // namespace sw
1975 
1976 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void SetOptions(InputContextFlags nOptions)
OString stripEnd(const OString &rIn, char c)
SfxViewFrame * GetViewFrame() const
bool GetValue() const
SfxObjectShellLock CreateTmpSelectionDoc()
Definition: view.cxx:1914
void StopShellTimer()
Definition: view.cxx:1812
static bool IsPasteOwnFormat(const TransferableDataHelper &)
Definition: swdtflvr.cxx:3375
static void ShowDBObj(SwView const &rView, const SwDBData &rData)
Definition: swmodul1.cxx:368
friend class SwView_Impl
Definition: view.hxx:148
void SetTopToolbar(SelectionType nSelType, ToolbarId eBarId)
Definition: barcfg.cxx:82
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
#define FN_INSERT_PICTURE_CONTENT_CONTROL
Definition: cmdid.h:226
#define FN_REDLINE_ACCEPT_ALL
Definition: cmdid.h:150
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
#define FN_UPDATE_TOX
Definition: cmdid.h:517
SvxRulerSupportFlags
FieldUnit
SfxHintId
std::unique_ptr< SwFormatClipboard > m_pFormatClipboard
Definition: view.hxx:218
SwXTextView * GetUNOObject_Impl()
Definition: uivwimp.cxx:94
OString getLOKPayload(int nType, int nViewId, bool *ignore) const
Definition: wrtsh4.cxx:237
#define FN_REDLINE_REJECT_ALL
Definition: cmdid.h:151
tools::Long GetRangeMax() const
#define FN_EDIT_REGION
Definition: cmdid.h:115
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2214
bool IsPasteSpecialAllowed()
Definition: view.cxx:1867
void SetActive(bool bOn=true)
std::unique_ptr< SwViewGlueDocShell > m_xGlueDocShell
Definition: view.hxx:194
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
SfxChildWindow * GetChildWindow(sal_uInt16)
FieldUnit GetVScrollMetric() const
Definition: usrpref.hxx:225
void SetReadonly(bool bSet)
Definition: viewopt.hxx:464
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &) override
Definition: view.cxx:1565
SdrView * GetDrawView()
Definition: vnew.cxx:373
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
SAL_DLLPRIVATE void CheckReadonlyState()
Definition: view.cxx:570
void SetDesignMode(bool bOn=true)
constexpr WinBits WB_EXTRAFIELD
void InitPrintOptionsFromApplication(SwPrintData &o_rData, bool const bWeb)
Definition: view.cxx:1969
constexpr auto toTwips(N number, Length from)
#define FN_DELETE_SENT
Definition: cmdid.h:678
SfxViewFrame * GetFrame() const
#define FN_SET_SUPER_SCRIPT
Definition: cmdid.h:321
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:506
TABS
#define FN_DELETE_BACK_SENT
Definition: cmdid.h:679
virtual ~SwView() override
Definition: view.cxx:1079
std::unique_ptr< SwPostItMgr > m_pPostItMgr
Definition: view.hxx:220
void AddTransferable(SwTransferable &rTransferable)
Definition: view.cxx:1920
std::unique_ptr< SwWrtShell > m_pWrtShell
Definition: view.hxx:193
void UpdateFontList()
Definition: docshini.cxx:414
constexpr auto WB_STDRULER
void SetViewLayout(sal_uInt16 nColumns, bool bBookMode, bool bViewOnly=false)
Definition: viewmdi.cxx:224
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:79
bool IsPasteSpreadsheet(bool bHasOwnTableCopied)
Definition: view.cxx:1893
constexpr tools::Long Left() const
void Pop(SfxShell &rShell, SfxDispatcherPopFlags nMode=SfxDispatcherPopFlags::NONE)
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
View of a document.
Definition: pview.hxx:161
VclPtr< SvxRuler > m_pHRuler
Definition: view.hxx:210
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
Definition: legacyitem.cxx:32
void SetDisableFlags(SfxDisableFlags nFlags)
void ImpSetVerb(SelectionType nSelType)
Definition: view.cxx:140
SfxDispatcher * GetDispatcher()
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
Definition: edglss.cxx:261
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override
Definition: unotxvw.cxx:541
bool m_bAttrChgNotified
Definition: view.hxx:240
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
Definition: swdtflvr.cxx:1374
long Long
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
void DisposeUndoManager()
SAL_DLLPRIVATE void CheckReadonlySelection()
Definition: view.cxx:660
Reference< XFrame > xFrame
bool m_bOldShellWasPagePreview
Definition: view.hxx:240
css::uno::Reference< css::frame::XModel3 > GetModel() const
Definition: doc.hxx:187
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:482
sal_Int16 nId
void SetSlotFilter(SfxSlotFilterState nEnable=SfxSlotFilterState::DISABLED, o3tl::span< sal_uInt16 const > pSIDs=o3tl::span< sal_uInt16 const >())
static bool lcl_IsOwnDocument(SwView &rView)
Definition: view.cxx:1172
#define FN_DELETE_WHOLE_LINE
Definition: cmdid.h:686
Size m_aDocSz
Definition: view.hxx:189
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
virtual void WriteUserData(OUString &, bool bBrowse=false) override
Definition: view.cxx:1141
void RemoveChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
SwEditWin & GetEditWin()
Definition: view.hxx:416
static std::unique_ptr< SearchAttrItemList > s_xSearchList
Definition: view.hxx:173
void LaunchOLEObj(sal_Int32 nVerb=css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY)
Definition: wrtsh1.cxx:638
virtual SfxBindings & GetBindings() override
bool IsPasteAllowed()
Definition: view.cxx:1843
static std::unique_ptr< SearchAttrItemList > s_xReplaceList
Definition: view.hxx:174
SotExchangeDest
WinBits const WB_VSCROLL
Dialog to specify the properties of date form field.
#define FN_INSERT_COLUMN_BREAK
Definition: cmdid.h:206
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
const SwFrameFormat * m_pLastTableFormat
Definition: view.hxx:216
void Invalidate(sal_uInt16 nId)
bool IsShowHiddenPara() const
Definition: viewopt.hxx:397
#define FN_INSERT_LINEBREAK
Definition: cmdid.h:218
constexpr bool IsHeightEmpty() const
void ResetSubShell()
Definition: view.hxx:582
virtual SfxObjectShell * GetObjectShell() override
void AddTransferable(SwTransferable &rTransferable)
Definition: uivwimp.cxx:221
bool HasFormat(SotClipboardFormatId nFormat) const
#define FN_PASTE_NESTED_TABLE
Definition: cmdid.h:311
SwView & m_rView
Definition: view.hxx:137
SfxHintId GetId() const
SwView_Impl * GetViewImpl()
Definition: view.hxx:348
void SetVisArea(const tools::Rectangle &, bool bUpdateScrollbar=true)
Definition: viewport.cxx:198
FieldUnit GetHScrollMetric() const
Definition: usrpref.hxx:217
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
void SetKeepRatio(bool b)
Definition: viewopt.hxx:554
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:546
constexpr auto convertTwipToMm100(N n)
SdrObjKind
bool m_bAttrChgNotifiedWithRegistrations
Definition: view.hxx:240
bool IsActive() const
#define FN_DELETE_BACK_WORD
Definition: cmdid.h:681
void SetDrawFuncPtr(std::unique_ptr< SwDrawBase > pFuncPtr)
Definition: viewdraw.cxx:641
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
#define FN_INSERT_CONTENT_CONTROL
Definition: cmdid.h:220
constexpr tools::Long Width() const
#define FN_CALCULATE
Definition: cmdid.h:504
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
bool IsFieldName() const
Definition: viewopt.hxx:269
vcl::Window & GetWindow() const
#define FN_DELETE_WORD
Definition: cmdid.h:680
SelectionType m_nSelectionType
Definition: view.hxx:222
static BitmapEx GetBitmap(const css::uno::Reference< css::awt::XBitmap > &rxBitmap)
void InvalidateBorder()
SfxShell * GetShell(sal_uInt16 nIdx) const
virtual void SelectShell()
Definition: view.cxx:252
bool m_bVScrollbarEnabled
Definition: view.hxx:205
bool IsVisible(bool bReal) const
Definition: scroll.hxx:39
#define FN_INSERT_BOOKMARK
Definition: cmdid.h:203
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
bool getBrowseMode() const
Definition: viewopt.hxx:472
void PrtOLENotify(bool bAll)
Definition: docdesc.cxx:818
bool bDocSzUpdated
Definition: view.cxx:124
static bool IsFuzzing()
SfxFrame & GetFrame() const
void setBrowseMode(bool bSet)
Definition: viewopt.hxx:473
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
bool m_bPasteState
Definition: view.hxx:240
#define FN_INSERT_CHECKBOX_CONTENT_CONTROL
Definition: cmdid.h:221
bool IsViewVScrollBar() const
Definition: viewopt.hxx:519
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
virtual void ShowCursor(bool bOn=true) override
Definition: view.cxx:1615
static bool s_bJustOpened
Definition: view.hxx:171
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2781
FmFormShell * m_pFormShell
Definition: view.hxx:197
SfxObjectCreateMode GetCreateMode() const
static SotExchangeDest GetSotDestination(const SwWrtShell &rSh)
Definition: swdtflvr.cxx:2083
ShellMode
Definition: view.hxx:85
void DocSzChgd(const Size &rNewSize)
Definition: viewport.cxx:154
virtual void Deactivate()
Definition: drawbase.cxx:444
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:592
VclPtr< SwEditWin > m_pEditWin
Definition: view.hxx:192
#define FN_DELETE_PARA
Definition: cmdid.h:684
void CreateVRuler()
Definition: viewmdi.cxx:659
SotExchangeDest m_nLastPasteDestination
Definition: view.hxx:230
#define FN_SHRINK_FONT_SIZE
Definition: cmdid.h:319
void SetView(FmFormView *pView)
void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &rValues)
SfxItemPool & GetPool() const
virtual OUString GetSelectionText(bool bCompleteWords=false) override
Definition: view.cxx:1650
void KillVRuler()
Definition: viewmdi.cxx:668
constexpr bool IsEmpty() const
SfxDispatcher & GetDispatcher()
Definition: view.cxx:135
IMPL_LINK_NOARG(SwView, FormControlActivated, LinkParamNone *, void)
Definition: view.cxx:200
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
#define SAL_N_ELEMENTS(arr)
virtual void ReadUserData(const OUString &, bool bBrowse=false) override
Definition: view.cxx:1185
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:484
#define FN_TABLE_PASTE_ROW_BEFORE
Definition: cmdid.h:312
void FlushPendingLOKInvalidateTiles()
Definition: viewsh.cxx:599
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
SwView(SfxViewFrame *pFrame, SfxViewShell *)
Definition: view.cxx:715
#define FN_REDLINE_ACCEPT_DIRECT
Definition: cmdid.h:144
bool IsEmpty() const
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override
Definition: docsh.cxx:914
virtual void ClearFieldActivation()=0
void SetView(SwView *pVw)
Set View for actions via Shell.
Definition: docsh.cxx:1164
#define SWVIEWFLAGS
Definition: view.cxx:120
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:578
#define FN_SET_SUB_SCRIPT
Definition: cmdid.h:322
Style of a layout element.
Definition: frmfmt.hxx:59
std::unique_ptr< SwGlossaryHdl > m_pGlosHdl
Definition: view.hxx:213
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:572
bool IsCursorInProtectedArea() const
Definition: viewopt.hxx:409
bool HasSelection() const
Definition: wrtsh.hxx:147
#define SW_MOD()
Definition: swmodule.hxx:256
bool m_bIsPreviewDoubleClick
Definition: view.hxx:240
OUString m_sNewCursorPos
Definition: view.hxx:177
bool SelWrd(const Point *=nullptr)
Definition: select.cxx:73
void SetInputContext(const InputContext &rInputContext)
#define FN_DELETE_LINE
Definition: cmdid.h:682
void SetWindow(vcl::Window *pViewPort)
int i
VclPtr< vcl::Window > m_pScrollFill
Definition: view.hxx:207
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:479
void SetOnlineSpell(bool b)
Definition: viewopt.cxx:339
void GetOptions(SvtLinguOptions &rOptions) const
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:59
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const
SelectionType
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &) override
Definition: view.cxx:1304
void SetAuto(bool bSet)
Definition: scroll.cxx:90
SwViewGlueDocShell(SwView &rView, SwDocShell &rDocSh)
Definition: view.cxx:1062
SfxBindings & GetBindings()
bool GetOpenInDesignMode() const
Size GetOutputSize() const
bool IsPreview() const
#define FN_REDLINE_PREV_CHANGE
Definition: cmdid.h:149
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:606
#define FN_INSERT_BREAK_DLG
Definition: cmdid.h:205
constexpr tools::Long Right() const
#define SAL_MIN_INT32
SfxShell subclass that is used while interacting with the editeng-based text of a shape...
Definition: drwtxtsh.hxx:31
void ShowUIElement(const OUString &sElementURL) const
Definition: view.cxx:240
FlyProtectFlags
values can be combined via logical or
Definition: fesh.hxx:105
float u
static bool IsPasteSpecial(const SwWrtShell &rWrtShell, const TransferableDataHelper &)
Definition: swdtflvr.cxx:3366
constexpr tools::Long Top() const
bool IsActiveControl() const
void ShowVScrollbar(bool bShow)
Definition: viewmdi.cxx:731
#define FN_JAVAEDIT
Definition: cmdid.h:287
SfxDisableFlags GetDisableFlags() const
void Lock(bool bLock)
virtual void SetReadonlyOption(bool bSet) override
Definition: wrtsh1.cxx:2096
void NotifySelChanged()
Definition: unotxvw.cxx:708
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
Shell * m_pShell
void SetName(const OUString &rName)
virtual bool PrepareClose(bool bUI=true) override
Definition: view.cxx:1827
Point PixelToLogic(const Point &rDevicePt) const
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
void LeaveDrawCreate()
Definition: view.hxx:538
void RequestDoubleBuffering(bool bRequest)
SwDrawBase * GetDrawFuncPtr() const
Definition: view.hxx:526
void CreateTab()
Definition: viewmdi.cxx:617
#define ASPECT_CONTENT
void SetTimeout(sal_uInt64 nTimeoutMs)
virtual ErrCode DoVerb(sal_Int32 nVerb) override
Definition: view.cxx:1630
VclPtr< SvxRuler > m_pVRuler
Definition: view.hxx:210
InputContextFlags GetOptions() const
SfxViewShell * GetViewShell() const
tools::Long SwTwips
Definition: swtypes.hxx:51
#define FN_SELECT_PARA
Definition: cmdid.h:125
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
const Size & GetMargin() const
SwDocShell * GetDocShell()
Definition: view.cxx:1133
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
bool IsReadOnly() const
OUString m_sSwViewData
Definition: view.hxx:177
#define SFX_OBJECTBAR_OBJECT
constexpr Point TopLeft() const
void ShowHScrollbar(bool bShow)
Definition: viewmdi.cxx:719
constexpr tools::Long Bottom() const
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:483
OUString GetDataSourceName() const
Definition: view.cxx:1948
static int lcl_CmpIds(const void *pFirst, const void *pSecond)
Definition: view.cxx:493
WinBits const WB_SIZEABLE
#define FN_DELETE_BACK_LINE
Definition: cmdid.h:683
const tools::Rectangle & getLOKVisibleArea() const
The visible area in the client (set by setClientVisibleArea).
Definition: viewsh.hxx:253
void SetVerbs(const css::uno::Sequence< css::embed::VerbDescriptor > &aVerbs)
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:73
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:480
bool IsKeepRatio() const
Definition: viewopt.hxx:535
sal_uInt16 m_nNewPage
Definition: view.hxx:181
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
VclPtr< SwScrollbar > m_pVScrollbar
Definition: view.hxx:201
SfxDispatcher * GetDispatcher()
Timer m_aTimer
Definition: view.hxx:176
SfxItemState
virtual bool IsTextEdit() const final override
void Stop()
#define SAL_WARN_IF(condition, area, stream)
virtual void flushPendingLOKInvalidateTiles() override
Definition: view.cxx:1934
#define ERRCODE_NONE
std::unique_ptr< SwView_Impl > m_pViewImpl
Definition: view.hxx:199
WinBits const WB_BORDER
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
#define FN_DELETE_BACK_PARA
Definition: cmdid.h:685
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
static bool s_bFound
Definition: view.hxx:170
void GotFocus() const
Definition: view.cxx:166
#define FN_REDLINE_NEXT_CHANGE
Definition: cmdid.h:148
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
virtual SAL_DLLPRIVATE void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: view.cxx:1674
#define SAL_INFO(area, stream)
bool m_bPasteSpecialState
Definition: view.hxx:240
void NotifyDBChanged()
Definition: unotxvw.cxx:720
::OutputDevice const * GetOutDev() const
void UpdatePointer(const Point &, sal_uInt16 nButtons=0)
Definition: edtwin.cxx:340
This class acts as data container and execution class for the format paintbrush feature in writer...
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
bool PrepareClose(bool bUI=true)
#define FN_BACKSPACE
Definition: cmdid.h:677
static VclPtr< reference_type > Create(Arg &&...arg)
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
#define FN_TABLE_PASTE_COL_BEFORE
Definition: cmdid.h:313
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
OUString GetSelectionTextParam(bool bCompleteWords, bool bEraseTrail)
Definition: view.cxx:1655
VclPtr< SwScrollbar > m_pHScrollbar
Definition: view.hxx:201
void Push(SfxShell &rShell)
void NotifyDBChanged()
Definition: view.cxx:1907
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:505
bool IsInModalMode() const
void Execute(SfxRequest &)
Definition: view2.cxx:543
Reference< XComponentContext > getProcessComponentContext()
ToolbarId
void SetInvokeHandler(const Link< Timer *, void > &rLink)
bool IsDocumentBorder()
Definition: viewport.cxx:54
SfxObjectShellLock BuildTmpSelectionDoc()
Definition: unotxvw.cxx:673
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
SwGlossaryHdl * GetGlosHdl()
Definition: view.cxx:1667
#define FN_GROW_FONT_SIZE
Definition: cmdid.h:318
SvxSearchCmd
#define FN_TXTATR_INET
Definition: cmdid.h:750
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:426
bool IsEnableSetModified() const
bool IsLocked() const
tools::Long GetVisibleSize() const
#define FN_SHIFT_BACKSPACE
Definition: cmdid.h:692
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void ScannerEventHdl()
Definition: view.cxx:1782
SfxShell * m_pShell
Definition: view.hxx:196
void InvalidateAll(bool bWithMsg)
bool g_bNoInterrupt
Definition: swmodule.cxx:114
virtual void SetCurrentViewShell(SwViewShell *pNew)=0
!!!The old layout must be deleted!!!
#define SAL_WARN(area, stream)
Reference< XSingleServiceFactory > xFactory
bool m_bInDtor
Definition: view.hxx:240
void SetControlActivationHandler(const Link< LinkParamNone *, void > &_rHdl)
const SwView * GetView() const
Definition: docsh.hxx:221
Point OutputToScreenPixel(const Point &rPos) const
SvxZoomType
SfxDisableFlags
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:321
#define FN_INSERT_DATE_CONTENT_CONTROL
Definition: cmdid.h:227
bool IsShowHiddenField() const
Definition: viewopt.hxx:328
void EnableSetModified(bool bEnable=true)
virtual SdrView * GetDrawView() const override
Definition: viewdraw.cxx:621
void KillTab()
Definition: viewmdi.cxx:625
virtual tools::Rectangle getLOKVisibleArea() const override
Definition: view.cxx:1925
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1693
SAL_DLLPRIVATE void CreateScrollbar(bool bHori)
Definition: viewmdi.cxx:300
static SvxSearchItem * s_pSrchItem
Definition: view.hxx:164
#define FN_INSERT_DROPDOWN_CONTENT_CONTROL
Definition: cmdid.h:224
bool IsViewHScrollBar() const
Definition: viewopt.hxx:527
#define FN_REDLINE_REJECT_DIRECT
Definition: cmdid.h:145
bool m_bHScrollbarEnabled
Definition: view.hxx:204
bool m_bVerbsActive
Definition: view.hxx:240
virtual OString getLOKPayload(int nType, int nViewId, bool *ignore) const override
Definition: view.cxx:1941
void ReadUserDataSequenceValue(const css::beans::PropertyValue *pValue)
ToolbarId GetObjectBarId(sal_uInt16 nPos) const
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:481
static bool s_bExtra
Definition: view.hxx:169
virtual bool HasSelection(bool bText=true) const override
Definition: view.cxx:1644
void ForgetActiveControl()
void AddChildEventListener(const Link< VclWindowEvent &, void > &rEventListener)
#define FN_POSTIT
Definition: cmdid.h:228
constexpr bool IsWidthEmpty() const
virtual bool PrepareClose(bool bUI=true)
Definition: view.hxx:144
bool m_bInitOnceCompleted
Definition: view.hxx:262
void SetNewWindowAllowed(bool bSet)
sal_uInt16 nPos
#define FN_FORMAT_DROPCAPS
Definition: cmdid.h:332
static bool IsDataSourceAvailable(const OUString sDataSourceName)
Definition: view.cxx:1959
bool m_bDetectedRangeSegmentation false