vba: add support for Application.WindowState + test
This just delegates the get/set calls to ActiveWindow.WindowState which is already supported, but calling it directly on Application is also possible. Change-Id: Ibf6f55581a5c66a47ec4dd21cc8d0fe3558330ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129013 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
cfa4867b0b
commit
93806a2831
5 changed files with 37 additions and 0 deletions
|
@ -47,6 +47,7 @@ interface XApplication
|
|||
[attribute] boolean DisplayFormulaBar;
|
||||
[attribute] any CutCopyMode;
|
||||
[attribute] any StatusBar;
|
||||
[attribute] any WindowState;
|
||||
[attribute] long Cursor;
|
||||
[attribute] boolean EnableEvents;
|
||||
[attribute] boolean EnableCancelKey;
|
||||
|
|
BIN
sc/qa/extras/testdocuments/VariousTestMacros.xlsm
Normal file
BIN
sc/qa/extras/testdocuments/VariousTestMacros.xlsm
Normal file
Binary file not shown.
|
@ -48,6 +48,8 @@ public:
|
|||
void testSimpleCopyAndPaste();
|
||||
void testMultiDocumentCopyAndPaste();
|
||||
void testSheetAndColumnSelectAndHide();
|
||||
void testWindowState();
|
||||
|
||||
void testVba();
|
||||
void testTdf107885();
|
||||
void testTdf131562();
|
||||
|
@ -58,6 +60,7 @@ public:
|
|||
CPPUNIT_TEST(testSimpleCopyAndPaste);
|
||||
CPPUNIT_TEST(testMultiDocumentCopyAndPaste);
|
||||
CPPUNIT_TEST(testSheetAndColumnSelectAndHide);
|
||||
CPPUNIT_TEST(testWindowState);
|
||||
|
||||
CPPUNIT_TEST(testVba);
|
||||
CPPUNIT_TEST(testTdf107885);
|
||||
|
@ -230,6 +233,27 @@ void VBAMacroTest::testSheetAndColumnSelectAndHide()
|
|||
CPPUNIT_ASSERT_EQUAL(SCTAB(0), rViewData.GetTabNo());
|
||||
}
|
||||
|
||||
void VBAMacroTest::testWindowState()
|
||||
{
|
||||
// Application.WindowState = xlMinimized
|
||||
// Application.WindowState = xlMaximized
|
||||
// Application.WindowState = xlNormal
|
||||
|
||||
OUString aFileName;
|
||||
createFileURL(u"VariousTestMacros.xlsm", aFileName);
|
||||
mxComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
|
||||
|
||||
uno::Any aRet;
|
||||
uno::Sequence<sal_Int16> aOutParamIndex;
|
||||
uno::Sequence<uno::Any> aOutParam;
|
||||
uno::Sequence<uno::Any> aParams;
|
||||
|
||||
SfxObjectShell::CallXScript(mxComponent,
|
||||
"vnd.sun.Star.script:VBAProject.ThisWorkbook.testWindowState?"
|
||||
"language=Basic&location=document",
|
||||
aParams, aRet, aOutParamIndex, aOutParam);
|
||||
}
|
||||
|
||||
void VBAMacroTest::testVba()
|
||||
{
|
||||
TestMacroInfo testInfo[] = {
|
||||
|
|
|
@ -488,6 +488,16 @@ ScVbaApplication::getStatusBar()
|
|||
return uno::makeAny( !getDisplayStatusBar() );
|
||||
}
|
||||
|
||||
css::uno::Any SAL_CALL ScVbaApplication::getWindowState()
|
||||
{
|
||||
return getActiveWindow()->getWindowState();
|
||||
}
|
||||
|
||||
void SAL_CALL ScVbaApplication::setWindowState(const css::uno::Any& rWindowState)
|
||||
{
|
||||
getActiveWindow()->setWindowState(rWindowState);
|
||||
}
|
||||
|
||||
void SAL_CALL
|
||||
ScVbaApplication::setStatusBar( const uno::Any& _statusbar )
|
||||
{
|
||||
|
|
|
@ -109,6 +109,8 @@ public:
|
|||
virtual void SAL_CALL setCutCopyMode( const css::uno::Any& _cutcopymode ) override;
|
||||
virtual css::uno::Any SAL_CALL getStatusBar() override;
|
||||
virtual void SAL_CALL setStatusBar( const css::uno::Any& _statusbar ) override;
|
||||
virtual css::uno::Any SAL_CALL getWindowState() override;
|
||||
virtual void SAL_CALL setWindowState(const css::uno::Any& rWindowState) override;
|
||||
virtual ::sal_Int32 SAL_CALL getCursor() override;
|
||||
virtual void SAL_CALL setCursor( ::sal_Int32 _cursor ) override;
|
||||
virtual void SAL_CALL OnKey( const OUString& Key, const css::uno::Any& Procedure ) override;
|
||||
|
|
Loading…
Reference in a new issue