LibreOffice Module sw (master)  1
viewimp.hxx
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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
21 
22 #include <tools/color.hxx>
23 #include <svx/svdtypes.hxx>
24 #include <swrect.hxx>
25 #include <swregion.hxx>
26 #include <vector>
27 #include <memory>
28 
29 class OutputDevice;
30 class SwViewShell;
31 class SwFlyFrame;
32 class SwViewOption;
33 class SwFrame;
34 class SwLayAction;
35 class SwLayIdle;
36 class SwDrawView;
37 class SdrPageView;
38 class SwPageFrame;
39 class SwAccessibleMap;
40 class SdrObject;
41 class Fraction;
42 class SwPrintData;
44 struct PreviewPage;
45 class SwTextFrame;
46 // --> OD #i76669#
47 namespace sdr::contact { class ViewObjectContactRedirector; }
48 // <--
49 
51 {
52  friend class SwViewShell;
53 
54  friend class SwLayAction; // Lay- and IdleAction register and deregister
55  friend class SwLayIdle;
56 
57  // for paint of page preview
58  friend class SwPagePreviewLayout;
59 
60  SwViewShell *m_pShell; // If someone passes an Imp, but needs a SwViewShell, we
61  // keep a backlink here
62 
63  std::unique_ptr<SwDrawView> m_pDrawView; // Our DrawView
64  SdrPageView *m_pSdrPageView; // Exactly one Page for our DrawView
65 
66  SwPageFrame *m_pFirstVisiblePage; // Always points to the first visible Page
67  std::unique_ptr<SwRegionRects> m_pPaintRegion; // Collector of Paintrects from the LayAction
68 
69  std::vector<SwRect> m_pendingLOKInvalidations;
70 
71  SwLayAction *m_pLayAction; // Is set if an Action object exists
72  // Is registered by the SwLayAction ctor and deregistered by the dtor
73  SwLayIdle *m_pIdleAct; // The same as SwLayAction for SwLayIdle
74 
77  std::shared_ptr<SwAccessibleMap> m_pAccessibleMap;
78 
79  bool m_bFirstPageInvalid : 1; // Pointer to the first Page invalid?
80  bool m_bResetHdlHiddenPaint : 1; // Ditto
81  bool m_bSmoothUpdate : 1; // For SmoothScroll
82  bool m_bStopSmooth : 1;
83 
84  sal_uInt16 m_nRestoreActions ; // Count for the Action that need to be restored (UNO)
86 
87  std::unique_ptr<SwPagePreviewLayout> m_pPagePreviewLayout;
88 
89  void SetFirstVisPage(OutputDevice const * pRenderContext); // Recalculate the first visible Page
90 
91  void StartAction(); // Show handle and hide
92  void EndAction(); // Called by SwViewShell::ImplXXXAction
93  void LockPaint(); // Ditto; called by SwViewShell::ImplLockPaint
94  void UnlockPaint();
95 
96 private:
97 
99 
116  void InvalidateAccessibleParaFlowRelation_( const SwTextFrame* _pFromTextFrame,
117  const SwTextFrame* _pToTextFrame );
118 
126 
133  void InvalidateAccessibleParaAttrs_( const SwTextFrame& rTextFrame );
134 
135 public:
137  ~SwViewShellImp();
138  void Init( const SwViewOption * );
139 
140  const SwViewShell *GetShell() const { return m_pShell; }
142 
143  Color GetRetoucheColor() const;
144 
146  const SwPageFrame *GetFirstVisPage(OutputDevice const * pRenderContext) const;
147  SwPageFrame *GetFirstVisPage(OutputDevice const * pRenderContext);
149 
150  bool AddPaintRect( const SwRect &rRect );
151  bool HasPaintRegion() { return static_cast<bool>(m_pPaintRegion); }
152  std::unique_ptr<SwRegionRects> TakePaintRegion() { return std::move(m_pPaintRegion); }
153  const SwRegionRects* GetPaintRegion() { return m_pPaintRegion.get(); }
154  void DeletePaintRegion() { m_pPaintRegion.reset(); }
155 
156  void AddPendingLOKInvalidation( const SwRect& rRect );
157  std::vector<SwRect> TakePendingLOKInvalidations();
158 
160  bool HasDrawView() const { return nullptr != m_pDrawView; }
161  SwDrawView* GetDrawView() { return m_pDrawView.get(); }
162  const SwDrawView* GetDrawView() const { return m_pDrawView.get(); }
164  const SdrPageView*GetPageView() const { return m_pSdrPageView; }
165  void MakeDrawView();
166 
175  void PaintLayer( const SdrLayerID _nLayerID,
176  SwPrintData const*const pPrintData,
177  SwPageFrame const& rPageFrame,
178  const SwRect& _rRect,
179  const Color* _pPageBackgrdColor,
180  const bool _bIsPageRightToLeft,
182 
188  // Interface Drawing
189  bool IsDragPossible( const Point &rPoint );
190  void NotifySizeChg( const Size &rNewSz );
191 
193  bool IsAction() const { return m_pLayAction != nullptr; }
194  bool IsIdleAction() const { return m_pIdleAct != nullptr; }
196  const SwLayAction &GetLayAction() const { return *m_pLayAction; }
197 
202  void CheckWaitCursor();
203 
205  bool IsCalcLayoutProgress() const;
206 
212  bool IsUpdateExpFields();
213 
214  void SetRestoreActions(sal_uInt16 nSet){m_nRestoreActions = nSet;}
215  sal_uInt16 GetRestoreActions() const{return m_nRestoreActions;}
216 
217  void InitPagePreviewLayout();
218 
220  {
221  return m_pPagePreviewLayout.get();
222  }
223 
225  bool IsAccessible() const { return m_pAccessibleMap != nullptr; }
226 
228 
230  void UpdateAccessible();
231 
233  void DisposeAccessible( const SwFrame *pFrame, const SdrObject *pObj,
234  bool bRecursive, bool bCanSkipInvisible );
235  inline void DisposeAccessibleFrame( const SwFrame *pFrame,
236  bool bRecursive = false );
237  inline void DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible );
238 
240  void MoveAccessible( const SwFrame *pFrame, const SdrObject *pObj,
241  const SwRect& rOldFrame );
242  inline void MoveAccessibleFrame( const SwFrame *pFrame, const SwRect& rOldFrame );
243 
245  inline void AddAccessibleFrame( const SwFrame *pFrame );
246 
247  inline void AddAccessibleObj( const SdrObject *pObj );
248 
250  void InvalidateAccessibleFrameContent( const SwFrame *pFrame );
251 
253  void InvalidateAccessibleCursorPosition( const SwFrame *pFrame );
254 
256  void InvalidateAccessibleEditableState( bool bAllShells,
257  const SwFrame *pFrame=nullptr );
258 
260  void InvalidateAccessibleRelationSet( const SwFlyFrame *pMaster,
261  const SwFlyFrame *pFollow );
262 
265  void UpdateAccessiblePreview( const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
266  const Fraction& _rScale,
267  const SwPageFrame* _pSelectedPageFrame,
268  const Size& _rPreviewWinSize );
269 
270  void InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage );
271 
273  void FireAccessibleEvents();
274 };
275 
277 {
278  if( !m_pAccessibleMap )
280 
281  return *m_pAccessibleMap;
282 }
283 
285  bool bRecursive )
286 {
287  DisposeAccessible( pFrame, nullptr, bRecursive, true );
288 }
289 
290 inline void SwViewShellImp::DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible )
291 {
292  DisposeAccessible( nullptr, pObj, false, bCanSkipInvisible );
293 }
294 
295 inline void SwViewShellImp::MoveAccessibleFrame( const SwFrame *pFrame,
296  const SwRect& rOldFrame )
297 {
298  MoveAccessible( pFrame, nullptr, rOldFrame );
299 }
300 
301 inline void SwViewShellImp::AddAccessibleFrame( const SwFrame *pFrame )
302 {
303  SwRect aEmptyRect;
304  MoveAccessible( pFrame, nullptr, aEmptyRect );
305 }
306 
307 inline void SwViewShellImp::AddAccessibleObj( const SdrObject *pObj )
308 {
309  SwRect aEmptyRect;
310  MoveAccessible( nullptr, pObj, aEmptyRect );
311 }
312 #endif // INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
313 
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bFirstPageInvalid
Definition: viewimp.hxx:79
data structure for a preview page in the current preview layout
Definition: prevwpage.hxx:30
Base class of the Writer layout elements.
Definition: frame.hxx:315
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
void InvalidateAccessibleFrameContent(const SwFrame *pFrame)
Invalidate accessible frame's content.
Definition: viewimp.cxx:370
void FireAccessibleEvents()
Fire all accessible events that have been collected so far.
Definition: viewimp.cxx:489
void InvalidateAccessibleCursorPosition(const SwFrame *pFrame)
Invalidate accessible frame's cursor position.
Definition: viewimp.cxx:380
void InvalidateAccessibleRelationSet(const SwFlyFrame *pMaster, const SwFlyFrame *pFollow)
Invalidate frame's relation set (for chained frames)
Definition: viewimp.cxx:403
const SwLayAction & GetLayAction() const
Definition: viewimp.hxx:196
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
Definition: viewimp.hxx:301
void DisposeAccessible(const SwFrame *pFrame, const SdrObject *pObj, bool bRecursive, bool bCanSkipInvisible)
Remove a frame from the accessible view.
Definition: viewimp.cxx:345
bool HasPaintRegion()
Definition: viewimp.hxx:151
void InvalidateAccessibleParaAttrs_(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewimp.cxx:455
void AddAccessibleObj(const SdrObject *pObj)
Definition: viewimp.hxx:307
SwAccessibleMap & GetAccessibleMap()
Definition: viewimp.hxx:276
SwViewShellImp(SwViewShell *)
CTor for the core internals.
Definition: viewimp.cxx:84
SwRect m_aSmoothRect
Definition: viewimp.hxx:85
SwLayAction * m_pLayAction
Definition: viewimp.hxx:71
void NotifySizeChg(const Size &rNewSz)
Definition: vdraw.cxx:194
bool IsAccessible() const
Is this view accessible?
Definition: viewimp.hxx:225
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
Definition: viewimp.cxx:308
void MakeDrawView()
Definition: viewimp.cxx:233
void DeletePaintRegion()
Definition: viewimp.hxx:154
sal_uInt16 m_nRestoreActions
Definition: viewimp.hxx:84
void SetFirstVisPageInvalid()
Definition: viewimp.hxx:148
const SwRegionRects * GetPaintRegion()
Definition: viewimp.hxx:153
const SdrPageView * GetPageView() const
Definition: viewimp.hxx:164
void PaintLayer(const SdrLayerID _nLayerID, SwPrintData const *const pPrintData, SwPageFrame const &rPageFrame, const SwRect &_rRect, const Color *_pPageBackgrdColor, const bool _bIsPageRightToLeft, sdr::contact::ViewObjectContactRedirector *pRedirector)
Definition: vdraw.cxx:90
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
Definition: viewimp.hxx:290
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewimp.hxx:214
std::unique_ptr< SwRegionRects > m_pPaintRegion
Definition: viewimp.hxx:67
bool m_bStopSmooth
Definition: viewimp.hxx:82
void UnlockPaint()
Definition: vdraw.cxx:84
void UpdateAccessiblePreview(const std::vector< std::unique_ptr< PreviewPage >> &_rPreviewPages, const Fraction &_rScale, const SwPageFrame *_pSelectedPageFrame, const Size &_rPreviewWinSize)
update data for accessible preview change method signature due to new page preview functionality ...
Definition: viewimp.cxx:466
void CheckWaitCursor()
If an Action is running we ask it to check whether it's time to enable the WaitCursor.
Definition: viewimp.cxx:176
std::vector< SwRect > m_pendingLOKInvalidations
Definition: viewimp.hxx:69
bool IsIdleAction() const
Definition: viewimp.hxx:194
const SwViewShell * GetShell() const
Only for SwViewShell::Init()
Definition: viewimp.hxx:140
bool m_bResetHdlHiddenPaint
Definition: viewimp.hxx:80
std::unique_ptr< SwRegionRects > TakePaintRegion()
Definition: viewimp.hxx:152
SdrPageView * m_pSdrPageView
Definition: viewimp.hxx:64
page preview functionality in the writer
void Init(const SwViewOption *)
Definition: viewimp.cxx:40
void MoveAccessibleFrame(const SwFrame *pFrame, const SwRect &rOldFrame)
Definition: viewimp.hxx:295
The usage of LayAction is always the same:
Definition: layact.hxx:55
bool IsCalcLayoutProgress() const
Asks the LayAction if present.
Definition: viewimp.cxx:182
std::shared_ptr< SwAccessibleMap > m_pAccessibleMap
note: the map is uniquely owned here - the shared_ptr is only used so that SwAccessibleContext can ch...
Definition: viewimp.hxx:77
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
Definition: viewimp.hxx:193
void StartAction()
Definition: vdraw.cxx:51
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewimp.hxx:219
const SwDrawView * GetDrawView() const
Definition: viewimp.hxx:162
bool IsUpdateExpFields()
Definition: viewimp.cxx:187
A page of the document layout.
Definition: pagefrm.hxx:57
SwViewShell * GetShell()
Definition: viewimp.hxx:141
void AddPendingLOKInvalidation(const SwRect &rRect)
Definition: viewimp.cxx:161
void EndAction()
Definition: vdraw.cxx:61
bool m_bSmoothUpdate
Definition: viewimp.hxx:81
SwAccessibleMap * CreateAccessibleMap()
Definition: viewimp.cxx:482
void UpdateAccessible()
Update (this) accessible view.
Definition: viewimp.cxx:323
std::unique_ptr< SwDrawView > m_pDrawView
Definition: viewimp.hxx:63
SwPageFrame * m_pFirstVisiblePage
Definition: viewimp.hxx:66
SwLayAction & GetLayAction()
Definition: viewimp.hxx:195
SwDrawView * GetDrawView()
Definition: viewimp.hxx:161
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
SwViewShell * m_pShell
Definition: viewimp.hxx:60
Color GetRetoucheColor() const
Definition: viewimp.cxx:283
void LockPaint()
Definition: vdraw.cxx:71
bool HasDrawView() const
New Interface for StarView Drawing.
Definition: viewimp.hxx:160
void InvalidateAccessibleParaFlowRelation_(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewimp.cxx:415
std::unique_ptr< SwPagePreviewLayout > m_pPagePreviewLayout
Definition: viewimp.hxx:87
void InvalidateAccessibleEditableState(bool bAllShells, const SwFrame *pFrame=nullptr)
Invalidate editable state for all accessible frames.
Definition: viewimp.cxx:386
SwLayIdle * m_pIdleAct
Definition: viewimp.hxx:73
bool AddPaintRect(const SwRect &rRect)
Definition: viewimp.cxx:116
sal_uInt16 GetRestoreActions() const
Definition: viewimp.hxx:215
void SetFirstVisPage(OutputDevice const *pRenderContext)
Definition: viewimp.cxx:197
bool IsDragPossible(const Point &rPoint)
Is passed to the DrawEngine as a Link and decides what is painted or not and in what way...
Definition: vdraw.cxx:165
void InvalidateAccessiblePreviewSelection(sal_uInt16 nSelPage)
Definition: viewimp.cxx:476
void MoveAccessible(const SwFrame *pFrame, const SdrObject *pObj, const SwRect &rOldFrame)
Move a frame's position in the accessible view.
Definition: viewimp.cxx:358
SdrPageView * GetPageView()
Definition: viewimp.hxx:163
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
Definition: viewimp.hxx:284
void InitPagePreviewLayout()
Definition: viewimp.cxx:316
std::vector< SwRect > TakePendingLOKInvalidations()
Definition: viewimp.cxx:169
void InvalidateAccessibleParaTextSelection_()
invalidate text selection for paragraphs
Definition: viewimp.cxx:443