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