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