1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
11 #include <vcl/uitest/uitest.hxx>
12 #include <vcl/uitest/uiobject.hxx>
14 #include <vcl/dialog.hxx>
18 #include <comphelper/dispatchcommand.hxx>
19 #include <com/sun/star/beans/PropertyValue.hpp>
21 bool UITest::executeCommand(const OUString
& rCommand
)
23 return comphelper::dispatchCommand(
25 {{"SynchronMode", -1, css::uno::Any(true),
26 css::beans::PropertyState_DIRECT_VALUE
}});
29 bool UITest::executeCommandWithParameters(const OUString
& rCommand
,
30 const css::uno::Sequence
< css::beans::PropertyValue
>& rArgs
)
32 css::uno::Sequence
< css::beans::PropertyValue
> lNewArgs
=
33 {{"SynchronMode", -1, css::uno::Any(true),
34 css::beans::PropertyState_DIRECT_VALUE
}};
36 if ( rArgs
.hasElements() )
38 sal_uInt32
nIndex( lNewArgs
.getLength() );
39 lNewArgs
.realloc( lNewArgs
.getLength()+rArgs
.getLength() );
41 std::copy(rArgs
.begin(), rArgs
.end(), std::next(lNewArgs
.begin(), nIndex
));
43 return comphelper::dispatchCommand(rCommand
,lNewArgs
);
46 bool UITest::executeDialog(const OUString
& rCommand
)
48 return comphelper::dispatchCommand(
50 {{"SynchronMode", -1, css::uno::Any(false),
51 css::beans::PropertyState_DIRECT_VALUE
}});
54 std::unique_ptr
<UIObject
> UITest::getFocusTopWindow()
56 ImplSVData
* pSVData
= ImplGetSVData();
57 ImplSVWinData
& rWinData
= pSVData
->maWinData
;
59 if (!rWinData
.mpExecuteDialogs
.empty())
61 return rWinData
.mpExecuteDialogs
.back()->GetUITestFactory()(rWinData
.mpExecuteDialogs
.back());
64 return rWinData
.mpFirstFrame
->GetUITestFactory()(rWinData
.mpFirstFrame
);
67 std::unique_ptr
<UIObject
> UITest::getFloatWindow()
69 ImplSVData
* pSVData
= ImplGetSVData();
70 ImplSVWinData
& rWinData
= pSVData
->maWinData
;
72 VclPtr
<vcl::Window
> pFloatWin
= rWinData
.mpFirstFloat
;
74 return pFloatWin
->GetUITestFactory()(pFloatWin
);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */