13#include <com/sun/star/awt/Point.hpp>
14#include <com/sun/star/awt/Size.hpp>
15#include <com/sun/star/beans/XPropertySet.hpp>
16#include <com/sun/star/drawing/XControlShape.hpp>
17#include <com/sun/star/lang/XMultiServiceFactory.hpp>
18#include <com/sun/star/uno/XInterface.hpp>
20#include <com/sun/star/uno/Any.hxx>
21#include <com/sun/star/uno/Reference.hxx>
27uno::Reference<drawing::XControlShape>
29 const sal_Int32 nX,
const sal_Int32 nY,
30 const sal_Int32 nHeight,
const sal_Int32 nWidth)
36 const uno::Reference<lang::XComponent>& r_xComponent, std::u16string_view r_aKind,
37 const sal_Int32 nX,
const sal_Int32 nY,
const sal_Int32 nHeight,
const sal_Int32 nWidth)
39 uno::Reference<lang::XMultiServiceFactory> xMSF(r_xComponent, uno::UNO_QUERY_THROW);
41 uno::Reference<drawing::XControlShape> xControlShape(
42 xMSF->createInstance(
"com.sun.star.drawing.ControlShape"), uno::UNO_QUERY_THROW);
44 uno::Reference<uno::XInterface> aComponent(
45 xMSF->createInstance(OUString::Concat(
"com.sun.star.form.component.") + r_aKind),
47 uno::Reference<beans::XPropertySet> xPropertySet(aComponent, uno::UNO_QUERY_THROW);
48 xPropertySet->setPropertyValue(
49 "DefaultControl",
uno::Any(OUString::Concat(
"com.sun.star.form.control.") + r_aKind));
50 uno::Reference<awt::XControlModel> xControlModel(aComponent, uno::UNO_QUERY_THROW);
52 xControlShape->setSize(awt::Size(nHeight, nWidth));
53 xControlShape->setPosition(awt::Point(nX, nY));
55 xControlShape->setControl(xControlModel);
#define OOO_DLLPUBLIC_TEST