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 <vector>
26 #include <memory>
27 
28 class OutputDevice;
29 class SwViewShell;
30 class SwFlyFrame;
31 class SwViewOption;
32 class SwRegionRects;
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 { namespace contact {
48  class ViewObjectContactRedirector;
49 } }
50 // <--
51 
53 {
54  friend class SwViewShell;
55 
56  friend class SwLayAction; // Lay- and IdleAction register and deregister
57  friend class SwLayIdle;
58 
59  // for paint of page preview
60  friend class SwPagePreviewLayout;
61 
62  SwViewShell *m_pShell; // If someone passes an Imp, but needs a SwViewShell, we
63  // keep a backlink here
64 
65  std::unique_ptr<SwDrawView> m_pDrawView; // Our DrawView
66  SdrPageView *m_pSdrPageView; // Exactly one Page for our DrawView
67 
68  SwPageFrame *m_pFirstVisiblePage; // Always points to the first visible Page
69  std::unique_ptr<SwRegionRects> m_pRegion; // Collector of Paintrects from the LayAction
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  SwRegionRects *GetRegion() { return m_pRegion.get(); }
152  void DelRegion();
153 
155  bool HasDrawView() const { return nullptr != m_pDrawView; }
156  SwDrawView* GetDrawView() { return m_pDrawView.get(); }
157  const SwDrawView* GetDrawView() const { return m_pDrawView.get(); }
159  const SdrPageView*GetPageView() const { return m_pSdrPageView; }
160  void MakeDrawView();
161 
170  void PaintLayer( const SdrLayerID _nLayerID,
171  SwPrintData const*const pPrintData,
172  SwPageFrame const& rPageFrame,
173  const SwRect& _rRect,
174  const Color* _pPageBackgrdColor,
175  const bool _bIsPageRightToLeft,
177 
183  // Interface Drawing
184  bool IsDragPossible( const Point &rPoint );
185  void NotifySizeChg( const Size &rNewSz );
186 
188  bool IsAction() const { return m_pLayAction != nullptr; }
189  bool IsIdleAction() const { return m_pIdleAct != nullptr; }
191  const SwLayAction &GetLayAction() const { return *m_pLayAction; }
192 
197  void CheckWaitCursor();
198 
200  bool IsCalcLayoutProgress() const;
201 
207  bool IsUpdateExpFields();
208 
209  void SetRestoreActions(sal_uInt16 nSet){m_nRestoreActions = nSet;}
210  sal_uInt16 GetRestoreActions() const{return m_nRestoreActions;}
211 
212  void InitPagePreviewLayout();
213 
215  {
216  return m_pPagePreviewLayout.get();
217  }
218 
220  bool IsAccessible() const { return m_pAccessibleMap != nullptr; }
221 
223 
225  void UpdateAccessible();
226 
228  void DisposeAccessible( const SwFrame *pFrame, const SdrObject *pObj,
229  bool bRecursive, bool bCanSkipInvisible );
230  inline void DisposeAccessibleFrame( const SwFrame *pFrame,
231  bool bRecursive = false );
232  inline void DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible );
233 
235  void MoveAccessible( const SwFrame *pFrame, const SdrObject *pObj,
236  const SwRect& rOldFrame );
237  inline void MoveAccessibleFrame( const SwFrame *pFrame, const SwRect& rOldFrame );
238 
240  inline void AddAccessibleFrame( const SwFrame *pFrame );
241 
242  inline void AddAccessibleObj( const SdrObject *pObj );
243 
245  void InvalidateAccessibleFrameContent( const SwFrame *pFrame );
246 
248  void InvalidateAccessibleCursorPosition( const SwFrame *pFrame );
249 
251  void InvalidateAccessibleEditableState( bool bAllShells,
252  const SwFrame *pFrame=nullptr );
253 
255  void InvalidateAccessibleRelationSet( const SwFlyFrame *pMaster,
256  const SwFlyFrame *pFollow );
257 
260  void UpdateAccessiblePreview( const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
261  const Fraction& _rScale,
262  const SwPageFrame* _pSelectedPageFrame,
263  const Size& _rPreviewWinSize );
264 
265  void InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage );
266 
268  void FireAccessibleEvents();
269 };
270 
272 {
273  if( !m_pAccessibleMap )
275 
276  return *m_pAccessibleMap;
277 }
278 
280  bool bRecursive )
281 {
282  DisposeAccessible( pFrame, nullptr, bRecursive, true );
283 }
284 
285 inline void SwViewShellImp::DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible )
286 {
287  DisposeAccessible( nullptr, pObj, false, bCanSkipInvisible );
288 }
289 
290 inline void SwViewShellImp::MoveAccessibleFrame( const SwFrame *pFrame,
291  const SwRect& rOldFrame )
292 {
293  MoveAccessible( pFrame, nullptr, rOldFrame );
294 }
295 
296 inline void SwViewShellImp::AddAccessibleFrame( const SwFrame *pFrame )
297 {
298  SwRect aEmptyRect;
299  MoveAccessible( pFrame, nullptr, aEmptyRect );
300 }
301 
302 inline void SwViewShellImp::AddAccessibleObj( const SdrObject *pObj )
303 {
304  SwRect aEmptyRect;
305  MoveAccessible( nullptr, pObj, aEmptyRect );
306 }
307 #endif // INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
308 
309 /* 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:295
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
void InvalidateAccessibleFrameContent(const SwFrame *pFrame)
Invalidate accessible frame's content.
Definition: viewimp.cxx:338
void FireAccessibleEvents()
Fire all accessible events that have been collected so far.
Definition: viewimp.cxx:457
void DelRegion()
Definition: viewimp.cxx:122
void InvalidateAccessibleCursorPosition(const SwFrame *pFrame)
Invalidate accessible frame's cursor position.
Definition: viewimp.cxx:348
void InvalidateAccessibleRelationSet(const SwFlyFrame *pMaster, const SwFlyFrame *pFollow)
Invalidate frame's relation set (for chained frames)
Definition: viewimp.cxx:371
const SwLayAction & GetLayAction() const
Definition: viewimp.hxx:191
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
Definition: viewimp.hxx:296
void DisposeAccessible(const SwFrame *pFrame, const SdrObject *pObj, bool bRecursive, bool bCanSkipInvisible)
Remove a frame from the accessible view.
Definition: viewimp.cxx:313
void InvalidateAccessibleParaAttrs_(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewimp.cxx:423
void AddAccessibleObj(const SdrObject *pObj)
Definition: viewimp.hxx:302
SwAccessibleMap & GetAccessibleMap()
Definition: viewimp.hxx:271
SwViewShellImp(SwViewShell *)
CTor for the core internals.
Definition: viewimp.cxx:90
SwRect m_aSmoothRect
Definition: viewimp.hxx:85
SwLayAction * m_pLayAction
Definition: viewimp.hxx:71
void NotifySizeChg(const Size &rNewSz)
Definition: vdraw.cxx:193
bool IsAccessible() const
Is this view accessible?
Definition: viewimp.hxx:220
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:276
void MakeDrawView()
Definition: viewimp.cxx:202
sal_uInt16 m_nRestoreActions
Definition: viewimp.hxx:84
void SetFirstVisPageInvalid()
Definition: viewimp.hxx:148
const SdrPageView * GetPageView() const
Definition: viewimp.hxx:159
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:89
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
Definition: viewimp.hxx:285
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewimp.hxx:209
bool m_bStopSmooth
Definition: viewimp.hxx:82
void UnlockPaint()
Definition: vdraw.cxx:83
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:434
void CheckWaitCursor()
If an Action is running we ask it to check whether it's time to enable the WaitCursor.
Definition: viewimp.cxx:145
bool IsIdleAction() const
Definition: viewimp.hxx:189
const SwViewShell * GetShell() const
Only for SwViewShell::Init()
Definition: viewimp.hxx:140
bool m_bResetHdlHiddenPaint
Definition: viewimp.hxx:80
SdrPageView * m_pSdrPageView
Definition: viewimp.hxx:66
page preview functionality in the writer
void Init(const SwViewOption *)
Definition: viewimp.cxx:46
void MoveAccessibleFrame(const SwFrame *pFrame, const SwRect &rOldFrame)
Definition: viewimp.hxx:290
The usage of LayAction is always the same:
Definition: layact.hxx:55
bool IsCalcLayoutProgress() const
Asks the LayAction if present.
Definition: viewimp.cxx:151
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:188
void StartAction()
Definition: vdraw.cxx:50
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewimp.hxx:214
const SwDrawView * GetDrawView() const
Definition: viewimp.hxx:157
bool IsUpdateExpFields()
Definition: viewimp.cxx:156
A page of the document layout.
Definition: pagefrm.hxx:40
SwViewShell * GetShell()
Definition: viewimp.hxx:141
void EndAction()
Definition: vdraw.cxx:60
bool m_bSmoothUpdate
Definition: viewimp.hxx:81
SwAccessibleMap * CreateAccessibleMap()
Definition: viewimp.cxx:450
void UpdateAccessible()
Update (this) accessible view.
Definition: viewimp.cxx:291
std::unique_ptr< SwDrawView > m_pDrawView
Definition: viewimp.hxx:65
SwPageFrame * m_pFirstVisiblePage
Definition: viewimp.hxx:68
SwLayAction & GetLayAction()
Definition: viewimp.hxx:190
SwDrawView * GetDrawView()
Definition: viewimp.hxx:156
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
SwViewShell * m_pShell
Definition: viewimp.hxx:62
Color GetRetoucheColor() const
Definition: viewimp.cxx:251
void LockPaint()
Definition: vdraw.cxx:70
bool HasDrawView() const
New Interface for StarView Drawing.
Definition: viewimp.hxx:155
void InvalidateAccessibleParaFlowRelation_(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewimp.cxx:383
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:354
SwLayIdle * m_pIdleAct
Definition: viewimp.hxx:73
SwRegionRects * GetRegion()
Definition: viewimp.hxx:151
bool AddPaintRect(const SwRect &rRect)
Definition: viewimp.cxx:127
sal_uInt16 GetRestoreActions() const
Definition: viewimp.hxx:210
void SetFirstVisPage(OutputDevice const *pRenderContext)
Definition: viewimp.cxx:166
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:164
std::unique_ptr< SwRegionRects > m_pRegion
Definition: viewimp.hxx:69
void InvalidateAccessiblePreviewSelection(sal_uInt16 nSelPage)
Definition: viewimp.cxx:444
void MoveAccessible(const SwFrame *pFrame, const SdrObject *pObj, const SwRect &rOldFrame)
Move a frame's position in the accessible view.
Definition: viewimp.cxx:326
SdrPageView * GetPageView()
Definition: viewimp.hxx:158
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
Definition: viewimp.hxx:279
void InitPagePreviewLayout()
Definition: viewimp.cxx:284
void InvalidateAccessibleParaTextSelection_()
invalidate text selection for paragraphs
Definition: viewimp.cxx:411