LibreOffice Module sw (master)  1
AccessibilityIssue.cxx
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  */
10 
11 #include <AccessibilityIssue.hxx>
12 #include <wrtsh.hxx>
13 #include <docsh.hxx>
14 #include <comphelper/lok.hxx>
15 
16 namespace sw
17 {
19  : sfx::AccessibilityIssue(eIssueID)
20  , m_eIssueObject(IssueObject::UNKNOWN)
21  , m_pDoc(nullptr)
22  , m_pNode(nullptr)
23  , m_nStart(0)
24  , m_nEnd(0)
25 {
26 }
27 
28 void AccessibilityIssue::setIssueObject(IssueObject eIssueObject) { m_eIssueObject = eIssueObject; }
29 
30 void AccessibilityIssue::setDoc(SwDoc& rDoc) { m_pDoc = &rDoc; }
31 
32 void AccessibilityIssue::setObjectID(OUString const& rID) { m_sObjectID = rID; }
33 
35 {
37  return true;
38  return false;
39 }
40 
42 {
43  if (!m_pDoc)
44  return;
45 
46  switch (m_eIssueObject)
47  {
49  case IssueObject::OLE:
50  {
51  SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
52  pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, true);
54  pWrtShell->ShowCursor();
55  }
56  break;
57  case IssueObject::TABLE:
58  {
59  SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
60  pWrtShell->GotoTable(m_sObjectID);
62  pWrtShell->ShowCursor();
63  }
64  break;
65  case IssueObject::TEXT:
66  {
67  SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
68  SwContentNode* pContentNode = m_pNode->GetContentNode();
69  SwPosition aPoint(*pContentNode, m_nStart);
70  SwPosition aMark(*pContentNode, m_nEnd);
71  pWrtShell->EnterStdMode();
72  pWrtShell->StartAllAction();
73  SwPaM* pPaM = pWrtShell->GetCursor();
74  *pPaM->GetPoint() = aPoint;
75  pPaM->SetMark();
76  *pPaM->GetMark() = aMark;
77  pWrtShell->EndAllAction();
79  pWrtShell->ShowCursor();
80  }
81  break;
82  default:
83  break;
84  }
85 }
86 
87 } // end sw namespace
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Marks a position in the document model.
Definition: pam.hxx:36
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
const SwPosition * GetMark() const
Definition: pam.hxx:210
Definition: doc.hxx:187
void EnterStdMode()
Definition: select.cxx:551
Dialog to specify the properties of date form field.
void EndAllAction()
Definition: edws.cxx:97
bool GotoTable(const OUString &rName)
Definition: move.cxx:693
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
bool GotoFly(const OUString &rName, FlyCntType eType=FLYCNTTYPE_ALL, bool bSelFrame=true)
Definition: move.cxx:599
void setObjectID(OUString const &rID)
UNKNOWN
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
const SwPosition * GetPoint() const
Definition: pam.hxx:208
SwContentNode * GetContentNode()
Definition: node.hxx:625
void setIssueObject(IssueObject eIssueObject)
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
AccessibilityIssue(sfx::AccessibilityIssueID eIssueID=sfx::AccessibilityIssueID::UNSPECIFIED)
bool canGotoIssue() const override
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
void ShowCursor()
Definition: crsrsh.cxx:2398
AccessibilityIssueID
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:476
void gotoIssue() const override
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86