LibreOffice Module sd (master) 1
AccessibleViewForwarder.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <AccessibleViewForwarder.hxx>
21#include <svx/svdpntv.hxx>
22#include <vcl/window.hxx>
24#include <osl/diagnose.h>
25
26namespace accessibility
27{
36 : mpView(pView)
37 , mnWindowId(0)
38{
39 // Search the output device to determine its id.
40 for (sal_uInt32 a(0); a < mpView->PaintWindowCount(); a++)
41 {
42 SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(a);
43 OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
44
45 if (&rOutDev == &rDevice)
46 {
47 mnWindowId = static_cast<sal_uInt16>(a);
48 break;
49 }
50 }
51}
52
54{
55 // empty
56}
57
59{
60 ::tools::Rectangle aVisibleArea;
61
62 if (static_cast<sal_uInt32>(mnWindowId) < mpView->PaintWindowCount())
63 {
64 SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId));
65 aVisibleArea = pPaintWindow->GetVisibleArea();
66 }
67
68 return aVisibleArea;
69}
70
76{
77 OSL_ASSERT(mpView != nullptr);
78 if (static_cast<sal_uInt32>(mnWindowId) < mpView->PaintWindowCount())
79 {
80 SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId));
81 OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
83 return rOutDev.LogicToPixel(rPoint) + aBBox.TopLeft();
84 }
85 else
86 return Point();
87}
88
90{
91 OSL_ASSERT(mpView != nullptr);
92 if (static_cast<sal_uInt32>(mnWindowId) < mpView->PaintWindowCount())
93 {
94 SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId));
95 OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
96 return rOutDev.LogicToPixel(rSize);
97 }
98 else
99 return Size();
100}
101
102} // end of namespace accessibility
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
virtual vcl::Window * GetOwnerWindow() const
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
sal_uInt32 PaintWindowCount() const
OutputDevice & GetOutputDevice() const
tools::Rectangle GetVisibleArea() const
virtual ::tools::Rectangle GetVisibleArea() const override
Returns the area of the underlying document that is visible in the corresponding window.
AccessibleViewForwarder(SdrPaintView *pView, const OutputDevice &rDevice)
For the time being, the implementation of this class will not use the member mrDevice.
virtual Point LogicToPixel(const Point &rPoint) const override
Transform the specified point from internal coordinates to an absolute screen position.
constexpr Point TopLeft() const
tools::Rectangle GetWindowExtentsAbsolute() const
uno_Any a
UnoViewSharedPtr mpView