1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <test/helper/shape.hxx>
11 #include <sal/types.h>
12 #include <rtl/string.hxx>
14 #include <com/sun/star/drawing/XShape.hpp>
15 #include <com/sun/star/lang/XComponent.hpp>
16 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
17 #include <com/sun/star/beans/PropertyVetoException.hpp>
19 #include <com/sun/star/uno/Reference.hxx>
29 uno::Reference
<drawing::XShape
>
30 OOO_DLLPUBLIC_TEST
createEllipse(const uno::Reference
<lang::XComponent
>& r_xComponent
,
31 const sal_Int32 nX
, const sal_Int32 nY
, const sal_Int32 nWidth
,
32 const sal_Int32 nHeight
)
34 return createShape(r_xComponent
, "Ellipse", nX
, nY
, nWidth
, nHeight
);
37 uno::Reference
<drawing::XShape
>
38 OOO_DLLPUBLIC_TEST
createLine(const uno::Reference
<lang::XComponent
>& r_xComponent
,
39 const sal_Int32 nX
, const sal_Int32 nY
, const sal_Int32 nWidth
,
40 const sal_Int32 nHeight
)
42 return createShape(r_xComponent
, "Line", nX
, nY
, nWidth
, nHeight
);
45 uno::Reference
<drawing::XShape
>
46 OOO_DLLPUBLIC_TEST
createRectangle(const uno::Reference
<lang::XComponent
>& r_xComponent
,
47 const sal_Int32 nX
, const sal_Int32 nY
,
48 const sal_Int32 nWidth
, const sal_Int32 nHeight
)
50 return createShape(r_xComponent
, "Rectangle", nX
, nY
, nWidth
, nHeight
);
53 uno::Reference
<drawing::XShape
>
54 OOO_DLLPUBLIC_TEST
createShape(const uno::Reference
<lang::XComponent
>& r_xComponent
,
55 const OUString
& r_aKind
, const sal_Int32 nX
, const sal_Int32 nY
,
56 const sal_Int32 nWidth
, const sal_Int32 nHeight
)
58 uno::Reference
<lang::XMultiServiceFactory
> xMSF(r_xComponent
, uno::UNO_QUERY_THROW
);
59 uno::Reference
<drawing::XShape
> xShape(
60 xMSF
->createInstance("com.sun.star.drawing." + r_aKind
+ "Shape"), uno::UNO_QUERY_THROW
);
64 xShape
->setPosition(awt::Point(nX
, nY
));
65 xShape
->setSize(awt::Size(nWidth
, nHeight
));
67 catch (const beans::PropertyVetoException
&)
76 } // namespace apitest
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */