27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/drawing/XMasterPageTarget.hpp>
29#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
35using ::com::sun::star::uno::Reference;
42 uno::Reference<drawing::XDrawPage> xPage,
43 const uno::Reference<XAccessible>& rxParent,
44 const AccessibleShapeTreeInfo& rShapeTreeInfo)
45 : AccessibleShape (AccessibleShapeInfo (nullptr, rxParent), rShapeTreeInfo),
46 mxPage (
std::move(xPage))
52AccessiblePageShape::~AccessiblePageShape()
59 AccessiblePageShape::getAccessibleChildCount()
67uno::Reference<XAccessible> SAL_CALL
68 AccessiblePageShape::getAccessibleChild( sal_Int64 )
70 throw lang::IndexOutOfBoundsException (
"page shape has no children",
71 static_cast<uno::XWeak*
>(
this));
76awt::Rectangle SAL_CALL AccessiblePageShape::getBounds()
80 awt::Rectangle aBoundingBox;
82 if (maShapeTreeInfo.GetViewForwarder() !=
nullptr)
84 uno::Reference<beans::XPropertySet> xSet (mxPage, uno::UNO_QUERY);
89 aValue = xSet->getPropertyValue (
"BorderLeft");
90 aValue >>= aBoundingBox.X;
91 aValue = xSet->getPropertyValue (
"BorderTop");
92 aValue >>= aBoundingBox.Y;
94 aValue = xSet->getPropertyValue (
"Width");
95 aValue >>= aBoundingBox.Width;
96 aValue = xSet->getPropertyValue (
"Height");
97 aValue >>= aBoundingBox.Height;
101 ::Size aPixelSize = maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
102 ::Size (aBoundingBox.Width, aBoundingBox.Height));
103 ::Point aPixelPosition = maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
104 ::Point (aBoundingBox.X, aBoundingBox.Y));
107 Reference<XAccessibleComponent> xParentComponent (
108 getAccessibleParent(), uno::UNO_QUERY);
109 if (xParentComponent.is())
112 awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
113 int x = aPixelPosition.
getX() - aParentLocation.X;
114 int y = aPixelPosition.
getY() - aParentLocation.Y;
119 awt::Size aParentSize (xParentComponent->getSize());
122 aBoundingBox = awt::Rectangle (
129 aBoundingBox = awt::Rectangle (
130 aPixelPosition.
getX(), aPixelPosition.
getY(),
137sal_Int32 SAL_CALL AccessiblePageShape::getForeground()
140 sal_Int32 nColor (0x0ffffffL);
144 uno::Reference<beans::XPropertySet> aSet (mxPage, uno::UNO_QUERY);
147 uno::Any aColor = aSet->getPropertyValue (
"LineColor");
151 catch (
const css::beans::UnknownPropertyException&)
161sal_Int32 SAL_CALL AccessiblePageShape::getBackground()
164 sal_Int32 nColor (0x01020ffL);
168 uno::Reference<beans::XPropertySet> xSet (mxPage, uno::UNO_QUERY);
171 uno::Any aBGSet = xSet->getPropertyValue (
"Background");
172 Reference<beans::XPropertySet> xBGSet (aBGSet, uno::UNO_QUERY);
177 Reference<drawing::XMasterPageTarget>
xTarget (mxPage, uno::UNO_QUERY);
180 xSet.set(
xTarget->getMasterPage(), uno::UNO_QUERY);
181 aBGSet = xSet->getPropertyValue (
"Background");
182 xBGSet.set(aBGSet, uno::UNO_QUERY);
189 uno::Any aColor = xBGSet->getPropertyValue (
"FillColor");
193 SAL_WARN(
"sd",
"no Background property in page");
196 catch (
const css::beans::UnknownPropertyException&)
207 AccessiblePageShape::getImplementationName()
210 return "AccessiblePageShape";
213css::uno::Sequence< OUString> SAL_CALL
214 AccessiblePageShape::getSupportedServiceNames()
217 return AccessibleShape::getSupportedServiceNames();
222void AccessiblePageShape::dispose()
228 AccessibleContextBase::dispose ();
234 AccessiblePageShape::CreateAccessibleBaseName()
240 AccessiblePageShape::CreateAccessibleName()
242 Reference<beans::XPropertySet> xPageProperties (mxPage, UNO_QUERY);
245 OUString sCurrentSlideName;
248 if (xPageProperties.is())
250 xPageProperties->getPropertyValue(
"LinkDisplayName" ) >>= sCurrentSlideName;
253 catch (
const beans::UnknownPropertyException&)
257 return CreateAccessibleBaseName()+
": "+sCurrentSlideName;
constexpr tools::Long getX() const
constexpr tools::Long getY() const
constexpr tools::Long getHeight() const
constexpr tools::Long getWidth() const
AccessiblePageShape(css::uno::Reference< css::drawing::XDrawPage > xPage, const css::uno::Reference< css::accessibility::XAccessible > &rxParent, const AccessibleShapeTreeInfo &rShapeTreeInfo)
Create a new accessible object that makes the given shape accessible.
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XInterface > xTarget
#define SAL_WARN(area, stream)
uno::Reference< drawing::XShape > const mxShape