LibreOffice Module sw (master) 1
AccessibilityStatusBarControl.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#include <swtypes.hxx>
11#include <strings.hrc>
13#include <svl/intitem.hxx>
14#include <vcl/status.hxx>
15#include <vcl/event.hxx>
16#include <officecfg/Office/Common.hxx>
17#include <bitmaps.hlst>
18
20
21namespace sw
22{
24 StatusBar& rStb)
25 : SfxStatusBarControl(_nSlotId, _nId, rStb)
26 , mnIssues(0)
27 , maImageIssuesFound(Image(StockImage::Yes, RID_BMP_A11Y_CHECK_ISSUES_FOUND))
28 , maImageIssuesNotFound(Image(StockImage::Yes, RID_BMP_A11Y_CHECK_ISSUES_NOT_FOUND))
29{
30}
31
33
35 SfxItemState eState,
36 const SfxPoolItem* pState)
37{
38 mnIssues = -1;
39
40 bool bOnlineCheckStatus
42
43 if (eState == SfxItemState::DEFAULT && bOnlineCheckStatus)
44 {
45 if (auto pItem = dynamic_cast<const SfxInt32Item*>(pState))
46 mnIssues = pItem->GetValue();
47 OUString aString = SwResId(STR_ACCESSIBILITY_CHECK_HINT)
48 .replaceFirst("%issues%", OUString::number(mnIssues));
50 }
51 else
52 {
54 }
55
57}
58
60{
61 if (mnIssues < 0)
62 return;
63
64 vcl::RenderContext* pRenderContext = rUserEvent.GetRenderContext();
65
66 tools::Rectangle aRect = rUserEvent.GetRect();
67 const tools::Rectangle aControlRect = getControlRect();
68
70
71 Size aSize(aImage.GetSizePixel());
72
73 auto aPosition = Point(aRect.Left() + (aControlRect.GetWidth() - aSize.Width()) / 2,
74 aRect.Top() + (aControlRect.GetHeight() - aSize.Height()) / 2);
75
76 pRenderContext->DrawImage(aPosition, aImage);
77}
78
79} // end sw
80
81/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SFX_IMPL_STATUSBAR_CONTROL(sw::AccessibilityStatusBarControl, SfxInt32Item)
Size GetSizePixel() const
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
StatusBar & GetStatusBar() const
sal_uInt16 GetId() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetQuickHelpText(sal_uInt16 nItemId, const OUString &rText)
vcl::RenderContext * GetRenderContext() const
const tools::Rectangle & GetRect() const
virtual ~AccessibilityStatusBarControl() override
void Paint(const UserDrawEvent &rEvent) override
void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
AccessibilityStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb)
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
float u
StockImage
Yes
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
SfxItemState
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168