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 
15 namespace sw
16 {
18  : sfx::AccessibilityIssue(eIssueID)
19  , m_eIssueObject(IssueObject::UNKNOWN)
20  , m_pDoc(nullptr)
21  , m_pNode(nullptr)
22  , m_nStart(0)
23  , m_nEnd(0)
24 {
25 }
26 
27 void AccessibilityIssue::setIssueObject(IssueObject eIssueObject) { m_eIssueObject = eIssueObject; }
28 
29 void AccessibilityIssue::setDoc(SwDoc& rDoc) { m_pDoc = &rDoc; }
30 
31 void AccessibilityIssue::setObjectID(OUString const& rID) { m_sObjectID = rID; }
32 
34 {
36  return true;
37  return false;
38 }
39 
41 {
42  if (!m_pDoc)
43  return;
44 
45  switch (m_eIssueObject)
46  {
48  case IssueObject::OLE:
49  {
50  SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
51  pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, true);
52  }
53  break;
54  case IssueObject::TABLE:
55  {
56  SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
57  pWrtShell->GotoTable(m_sObjectID);
58  }
59  break;
60  case IssueObject::TEXT:
61  {
62  SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
63  SwContentNode* pContentNode = m_pNode->GetContentNode();
64  SwPosition aPoint(*pContentNode, m_nStart);
65  SwPosition aMark(*pContentNode, m_nEnd);
66  pWrtShell->EnterStdMode();
67  pWrtShell->StartAllAction();
68  SwPaM* pPaM = pWrtShell->GetCursor();
69  *pPaM->GetPoint() = aPoint;
70  pPaM->SetMark();
71  *pPaM->GetMark() = aMark;
72  pWrtShell->EndAllAction();
73  }
74  break;
75  default:
76  break;
77  }
78 }
79 
80 } // end sw namespace
81 
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Marks a position in the document model.
Definition: pam.hxx:35
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:190
SwDocShell * GetDocShell()
Definition: doc.hxx:1350
const SwPosition * GetMark() const
Definition: pam.hxx:209
Definition: doc.hxx:186
void EnterStdMode()
Definition: select.cxx:550
Dialog to specify the properties of date form field.
void EndAllAction()
Definition: edws.cxx:97
bool GotoTable(const OUString &rName)
Definition: move.cxx:655
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
bool GotoFly(const OUString &rName, FlyCntType eType=FLYCNTTYPE_ALL, bool bSelFrame=true)
Definition: move.cxx:594
void setObjectID(OUString const &rID)
UNKNOWN
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SwContentNode * GetContentNode()
Definition: node.hxx:618
void setIssueObject(IssueObject eIssueObject)
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
AccessibilityIssue(sfx::AccessibilityIssueID eIssueID=sfx::AccessibilityIssueID::UNSPECIFIED)
bool canGotoIssue() const override
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