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