Kaydet (Commit) 1e286829 authored tarafından Jens Carl's avatar Jens Carl

Be consistent with namespaces and parameter order for UNO Api helpers

Have this file the same namespaces as the new introduced helpers in
include/test/helper/shape.hxx and also change the order of the parameter
be the same to avoid confusion.

Change-Id: I5614e9a79dff3ee9aca96ff2e50ddfafa83de539
Reviewed-on: https://gerrit.libreoffice.org/69870
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst c6162302
......@@ -22,19 +22,26 @@
namespace apitest
{
namespace helper
{
namespace form
{
/** @brief Create a XControlShape
*
* @param r_xComponent The document.
* @param nHeight The height of the shape.
* @param nWidth The width of the shape.
* @param r_aKind The kind of the shape.
* @param nX The x-position of the shape.
* @param nY The y-position of the shape.
* @param r_aKind The kind of the shape.
* @param nHeight The height of the shape.
* @param nWidth The width of the shape.
* @return The create XControlShape.
*/
css::uno::Reference<css::drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape(
const css::uno::Reference<css::lang::XComponent>& r_xComponent, const sal_Int32 nHeight,
const sal_Int32 nWidth, const sal_Int32 nX, const sal_Int32 nY, const OUString& r_aKind);
const css::uno::Reference<css::lang::XComponent>& r_xComponent, const OUString& r_aKind,
const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth);
} // namespace form
} // namespace helper
} // namespace apitest
#endif // INCLUDED_TEST_INC_HELPER_FORM_HXX
......
......@@ -8,6 +8,8 @@
*/
#include <helper/form.hxx>
#include <rtl/string.hxx>
#include <sal/types.h>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
......@@ -16,19 +18,20 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/string.hxx>
#include <sal/types.h>
using namespace css;
namespace apitest
{
uno::Reference<drawing::XControlShape>
createControlShape(const uno::Reference<lang::XComponent>& r_xComponent, const sal_Int32 nHeight,
const sal_Int32 nWidth, const sal_Int32 nX, const sal_Int32 nY,
const OUString& r_aKind)
namespace helper
{
namespace form
{
uno::Reference<drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape(
const uno::Reference<lang::XComponent>& r_xComponent, const OUString& r_aKind,
const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth)
{
uno::Reference<lang::XMultiServiceFactory> xMSF(r_xComponent, uno::UNO_QUERY_THROW);
......@@ -38,9 +41,8 @@ createControlShape(const uno::Reference<lang::XComponent>& r_xComponent, const s
uno::Reference<uno::XInterface> aComponent(
xMSF->createInstance("com.sun.star.form.component." + r_aKind), uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xPropertySet(aComponent, uno::UNO_QUERY_THROW);
uno::Any aValue;
aValue <<= "com.sun.star.form.control." + r_aKind;
xPropertySet->setPropertyValue("DefaultControl", aValue);
xPropertySet->setPropertyValue("DefaultControl",
uno::makeAny("com.sun.star.form.control." + r_aKind));
uno::Reference<awt::XControlModel> xControlModel(aComponent, uno::UNO_QUERY_THROW);
xControlShape->setSize(awt::Size(nHeight, nWidth));
......@@ -50,6 +52,9 @@ createControlShape(const uno::Reference<lang::XComponent>& r_xComponent, const s
return xControlShape;
}
} // namespace form
} // namespace helper
} // namespace apitest
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -21,10 +21,11 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/view/XControlAccess.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
using namespace css::uno;
namespace apitest
{
......@@ -39,7 +40,7 @@ void XControlAccess::testGetControl()
uno::Reference<drawing::XShapes> xShapes(xDP, uno::UNO_QUERY_THROW);
uno::Reference<drawing::XShape> xShape(
createControlShape(xComponent, 100, 100, 10000, 50000, "CommandButton"),
helper::form::createControlShape(xComponent, "CommandButton", 10000, 50000, 100, 100),
uno::UNO_QUERY_THROW);
xShapes->add(xShape);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment