android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / inc / OnlineAccessibilityCheck.hxx
blob1e320554f8fcda423dd871b7a207cad63af3938e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 */
11 #pragma once
13 #include "ndindex.hxx"
14 #include "ndtxt.hxx"
15 #include <svl/listener.hxx>
16 #include <vcl/timer.hxx>
17 #include <AccessibilityCheck.hxx>
18 #include <map>
20 struct SwPosition;
21 class SwTextNode;
23 namespace sw
25 /// Contains the node and tracks if the node gets deleted.
26 /// Note: the node needs to extend sw::BroadcastingModify.
27 class WeakNodeContainer final : public SvtListener
29 private:
30 SwNode* m_pNode;
32 public:
33 WeakNodeContainer(SwNode* pNode);
34 ~WeakNodeContainer();
36 /// Is the node still alive or it was deleted?
37 bool isAlive();
39 /// Returns the pointer of the node or nullptr if the node
40 /// got deleted.
41 SwNode* getNode();
44 class OnlineAccessibilityCheck
46 private:
47 std::map<SwNode*, std::unique_ptr<WeakNodeContainer>> m_aNodes;
49 SwDoc& m_rDocument;
50 sw::AccessibilityCheck m_aAccessibilityCheck;
51 std::unique_ptr<WeakNodeContainer> m_pPreviousNode;
52 SwNodeOffset m_nPreviousNodeIndex;
53 sal_Int32 m_nAccessibilityIssues;
54 bool m_bInitialCheck;
55 bool m_bOnlineCheckStatus;
56 std::unique_ptr<sfx::AccessibilityIssueCollection> m_pDocumentAccessibilityIssues;
58 void runAccessibilityCheck(SwNode* pNode);
59 void updateStatusbar();
60 void updateNodeStatus(SwNode* pContentNode, bool bIssueObjectNameChanged = false);
61 void initialCheck();
62 void lookForPreviousNodeAndUpdate(SwPosition const& rNewPos);
63 void clearAccessibilityIssuesFromAllNodes();
64 void runDocumentLevelAccessibilityCheck();
66 public:
67 OnlineAccessibilityCheck(SwDoc& rDocument);
68 void update(SwPosition const& rNewPos);
69 void resetAndQueue(SwNode* pNode, bool bIssueObjectNameChanged = false);
70 void resetAndQueueDocumentLevel();
71 void updateCheckerActivity();
72 sal_Int32 getNumberOfAccessibilityIssues() { return m_nAccessibilityIssues; }
73 sal_Int32 getNumberOfDocumentLevelAccessibilityIssues()
75 return m_pDocumentAccessibilityIssues ? m_pDocumentAccessibilityIssues->getIssues().size()
76 : sal_Int32(0);
80 } // end sw
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */