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 <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
12
13#include <AccessibilityIssue.hxx>
14#include <AccessibilityCheckStrings.hrc>
15#include <drawdoc.hxx>
16#include <edtwin.hxx>
19#include <swtypes.hxx>
20#include <wrtsh.hxx>
21#include <docsh.hxx>
22#include <view.hxx>
23#include <comphelper/lok.hxx>
24#include <cui/dlgname.hxx>
25#include <svx/svdpage.hxx>
26
27namespace sw
28{
30 : sfx::AccessibilityIssue(eIssueID)
31 , m_eIssueObject(IssueObject::UNKNOWN)
32 , m_pDoc(nullptr)
33 , m_pNode(nullptr)
34 , m_pTextFootnote(nullptr)
35 , m_nStart(0)
36 , m_nEnd(0)
37{
38}
39
41
42void AccessibilityIssue::setDoc(SwDoc& rDoc) { m_pDoc = &rDoc; }
43
44void AccessibilityIssue::setObjectID(OUString const& rID) { m_sObjectID = rID; }
45
47{
50 return true;
51 return false;
52}
53
55{
56 if (!m_pDoc)
57 return;
58
59 switch (m_eIssueObject)
60 {
64 {
65 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
66 bool bSelected = pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, true);
67 if (bSelected && pWrtShell->IsFrameSelected())
68 {
69 pWrtShell->HideCursor();
70 pWrtShell->EnterSelFrameMode();
71 }
73 pWrtShell->ShowCursor();
74 }
75 break;
77 {
78 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
81 pWrtShell->ShowCursor();
82 }
83 break;
85 {
86 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
87 bool bIsDesignMode = pWrtShell->GetView().GetFormShell()->IsDesignMode();
88 if (bIsDesignMode || (!bIsDesignMode && pWrtShell->WarnSwitchToDesignModeDialog()))
89 {
90 if (!bIsDesignMode)
91 pWrtShell->GetView().GetFormShell()->SetDesignMode(true);
94 pWrtShell->ShowCursor();
95 }
96 }
97 break;
99 {
100 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
101 pWrtShell->GotoTable(m_sObjectID);
103 pWrtShell->ShowCursor();
104 }
105 break;
107 {
108 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
109 SwContentNode* pContentNode = m_pNode->GetContentNode();
110 SwPosition aPoint(*pContentNode, m_nStart);
111 SwPosition aMark(*pContentNode, m_nEnd);
112 pWrtShell->EnterStdMode();
113 pWrtShell->StartAllAction();
114 SwPaM* pPaM = pWrtShell->GetCursor();
115 *pPaM->GetPoint() = aPoint;
116 pPaM->SetMark();
117 *pPaM->GetMark() = aMark;
118 pWrtShell->EndAllAction();
120 pWrtShell->ShowCursor();
121 }
122 break;
124 {
125 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
126 if (m_pTextFootnote)
129 pWrtShell->ShowCursor();
130 }
131 break;
132 default:
133 break;
134 }
136}
137
139{
143}
144
146{
147 if (!m_pDoc)
148 return;
149
151 gotoIssue();
152
153 switch (m_eIssueObject)
154 {
156 case IssueObject::OLE:
157 {
158 OUString aDesc = SwResId(STR_ENTER_ALT);
159 SvxNameDialog aNameDialog(m_pParent, "", aDesc);
160 if (aNameDialog.run() == RET_OK)
161 {
162 SwFlyFrameFormat* pFlyFormat
164 if (pFlyFormat)
165 m_pDoc->SetFlyFrameTitle(*pFlyFormat, aNameDialog.GetName());
166 }
167 }
168 break;
171 {
172 OUString aDesc = SwResId(STR_ENTER_ALT);
173 SvxNameDialog aNameDialog(m_pParent, "", aDesc);
174 if (aNameDialog.run() == RET_OK)
175 {
176 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
177 auto pPage = pWrtShell->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
178 SdrObject* pObj = pPage->GetObjByName(m_sObjectID);
179 if (pObj)
180 pObj->SetTitle(aNameDialog.GetName());
181 }
182 }
183 break;
185 {
186 OUString aDesc = SwResId(STR_ENTER_DOCUMENT_TITLE);
187 SvxNameDialog aNameDialog(m_pParent, "", aDesc);
188 if (aNameDialog.run() == RET_OK)
189 {
190 SwDocShell* pShell = m_pDoc->GetDocShell();
191 if (!pShell)
192 return;
193
194 const uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
195 pShell->GetModel(), uno::UNO_QUERY_THROW);
196 const uno::Reference<document::XDocumentProperties> xDocumentProperties(
197 xDPS->getDocumentProperties());
198 xDocumentProperties->setTitle(aNameDialog.GetName());
199
200 m_pDoc->getOnlineAccessibilityCheck()->resetAndQueueDocumentLevel();
201 }
202 }
203 break;
204 default:
205 break;
206 }
207 if (m_pNode)
208 m_pDoc->getOnlineAccessibilityCheck()->resetAndQueue(m_pNode);
209}
210
211} // end sw namespace
212
213/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool IsDesignMode() const override
void SetDesignMode(bool _bDesignMode)
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual void SetTitle(const OUString &rStr)
css::uno::Reference< css::frame::XModel3 > GetModel() const
OUString GetName() const
void ShowCursor()
Definition: crsrsh.cxx:2710
void HideCursor()
Definition: crsrsh.cxx:2731
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
const SwView * GetView() const
Definition: docsh.hxx:221
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
Definition: doc.hxx:197
void SetFlyFrameTitle(SwFlyFrameFormat &rFlyFrameFormat, const OUString &sNewTitle)
Definition: docfly.cxx:552
std::unique_ptr< sw::OnlineAccessibilityCheck > const & getOnlineAccessibilityCheck() const
Definition: doc.hxx:1578
const SwFlyFrameFormat * FindFlyByName(const OUString &rName, SwNodeType nNdTyp=SwNodeType::NONE) const
Definition: doclay.cxx:1420
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void EndAllAction()
Definition: edws.cxx:97
bool IsFrameSelected() const
Definition: feshview.cxx:1133
SwContentNode * GetContentNode()
Definition: node.hxx:666
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: viewsh.cxx:2823
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:589
SwEditWin & GetEditWin()
Definition: view.hxx:426
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:711
bool GotoDrawingObject(std::u16string_view rName)
Definition: move.cxx:670
bool GotoFly(const OUString &rName, FlyCntType eType=FLYCNTTYPE_ALL, bool bSelFrame=true)
Definition: move.cxx:637
void EnterStdMode()
Definition: select.cxx:560
bool GotoTable(const OUString &rName)
Definition: move.cxx:731
void GotoFootnoteAnchor(const SwTextFootnote &rTextFootnote)
Definition: move.cxx:747
virtual bool WarnSwitchToDesignModeDialog() const override
Switch to Design mode for Forms.
Definition: wrtsh1.cxx:2713
const SwView & GetView() const
Definition: wrtsh.hxx:443
weld::Window * m_pParent
AccessibilityIssue(sfx::AccessibilityIssueID eIssueID=sfx::AccessibilityIssueID::UNSPECIFIED)
SwTextFootnote * m_pTextFootnote
bool canQuickFixIssue() const override
void setIssueObject(IssueObject eIssueObject)
void gotoIssue() const override
bool canGotoIssue() const override
void setObjectID(OUString const &rID)
void quickFixIssue() const override
void GrabFocus()
UNKNOWN
@ FLYCNTTYPE_ALL
Definition: flyenum.hxx:25
AccessibilityIssueID
Dialog to specify the properties of date form field.
Marks a position in the document model.
Definition: pam.hxx:38
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
RET_OK