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::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_pRegion; // Collector of Paintrects from the LayAction
68 
69  SwLayAction *m_pLayAction; // Is set if an Action object exists
70  // Is registered by the SwLayAction ctor and deregistered by the dtor
71  SwLayIdle *m_pIdleAct; // The same as SwLayAction for SwLayIdle
72 
75  std::shared_ptr<SwAccessibleMap> m_pAccessibleMap;
76 
77  bool m_bFirstPageInvalid : 1; // Pointer to the first Page invalid?
78  bool m_bResetHdlHiddenPaint : 1; // Ditto
79  bool m_bSmoothUpdate : 1; // For SmoothScroll
80  bool m_bStopSmooth : 1;
81 
82  sal_uInt16 m_nRestoreActions ; // Count for the Action that need to be restored (UNO)
84 
85  std::unique_ptr<SwPagePreviewLayout> m_pPagePreviewLayout;
86 
87  void SetFirstVisPage(OutputDevice const * pRenderContext); // Recalculate the first visible Page
88 
89  void StartAction(); // Show handle and hide
90  void EndAction(); // Called by SwViewShell::ImplXXXAction
91  void LockPaint(); // Ditto; called by SwViewShell::ImplLockPaint
92  void UnlockPaint();
93 
94 private:
95 
97 
114  void InvalidateAccessibleParaFlowRelation_( const SwTextFrame* _pFromTextFrame,
115  const SwTextFrame* _pToTextFrame );
116 
124 
131  void InvalidateAccessibleParaAttrs_( const SwTextFrame& rTextFrame );
132 
133 public:
135  ~SwViewShellImp();
136  void Init( const SwViewOption * );
137 
138  const SwViewShell *GetShell() const { return m_pShell; }
140 
141  Color GetRetoucheColor() const;
142 
144  const SwPageFrame *GetFirstVisPage(OutputDevice const * pRenderContext) const;
145  SwPageFrame *GetFirstVisPage(OutputDevice const * pRenderContext);
147 
148  bool AddPaintRect( const SwRect &rRect );
149  SwRegionRects *GetRegion() { return m_pRegion.get(); }
150  void DelRegion();
151 
153  bool HasDrawView() const { return nullptr != m_pDrawView; }
154  SwDrawView* GetDrawView() { return m_pDrawView.get(); }
155  const SwDrawView* GetDrawView() const { return m_pDrawView.get(); }
157  const SdrPageView*GetPageView() const { return m_pSdrPageView; }
158  void MakeDrawView();
159 
168  void PaintLayer( const SdrLayerID _nLayerID,
169  SwPrintData const*const pPrintData,
170  SwPageFrame const& rPageFrame,
171  const SwRect& _rRect,
172  const Color* _pPageBackgrdColor,
173  const bool _bIsPageRightToLeft,
175 
181  // Interface Drawing
182  bool IsDragPossible( const Point &rPoint );
183  void NotifySizeChg( const Size &rNewSz );
184 
186  bool IsAction() const { return m_pLayAction != nullptr; }
187  bool IsIdleAction() const { return m_pIdleAct != nullptr; }
189  const SwLayAction &GetLayAction() const { return *m_pLayAction; }
190 
195  void CheckWaitCursor();
196 
198  bool IsCalcLayoutProgress() const;
199 
205  bool IsUpdateExpFields();
206 
207  void SetRestoreActions(sal_uInt16 nSet){m_nRestoreActions = nSet;}
208  sal_uInt16 GetRestoreActions() const{return m_nRestoreActions;}
209 
210  void InitPagePreviewLayout();
211 
213  {
214  return m_pPagePreviewLayout.get();
215  }
216 
218  bool IsAccessible() const { return m_pAccessibleMap != nullptr; }
219 
221 
223  void UpdateAccessible();
224 
226  void DisposeAccessible( const SwFrame *pFrame, const SdrObject *pObj,
227  bool bRecursive, bool bCanSkipInvisible );
228  inline void DisposeAccessibleFrame( const SwFrame *pFrame,
229  bool bRecursive = false );
230  inline void DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible );
231 
233  void MoveAccessible( const SwFrame *pFrame, const SdrObject *pObj,
234  const SwRect& rOldFrame );
235  inline void MoveAccessibleFrame( const SwFrame *pFrame, const SwRect& rOldFrame );
236 
238  inline void AddAccessibleFrame( const SwFrame *pFrame );
239 
240  inline void AddAccessibleObj( const SdrObject *pObj );
241 
243  void InvalidateAccessibleFrameContent( const SwFrame *pFrame );
244 
246  void InvalidateAccessibleCursorPosition( const SwFrame *pFrame );
247 
249  void InvalidateAccessibleEditableState( bool bAllShells,
250  const SwFrame *pFrame=nullptr );
251 
253  void InvalidateAccessibleRelationSet( const SwFlyFrame *pMaster,
254  const SwFlyFrame *pFollow );
255 
258  void UpdateAccessiblePreview( const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
259  const Fraction& _rScale,
260  const SwPageFrame* _pSelectedPageFrame,
261  const Size& _rPreviewWinSize );
262 
263  void InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage );
264 
266  void FireAccessibleEvents();
267 };
268 
270 {
271  if( !m_pAccessibleMap )
273 
274  return *m_pAccessibleMap;
275 }
276 
278  bool bRecursive )
279 {
280  DisposeAccessible( pFrame, nullptr, bRecursive, true );
281 }
282 
283 inline void SwViewShellImp::DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible )
284 {
285  DisposeAccessible( nullptr, pObj, false, bCanSkipInvisible );
286 }
287 
288 inline void SwViewShellImp::MoveAccessibleFrame( const SwFrame *pFrame,
289  const SwRect& rOldFrame )
290 {
291  MoveAccessible( pFrame, nullptr, rOldFrame );
292 }
293 
294 inline void SwViewShellImp::AddAccessibleFrame( const SwFrame *pFrame )
295 {
296  SwRect aEmptyRect;
297  MoveAccessible( pFrame, nullptr, aEmptyRect );
298 }
299 
300 inline void SwViewShellImp::AddAccessibleObj( const SdrObject *pObj )
301 {
302  SwRect aEmptyRect;
303  MoveAccessible( nullptr, pObj, aEmptyRect );
304 }
305 #endif // INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
306 
307 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bFirstPageInvalid
Definition: viewimp.hxx:77
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:297
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
void InvalidateAccessibleFrameContent(const SwFrame *pFrame)
Invalidate accessible frame's content.
Definition: viewimp.cxx:332
void FireAccessibleEvents()
Fire all accessible events that have been collected so far.
Definition: viewimp.cxx:451
void DelRegion()
Definition: viewimp.cxx:116
void InvalidateAccessibleCursorPosition(const SwFrame *pFrame)
Invalidate accessible frame's cursor position.
Definition: viewimp.cxx:342
void InvalidateAccessibleRelationSet(const SwFlyFrame *pMaster, const SwFlyFrame *pFollow)
Invalidate frame's relation set (for chained frames)
Definition: viewimp.cxx:365
const SwLayAction & GetLayAction() const
Definition: viewimp.hxx:189
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
Definition: viewimp.hxx:294
void DisposeAccessible(const SwFrame *pFrame, const SdrObject *pObj, bool bRecursive, bool bCanSkipInvisible)
Remove a frame from the accessible view.
Definition: viewimp.cxx:307
void InvalidateAccessibleParaAttrs_(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewimp.cxx:417
void AddAccessibleObj(const SdrObject *pObj)
Definition: viewimp.hxx:300
SwAccessibleMap & GetAccessibleMap()
Definition: viewimp.hxx:269
SwViewShellImp(SwViewShell *)
CTor for the core internals.
Definition: viewimp.cxx:84
SwRect m_aSmoothRect
Definition: viewimp.hxx:83
SwLayAction * m_pLayAction
Definition: viewimp.hxx:69
void NotifySizeChg(const Size &rNewSz)
Definition: vdraw.cxx:192
bool IsAccessible() const
Is this view accessible?
Definition: viewimp.hxx:218
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
Definition: viewimp.cxx:270
void MakeDrawView()
Definition: viewimp.cxx:196
sal_uInt16 m_nRestoreActions
Definition: viewimp.hxx:82
void SetFirstVisPageInvalid()
Definition: viewimp.hxx:146
const SdrPageView * GetPageView() const
Definition: viewimp.hxx:157
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:88
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
Definition: viewimp.hxx:283
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewimp.hxx:207
bool m_bStopSmooth
Definition: viewimp.hxx:80
void UnlockPaint()
Definition: vdraw.cxx:82
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:428
void CheckWaitCursor()
If an Action is running we ask it to check whether it's time to enable the WaitCursor.
Definition: viewimp.cxx:139
bool IsIdleAction() const
Definition: viewimp.hxx:187
const SwViewShell * GetShell() const
Only for SwViewShell::Init()
Definition: viewimp.hxx:138
bool m_bResetHdlHiddenPaint
Definition: viewimp.hxx:78
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:288
The usage of LayAction is always the same:
Definition: layact.hxx:56
bool IsCalcLayoutProgress() const
Asks the LayAction if present.
Definition: viewimp.cxx:145
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:75
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
Definition: viewimp.hxx:186
void StartAction()
Definition: vdraw.cxx:49
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewimp.hxx:212
const SwDrawView * GetDrawView() const
Definition: viewimp.hxx:155
bool IsUpdateExpFields()
Definition: viewimp.cxx:150
A page of the document layout.
Definition: pagefrm.hxx:41
SwViewShell * GetShell()
Definition: viewimp.hxx:139
void EndAction()
Definition: vdraw.cxx:59
bool m_bSmoothUpdate
Definition: viewimp.hxx:79
SwAccessibleMap * CreateAccessibleMap()
Definition: viewimp.cxx:444
void UpdateAccessible()
Update (this) accessible view.
Definition: viewimp.cxx:285
std::unique_ptr< SwDrawView > m_pDrawView
Definition: viewimp.hxx:63
SwPageFrame * m_pFirstVisiblePage
Definition: viewimp.hxx:66
SwLayAction & GetLayAction()
Definition: viewimp.hxx:188
SwDrawView * GetDrawView()
Definition: viewimp.hxx:154
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
SwViewShell * m_pShell
Definition: viewimp.hxx:60
Color GetRetoucheColor() const
Definition: viewimp.cxx:245
void LockPaint()
Definition: vdraw.cxx:69
bool HasDrawView() const
New Interface for StarView Drawing.
Definition: viewimp.hxx:153
void InvalidateAccessibleParaFlowRelation_(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewimp.cxx:377
std::unique_ptr< SwPagePreviewLayout > m_pPagePreviewLayout
Definition: viewimp.hxx:85
void InvalidateAccessibleEditableState(bool bAllShells, const SwFrame *pFrame=nullptr)
Invalidate editable state for all accessible frames.
Definition: viewimp.cxx:348
SwLayIdle * m_pIdleAct
Definition: viewimp.hxx:71
SwRegionRects * GetRegion()
Definition: viewimp.hxx:149
bool AddPaintRect(const SwRect &rRect)
Definition: viewimp.cxx:121
sal_uInt16 GetRestoreActions() const
Definition: viewimp.hxx:208
void SetFirstVisPage(OutputDevice const *pRenderContext)
Definition: viewimp.cxx:160
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:163
std::unique_ptr< SwRegionRects > m_pRegion
Definition: viewimp.hxx:67
void InvalidateAccessiblePreviewSelection(sal_uInt16 nSelPage)
Definition: viewimp.cxx:438
void MoveAccessible(const SwFrame *pFrame, const SdrObject *pObj, const SwRect &rOldFrame)
Move a frame's position in the accessible view.
Definition: viewimp.cxx:320
SdrPageView * GetPageView()
Definition: viewimp.hxx:156
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
Definition: viewimp.hxx:277
void InitPagePreviewLayout()
Definition: viewimp.cxx:278
void InvalidateAccessibleParaTextSelection_()
invalidate text selection for paragraphs
Definition: viewimp.cxx:405