tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / vcl / source / uitest / uitest.cxx
blobba2cef12dd3fbac1b4d056d12a28b3e5bddf14cd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <memory>
11 #include <vcl/toolkit/floatwin.hxx>
12 #include <vcl/uitest/uitest.hxx>
13 #include <vcl/uitest/uiobject.hxx>
15 #include <vcl/toolkit/dialog.hxx>
17 #include <svdata.hxx>
19 #include <comphelper/dispatchcommand.hxx>
20 #include <com/sun/star/beans/PropertyValue.hpp>
22 bool UITest::executeCommand(const OUString& rCommand)
24 return comphelper::dispatchCommand(
25 rCommand,
26 {{u"SynchronMode"_ustr, -1, css::uno::Any(true),
27 css::beans::PropertyState_DIRECT_VALUE}});
30 bool UITest::executeCommandWithParameters(const OUString& rCommand,
31 const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
33 css::uno::Sequence< css::beans::PropertyValue > lNewArgs =
34 {{u"SynchronMode"_ustr, -1, css::uno::Any(true),
35 css::beans::PropertyState_DIRECT_VALUE}};
37 if ( rArgs.hasElements() )
39 sal_uInt32 nIndex( lNewArgs.getLength() );
40 lNewArgs.realloc( lNewArgs.getLength()+rArgs.getLength() );
42 std::copy(rArgs.begin(), rArgs.end(), std::next(lNewArgs.getArray(), nIndex));
44 return comphelper::dispatchCommand(rCommand,lNewArgs);
47 bool UITest::executeDialog(const OUString& rCommand)
49 return comphelper::dispatchCommand(
50 rCommand,
51 {{u"SynchronMode"_ustr, -1, css::uno::Any(false),
52 css::beans::PropertyState_DIRECT_VALUE}});
55 std::unique_ptr<UIObject> UITest::getFocusTopWindow()
57 ImplSVData* pSVData = ImplGetSVData();
58 ImplSVWinData& rWinData = *pSVData->mpWinData;
60 if (!rWinData.mpExecuteDialogs.empty())
62 return rWinData.mpExecuteDialogs.back()->GetUITestFactory()(rWinData.mpExecuteDialogs.back());
65 return pSVData->maFrameData.mpFirstFrame->GetUITestFactory()(pSVData->maFrameData.mpFirstFrame);
68 std::unique_ptr<UIObject> UITest::getFloatWindow()
70 ImplSVData* pSVData = ImplGetSVData();
71 ImplSVWinData& rWinData = *pSVData->mpWinData;
73 VclPtr<vcl::Window> pFloatWin = rWinData.mpFirstFloat;
74 if (pFloatWin)
75 return pFloatWin->GetUITestFactory()(pFloatWin);
77 return nullptr;
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */