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 <memory>
27#include <optional>
28#include <vector>
29
30class OutputDevice;
31class SwViewShell;
32class SwFlyFrame;
33class SwViewOption;
34class SwFrame;
35class SwLayAction;
36class SwLayIdle;
37class SwDrawView;
38class SdrPageView;
39class SwPageFrame;
40class SwAccessibleMap;
41class SdrObject;
42class Fraction;
43class SwPrintData;
45struct PreviewPage;
46class SwTextFrame;
47// --> OD #i76669#
48namespace sdr::contact { class ViewObjectContactRedirector; }
49// <--
50
52{
53 friend class SwViewShell;
54
55 friend class SwLayAction; // Lay- and IdleAction register and deregister
56 friend class SwLayIdle;
57
58 // for paint of page preview
59 friend class SwPagePreviewLayout;
60
61 SwViewShell *m_pShell; // If someone passes an Imp, but needs a SwViewShell, we
62 // keep a backlink here
63
64 std::unique_ptr<SwDrawView> m_pDrawView; // Our DrawView
65 SdrPageView *m_pSdrPageView; // Exactly one Page for our DrawView
66
67 SwPageFrame *m_pFirstVisiblePage; // Always points to the first visible Page
68 std::optional<SwRegionRects> m_oPaintRegion; // Collector of Paintrects from the LayAction
69
70 std::vector<SwRect> m_pendingLOKInvalidations;
71
72 SwLayAction *m_pLayAction; // Is set if an Action object exists
73 // Is registered by the SwLayAction ctor and deregistered by the dtor
74 SwLayIdle *m_pIdleAct; // The same as SwLayAction for SwLayIdle
75
78 std::shared_ptr<SwAccessibleMap> m_pAccessibleMap;
79
80 bool m_bFirstPageInvalid : 1; // Pointer to the first Page invalid?
81 bool m_bResetHdlHiddenPaint : 1; // Ditto
82 bool m_bSmoothUpdate : 1; // For SmoothScroll
83 bool m_bStopSmooth : 1;
84
85 sal_uInt16 m_nRestoreActions ; // Count for the Action that need to be restored (UNO)
87
88 std::unique_ptr<SwPagePreviewLayout> m_pPagePreviewLayout;
89
90 void SetFirstVisPage(OutputDevice const * pRenderContext); // Recalculate the first visible Page
91
92 void StartAction(); // Show handle and hide
93 void EndAction(); // Called by SwViewShell::ImplXXXAction
94 void LockPaint(); // Ditto; called by SwViewShell::ImplLockPaint
95 void UnlockPaint();
96
97private:
98
100
117 void InvalidateAccessibleParaFlowRelation_( const SwTextFrame* _pFromTextFrame,
118 const SwTextFrame* _pToTextFrame );
119
127
134 void InvalidateAccessibleParaAttrs_( const SwTextFrame& rTextFrame );
135
136public:
139 void Init( const SwViewOption * );
140
141 const SwViewShell *GetShell() const { return m_pShell; }
143
144 Color GetRetoucheColor() const;
145
147 const SwPageFrame *GetFirstVisPage(OutputDevice const * pRenderContext) const;
148 SwPageFrame *GetFirstVisPage(OutputDevice const * pRenderContext);
150
151 const SwPageFrame* GetLastVisPage(const OutputDevice* pRenderContext) const;
152
153 bool AddPaintRect( const SwRect &rRect );
154 bool HasPaintRegion() { return m_oPaintRegion.has_value(); }
155 std::optional<SwRegionRects> TakePaintRegion() { auto ret = std::move(m_oPaintRegion); m_oPaintRegion.reset(); return ret; }
156 const std::optional<SwRegionRects>& GetPaintRegion() { return m_oPaintRegion; }
158
159 void AddPendingLOKInvalidation( const SwRect& rRect );
160 std::vector<SwRect> TakePendingLOKInvalidations();
161
163 bool HasDrawView() const { return nullptr != m_pDrawView; }
164 SwDrawView* GetDrawView() { return m_pDrawView.get(); }
165 const SwDrawView* GetDrawView() const { return m_pDrawView.get(); }
167 const SdrPageView*GetPageView() const { return m_pSdrPageView; }
168 void MakeDrawView();
169
178 void PaintLayer( const SdrLayerID _nLayerID,
179 SwPrintData const*const pPrintData,
180 SwPageFrame const& rPageFrame,
181 const SwRect& _rRect,
182 const Color* _pPageBackgrdColor,
183 const bool _bIsPageRightToLeft,
185
191 // Interface Drawing
192 bool IsDragPossible( const Point &rPoint );
193 void NotifySizeChg( const Size &rNewSz );
194
196 bool IsAction() const { return m_pLayAction != nullptr; }
197 bool IsIdleAction() const { return m_pIdleAct != nullptr; }
199 const SwLayAction &GetLayAction() const { return *m_pLayAction; }
200
205 void CheckWaitCursor();
206
208 bool IsCalcLayoutProgress() const;
209
215 bool IsUpdateExpFields();
216
217 void SetRestoreActions(sal_uInt16 nSet){m_nRestoreActions = nSet;}
218 sal_uInt16 GetRestoreActions() const{return m_nRestoreActions;}
219
221
223 {
224 return m_pPagePreviewLayout.get();
225 }
226
228 bool IsAccessible() const { return m_pAccessibleMap != nullptr; }
229
231
233 void UpdateAccessible();
234
236 void DisposeAccessible( const SwFrame *pFrame, const SdrObject *pObj,
237 bool bRecursive, bool bCanSkipInvisible );
238 inline void DisposeAccessibleFrame( const SwFrame *pFrame,
239 bool bRecursive = false );
240 inline void DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible );
241
243 void MoveAccessible( const SwFrame *pFrame, const SdrObject *pObj,
244 const SwRect& rOldFrame );
245 inline void MoveAccessibleFrame( const SwFrame *pFrame, const SwRect& rOldFrame );
246
248 inline void AddAccessibleFrame( const SwFrame *pFrame );
249
250 inline void AddAccessibleObj( const SdrObject *pObj );
251
253 void InvalidateAccessibleFrameContent( const SwFrame *pFrame );
254
256 void InvalidateAccessibleCursorPosition( const SwFrame *pFrame );
257
259 void InvalidateAccessibleEditableState( bool bAllShells,
260 const SwFrame *pFrame=nullptr );
261
263 void InvalidateAccessibleRelationSet( const SwFlyFrame *pMaster,
264 const SwFlyFrame *pFollow );
265
268 void UpdateAccessiblePreview( const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
269 const Fraction& _rScale,
270 const SwPageFrame* _pSelectedPageFrame,
271 const Size& _rPreviewWinSize );
272
273 void InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage );
274
277};
278
280{
281 if( !m_pAccessibleMap )
283
284 return *m_pAccessibleMap;
285}
286
288 bool bRecursive )
289{
290 DisposeAccessible( pFrame, nullptr, bRecursive, true );
291}
292
293inline void SwViewShellImp::DisposeAccessibleObj( const SdrObject *pObj, bool bCanSkipInvisible )
294{
295 DisposeAccessible( nullptr, pObj, false, bCanSkipInvisible );
296}
297
299 const SwRect& rOldFrame )
300{
301 MoveAccessible( pFrame, nullptr, rOldFrame );
302}
303
304inline void SwViewShellImp::AddAccessibleFrame( const SwFrame *pFrame )
305{
306 SwRect aEmptyRect;
307 MoveAccessible( pFrame, nullptr, aEmptyRect );
308}
309
311{
312 SwRect aEmptyRect;
313 MoveAccessible( nullptr, pObj, aEmptyRect );
314}
315#endif // INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
316
317/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
Base class of the Writer layout elements.
Definition: frame.hxx:315
The usage of LayAction is always the same:
Definition: layact.hxx:59
A page of the document layout.
Definition: pagefrm.hxx:60
page preview functionality in the writer
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
void MakeDrawView()
Definition: viewimp.cxx:240
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
Definition: viewimp.hxx:287
void InvalidateAccessibleEditableState(bool bAllShells, const SwFrame *pFrame=nullptr)
Invalidate editable state for all accessible frames.
Definition: viewimp.cxx:418
const std::optional< SwRegionRects > & GetPaintRegion()
Definition: viewimp.hxx:156
void UpdateAccessible()
Update (this) accessible view.
Definition: viewimp.cxx:355
void CheckWaitCursor()
If an Action is running we ask it to check whether it's time to enable the WaitCursor.
Definition: viewimp.cxx:183
SwPageFrame * m_pFirstVisiblePage
Definition: viewimp.hxx:67
Color GetRetoucheColor() const
Definition: viewimp.cxx:290
SwLayAction * m_pLayAction
Definition: viewimp.hxx:72
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:498
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
Definition: viewimp.cxx:315
bool IsIdleAction() const
Definition: viewimp.hxx:197
bool m_bResetHdlHiddenPaint
Definition: viewimp.hxx:81
bool HasPaintRegion()
Definition: viewimp.hxx:154
bool HasDrawView() const
New Interface for StarView Drawing.
Definition: viewimp.hxx:163
bool AddPaintRect(const SwRect &rRect)
Definition: viewimp.cxx:120
void InvalidateAccessibleCursorPosition(const SwFrame *pFrame)
Invalidate accessible frame's cursor position.
Definition: viewimp.cxx:412
void InvalidateAccessiblePreviewSelection(sal_uInt16 nSelPage)
Definition: viewimp.cxx:508
void SetFirstVisPageInvalid()
Definition: viewimp.hxx:149
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewimp.hxx:217
void AddAccessibleObj(const SdrObject *pObj)
Definition: viewimp.hxx:310
SwRect m_aSmoothRect
Definition: viewimp.hxx:86
void InvalidateAccessibleParaFlowRelation_(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewimp.cxx:447
std::optional< SwRegionRects > TakePaintRegion()
Definition: viewimp.hxx:155
bool IsUpdateExpFields()
Definition: viewimp.cxx:194
SwAccessibleMap & GetAccessibleMap()
Definition: viewimp.hxx:279
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
Definition: viewimp.hxx:196
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
Definition: viewimp.hxx:304
void LockPaint()
Definition: vdraw.cxx:69
void StartAction()
Definition: vdraw.cxx:49
std::unique_ptr< SwDrawView > m_pDrawView
Definition: viewimp.hxx:64
void InitPagePreviewLayout()
Definition: viewimp.cxx:347
const SdrPageView * GetPageView() const
Definition: viewimp.hxx:167
const SwLayAction & GetLayAction() const
Definition: viewimp.hxx:199
void UnlockPaint()
Definition: vdraw.cxx:82
void InvalidateAccessibleFrameContent(const SwFrame *pFrame)
Invalidate accessible frame's content.
Definition: viewimp.cxx:402
void DeletePaintRegion()
Definition: viewimp.hxx:157
void DisposeAccessible(const SwFrame *pFrame, const SdrObject *pObj, bool bRecursive, bool bCanSkipInvisible)
Remove a frame from the accessible view.
Definition: viewimp.cxx:377
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
const SwDrawView * GetDrawView() const
Definition: viewimp.hxx:165
void InvalidateAccessibleRelationSet(const SwFlyFrame *pMaster, const SwFlyFrame *pFollow)
Invalidate frame's relation set (for chained frames)
Definition: viewimp.cxx:435
sal_uInt16 m_nRestoreActions
Definition: viewimp.hxx:85
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:78
bool m_bSmoothUpdate
Definition: viewimp.hxx:82
std::unique_ptr< SwPagePreviewLayout > m_pPagePreviewLayout
Definition: viewimp.hxx:88
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
Definition: viewimp.hxx:293
bool m_bFirstPageInvalid
Definition: viewimp.hxx:80
void EndAction()
Definition: vdraw.cxx:59
void InvalidateAccessibleParaTextSelection_()
invalidate text selection for paragraphs
Definition: viewimp.cxx:475
sal_uInt16 GetRestoreActions() const
Definition: viewimp.hxx:218
SwLayAction & GetLayAction()
Definition: viewimp.hxx:198
SwViewShell * m_pShell
Definition: viewimp.hxx:61
SdrPageView * m_pSdrPageView
Definition: viewimp.hxx:65
void SetFirstVisPage(OutputDevice const *pRenderContext)
Definition: viewimp.cxx:204
std::optional< SwRegionRects > m_oPaintRegion
Definition: viewimp.hxx:68
void AddPendingLOKInvalidation(const SwRect &rRect)
Definition: viewimp.cxx:166
std::vector< SwRect > TakePendingLOKInvalidations()
Definition: viewimp.cxx:176
SwDrawView * GetDrawView()
Definition: viewimp.hxx:164
void MoveAccessibleFrame(const SwFrame *pFrame, const SwRect &rOldFrame)
Definition: viewimp.hxx:298
void Init(const SwViewOption *)
Definition: viewimp.cxx:42
SdrPageView * GetPageView()
Definition: viewimp.hxx:166
const SwPageFrame * GetLastVisPage(const OutputDevice *pRenderContext) const
Definition: viewimp.cxx:322
SwViewShellImp(SwViewShell *)
CTor for the core internals.
Definition: viewimp.cxx:86
const SwViewShell * GetShell() const
Only for SwViewShell::Init()
Definition: viewimp.hxx:141
bool IsCalcLayoutProgress() const
Asks the LayAction if present.
Definition: viewimp.cxx:189
std::vector< SwRect > m_pendingLOKInvalidations
Definition: viewimp.hxx:70
SwViewShell * GetShell()
Definition: viewimp.hxx:142
void InvalidateAccessibleParaAttrs_(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewimp.cxx:487
void FireAccessibleEvents()
Fire all accessible events that have been collected so far.
Definition: viewimp.cxx:521
SwAccessibleMap * CreateAccessibleMap()
Definition: viewimp.cxx:514
bool IsAccessible() const
Is this view accessible?
Definition: viewimp.hxx:228
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 NotifySizeChg(const Size &rNewSz)
Definition: vdraw.cxx:192
void MoveAccessible(const SwFrame *pFrame, const SdrObject *pObj, const SwRect &rOldFrame)
Move a frame's position in the accessible view.
Definition: viewimp.cxx:390
SwLayIdle * m_pIdleAct
Definition: viewimp.hxx:74
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewimp.hxx:222
bool m_bStopSmooth
Definition: viewimp.hxx:83
data structure for a preview page in the current preview layout
Definition: prevwpage.hxx:31