diff options
Diffstat (limited to 'automation/source/miniapp')
-rw-r--r-- | automation/source/miniapp/editwin.cxx | 127 | ||||
-rw-r--r-- | automation/source/miniapp/editwin.hxx | 70 | ||||
-rw-r--r-- | automation/source/miniapp/hid.lst | 27 | ||||
-rw-r--r-- | automation/source/miniapp/makefile.mk | 54 | ||||
-rw-r--r-- | automation/source/miniapp/servres.cxx | 62 | ||||
-rw-r--r-- | automation/source/miniapp/servres.hrc | 40 | ||||
-rw-r--r-- | automation/source/miniapp/servres.hxx | 65 | ||||
-rw-r--r-- | automation/source/miniapp/servres.src | 233 | ||||
-rw-r--r-- | automation/source/miniapp/servuid.hxx | 40 | ||||
-rw-r--r-- | automation/source/miniapp/test.bas | 126 | ||||
-rw-r--r-- | automation/source/miniapp/test.sid | 5 | ||||
-rw-r--r-- | automation/source/miniapp/test.win | 13 | ||||
-rw-r--r-- | automation/source/miniapp/testapp.cxx | 350 | ||||
-rw-r--r-- | automation/source/miniapp/testapp.hxx | 109 |
14 files changed, 1321 insertions, 0 deletions
diff --git a/automation/source/miniapp/editwin.cxx b/automation/source/miniapp/editwin.cxx new file mode 100644 index 000000000000..5cc15cf626f0 --- /dev/null +++ b/automation/source/miniapp/editwin.cxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_automation.hxx" + +#include "editwin.hxx" +#include <tools/stream.hxx> +#include <vcl/msgbox.hxx> + + +BOOL GHEditWindow::Close() +{ + if (aInhalt.IsModified()) + { + } + delete(this); + return TRUE; +} + +void GHEditWindow::Resize() +{ + aInhalt.SetPosSizePixel(Point(1,1),GetOutputSizePixel()); +} + +GHEditWindow::GHEditWindow(Window * pParent, String aName, WinBits iWstyle) +: FloatingWindow(pParent) +, aInhalt(this,iWstyle) +{ + SetOutputSizePixel( Size( 120,80 ) ); + Show(); + Resize(); + aInhalt.Show(); + SetText(aName); +} + +void GHEditWindow::Clear() +{ + aInhalt.SetText(String()); +} + +void GHEditWindow::AddText( String aNew, BOOL bMoveToEnd) +{ + String aOld = aInhalt.GetText(); + + aOld += aNew; + aOld.ConvertLineEnd(); + aInhalt.SetText(aOld); + if (bMoveToEnd) + aInhalt.SetSelection(Selection(SELECTION_MAX,SELECTION_MAX)); +} + + +EditFileWindow::EditFileWindow(Window * pParent, String aName, WinBits iWstyle) +: GHEditWindow(pParent, aName, iWstyle) +, aFileName(aName) +{ + LoadFile(); +} + +void EditFileWindow::LoadFile() +{ + + SvFileStream Stream; + String All,Line; + + Stream.Open(aFileName, STREAM_STD_READ); + + if (!Stream.IsOpen()) + { + AddText(CUniString("could not open ").Append(aFileName).AppendAscii("\n")); + aFileName.Erase(); + return; + } + + while (!Stream.IsEof()) + { + + Stream.ReadByteStringLine( Line, RTL_TEXTENCODING_UTF8 ); + + All += Line; + All += '\n'; + + } + + All.ConvertLineEnd(); + + AddText(All,FALSE); + +} + +BOOL EditFileWindow::Close() +{ + + if (aInhalt.IsModified() && QueryBox(this,WB_DEF_YES | WB_YES_NO_CANCEL, String(aFileName).AppendAscii("\nhas been changed.\n\nSave file?")).Execute()) + { + + } + return GHEditWindow::Close(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/editwin.hxx b/automation/source/miniapp/editwin.hxx new file mode 100644 index 000000000000..e93db51ebb66 --- /dev/null +++ b/automation/source/miniapp/editwin.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _editwin +#define _editwin + +#include <basic/ttstrhlp.hxx> +#include <vcl/floatwin.hxx> +#include <svtools/svmedit.hxx> + +class GHEditWindow : public FloatingWindow +{ + +protected: + + MultiLineEdit aInhalt; + + virtual BOOL Close(); // derived + void Resize(); + +public: + + GHEditWindow(); + GHEditWindow(Window * pParent, String aName = CUniString("Neues Fenster"), WinBits iWstyle = WB_STDWORK); + + void Clear(); + void AddText( String aNew, BOOL bMoveToEnd = TRUE); +}; + + + +class EditFileWindow : public GHEditWindow +{ + + String aFileName; + virtual BOOL Close(); // derived + void LoadFile(); + +public: + EditFileWindow(Window * pParent, String aName = CUniString("Neue Datei"), WinBits iWstyle = WB_STDWORK); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/hid.lst b/automation/source/miniapp/hid.lst new file mode 100644 index 000000000000..99964dba02e8 --- /dev/null +++ b/automation/source/miniapp/hid.lst @@ -0,0 +1,27 @@ +MENU_CLIENT 256 +IDM_FILE 1 +IDM_FILE_OPEN_TEST 2 +IDM_FILE_EXIT 3 +IDM_FILE_EXIT_HELP 0 +IDM_FILE_OPEN_TEST_HELP 1 +IDM_FILE_HELP 3 +GROSSER_TEST_DLG 256 +IDM_TEST 5 +IDM_TEST_GROSS 6 +IDM_SYS_DLG 7 +IDM_TEST_WINTREE 8 + + + +UID_GROSSER_TEST_DLG 101 +UID_CheckBox 202 +UID_TriStateBox 303 +UID_OKButton 404 +UID_TimeField 505 +UID_MultiLineEdit 606 +UID_RadioButton1 707 +UID_RadioButton2 708 +UID_MultiListBox 809 +UID_ComboBox 910 +UID_DateBox 1011 + diff --git a/automation/source/miniapp/makefile.mk b/automation/source/miniapp/makefile.mk new file mode 100644 index 000000000000..14a6d1ff0e1d --- /dev/null +++ b/automation/source/miniapp/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=automation +TARGET=miniapp + +# --- Settings ------------------------------------------------------------ + +.INCLUDE : settings.mk + +# --- Allgemein ------------------------------------------------------------ + +OBJFILES = \ + $(OBJ)$/testapp.obj \ + $(OBJ)$/editwin.obj \ + $(OBJ)$/servres.obj + + +EXCEPTIONSFILES= \ + $(OBJ)$/testapp.obj + +SRS1NAME=$(TARGET) +SRC1FILES = \ + servres.src + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/automation/source/miniapp/servres.cxx b/automation/source/miniapp/servres.cxx new file mode 100644 index 000000000000..bd1ba6110482 --- /dev/null +++ b/automation/source/miniapp/servres.cxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_automation.hxx" +#include <string.h> + +#include "servres.hrc" +#include "servuid.hxx" +#include "servres.hxx" + + +ModalDialogGROSSER_TEST_DLG::ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, BOOL bFreeRes ) + : ModalDialog( pParent, rResId ), + aCheckBox1( this, ResId( 1, *rResId.GetResMgr() ) ), + aTriStateBox1( this, ResId( 1, *rResId.GetResMgr() ) ), + aOKButton1( this, ResId( 1, *rResId.GetResMgr() ) ), + aTimeField1( this, ResId( 1, *rResId.GetResMgr() ) ), + aMultiLineEdit1( this, ResId( 1, *rResId.GetResMgr() ) ), + aGroupBox1( this, ResId( 1, *rResId.GetResMgr() ) ), + aRadioButton1( this, ResId( 1, *rResId.GetResMgr() ) ), + aRadioButton2( this, ResId( 2, *rResId.GetResMgr() ) ), + aMultiListBox1( this, ResId( 1, *rResId.GetResMgr() ) ), + aComboBox1( this, ResId( 1, *rResId.GetResMgr() ) ), + aDateBox1( this, ResId( 1, *rResId.GetResMgr() ) ), + aFixedText1( this, ResId( 1, *rResId.GetResMgr() ) ) +{ + if( bFreeRes ) FreeResource(); +} + +MenuMENU_CLIENT::MenuMENU_CLIENT( const ResId & rResId, BOOL ) + : MenuBar( rResId ) +{ + // No subresources, automatic free resource +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/servres.hrc b/automation/source/miniapp/servres.hrc new file mode 100644 index 000000000000..506b2ecb3025 --- /dev/null +++ b/automation/source/miniapp/servres.hrc @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* StarView ressource header file */ +#define MENU_CLIENT 256 +#define IDM_FILE 1 +#define IDM_FILE_OPEN_TEST 2 +#define IDM_FILE_EXIT 3 +#define IDM_FILE_EXIT_HELP 4 +#define IDM_FILE_OPEN_TEST_HELP 1 +#define IDM_FILE_HELP 3 +#define GROSSER_TEST_DLG 256 +#define IDM_TEST 5 +#define IDM_TEST_GROSS 6 +#define IDM_SYS_DLG 7 +#define IDM_TEST_WINTREE 8 + diff --git a/automation/source/miniapp/servres.hxx b/automation/source/miniapp/servres.hxx new file mode 100644 index 000000000000..21d796c5448f --- /dev/null +++ b/automation/source/miniapp/servres.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <svtools/svmedit.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <vcl/edit.hxx> +#include <vcl/group.hxx> +#include <vcl/combobox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/menu.hxx> +#include <vcl/lstbox.hxx> + +class ModalDialogGROSSER_TEST_DLG : public ModalDialog +{ +protected: + CheckBox aCheckBox1; + TriStateBox aTriStateBox1; + OKButton aOKButton1; + TimeField aTimeField1; + MultiLineEdit aMultiLineEdit1; + GroupBox aGroupBox1; + RadioButton aRadioButton1; + RadioButton aRadioButton2; + MultiListBox aMultiListBox1; + ComboBox aComboBox1; + DateBox aDateBox1; + FixedText aFixedText1; +public: + ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, BOOL bFreeRes = TRUE ); +}; + +class MenuMENU_CLIENT : public MenuBar +{ +protected: +public: + MenuMENU_CLIENT( const ResId & rResId, BOOL bFreeRes = TRUE ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/servres.src b/automation/source/miniapp/servres.src new file mode 100644 index 000000000000..a0516a94a1c5 --- /dev/null +++ b/automation/source/miniapp/servres.src @@ -0,0 +1,233 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "servres.hrc" +#include "servuid.hxx" +ModalDialog GROSSER_TEST_DLG +{ + OutputSize = TRUE ; + SVLook = TRUE ; + HelpID = UID_GROSSER_TEST_DLG ; + Pos = MAP_APPFONT ( 14 , 7 ) ; + Size = MAP_APPFONT ( 273 , 110 ) ; + Text = "Großer Testdialog" ; + Moveable = TRUE ; + Closeable = TRUE ; + CheckBox 1 + { + HelpID = UID_CheckBox ; + Pos = MAP_APPFONT ( 9 , 17 ) ; + Size = MAP_APPFONT ( 55 , 12 ) ; + Text = "CheckBox" ; + TabStop = TRUE ; + }; + TriStateBox 1 + { + HelpID = UID_TriStateBox ; + Pos = MAP_APPFONT ( 9 , 29 ) ; + Size = MAP_APPFONT ( 62 , 12 ) ; + Text = "TriStateBox" ; + TabStop = TRUE ; + }; + OKButton 1 + { + HelpID = 1 ; + Pos = MAP_APPFONT ( 132 , 92 ) ; + Size = MAP_APPFONT ( 64 , 12 ) ; + TabStop = TRUE ; + }; + TimeField 1 + { + Border = TRUE ; + HelpID = UID_TimeField ; + Pos = MAP_APPFONT ( 9 , 92 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + }; + MultiLineEdit 1 + { + Border = TRUE ; + HelpID = UID_MultiLineEdit ; + Pos = MAP_APPFONT ( 172 , 6 ) ; + Size = MAP_APPFONT ( 94 , 48 ) ; + Text = "MultiLineEdit" ; + TabStop = TRUE ; + VScroll = TRUE ; + }; + GroupBox 1 + { + Pos = MAP_APPFONT ( 9 , 42 ) ; + Size = MAP_APPFONT ( 58 , 44 ) ; + Text = "GroupBox" ; + Group = TRUE ; + }; + RadioButton 2 + { + HelpID = UID_RadioButton2 ; + Pos = MAP_APPFONT ( 16 , 68 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Text = "Radio2" ; + TabStop = TRUE ; + }; + RadioButton 1 + { + HelpID = UID_RadioButton1 ; + Pos = MAP_APPFONT ( 16 , 54 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; + Text = "Radio1" ; + TabStop = TRUE ; + }; + MultiListBox 1 + { + Border = TRUE ; + HelpID = UID_MultiListBox ; + Pos = MAP_APPFONT ( 76 , 6 ) ; + Size = MAP_APPFONT ( 86 , 48 ) ; + TabStop = TRUE ; + StringList = + { + < "MultiListBox" ; Default ; > ; + < "Zeile 2" ; Default ; > ; + < "Zeile 3" ; Default ; > ; + < "Zeile 4" ; Default ; > ; + < "Zeile 5" ; Default ; > ; + < "Zeile 6" ; Default ; > ; + < "Zeile 7" ; Default ; > ; + < "Zeile 8" ; Default ; > ; + < "Zeile 9" ; Default ; > ; + < "Zeile 10" ; Default ; > ; + }; + }; + ComboBox 1 + { + HelpID = UID_ComboBox ; + Pos = MAP_APPFONT ( 76 , 58 ) ; + Size = MAP_APPFONT ( 86 , 55 ) ; + Text = "ComboBox" ; + TabStop = TRUE ; + DropDown = TRUE ; + AutoHScroll = TRUE ; + StringList = + { + "ComboBox" ; + "Erster" ; + "Zweiter" ; + "Dritter" ; + }; + }; + DateBox 1 + { + HelpID = UID_DateBox ; + Pos = MAP_APPFONT ( 76 , 72 ) ; + Size = MAP_APPFONT ( 86 , 54 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + AutoHScroll = TRUE ; + StringList = + { + "1.1.91" ; + "2.2.92" ; + "3.3.93" ; + }; + }; + FixedText 1 + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( 19 , 6 ) ; + Size = MAP_APPFONT ( 39 , 9 ) ; + Text = "FixedText" ; + Center = TRUE ; + }; + CancelButton 1 + { + Pos = MAP_APPFONT ( 202 , 92 ) ; + Size = MAP_APPFONT ( 64 , 12 ) ; + TabStop = TRUE ; + }; +}; +Menu MENU_CLIENT +{ + ItemList = + { + MenuItem + { + Identifier = IDM_FILE ; + HelpID = IDM_FILE_HELP ; + Text = "~File" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = IDM_FILE_OPEN_TEST ; + HelpID = IDM_FILE_OPEN_TEST_HELP ; + Text = "~Open Test Window" ; + }; + MenuItem + { + Identifier = 4 ; + Separator = TRUE ; + }; + MenuItem + { + Identifier = IDM_FILE_EXIT ; + HelpID = IDM_FILE_EXIT_HELP ; + Text = "~Beenden" ; + AccelKey = KeyCode + { + Code = KEY_F4 ; + Modifier2 = TRUE ; + }; + }; + }; + }; + }; + MenuItem + { + Identifier = IDM_TEST ; + Text = "~Test" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = IDM_TEST_GROSS ; + Text = "~Großer Testdialog" ; + }; + MenuItem + { + Identifier = IDM_SYS_DLG ; + Text = "~Sysdialoge" ; + }; + }; + }; + }; + }; +}; + diff --git a/automation/source/miniapp/servuid.hxx b/automation/source/miniapp/servuid.hxx new file mode 100644 index 000000000000..362b803ea808 --- /dev/null +++ b/automation/source/miniapp/servuid.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define UID_GROSSER_TEST_DLG 101 +#define UID_CheckBox 202 +#define UID_TriStateBox 303 +#define UID_OKButton 404 +#define UID_TimeField 505 +#define UID_MultiLineEdit 606 +#define UID_RadioButton1 707 +#define UID_RadioButton2 708 +#define UID_MultiListBox 809 +#define UID_ComboBox 910 +#define UID_DateBox 1011 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/test.bas b/automation/source/miniapp/test.bas new file mode 100644 index 000000000000..6d00e892fcb3 --- /dev/null +++ b/automation/source/miniapp/test.bas @@ -0,0 +1,126 @@ +'encoding UTF-8 Do not remove or change this line! +sub main +' cMassentest +' DisplayHid + cTestdialog + cSysDlgTest + cFileOpenTest + SidWintree + + FileExit +end sub + +testcase cMassentest + +DisplayHid +resetapplication +FileDialog +kontext "GrosserTestDlg" +dim c,t,lang,i +c = 0 +lang = "0123456789abcdef" +lang = lang + lang +lang = lang + lang +lang = lang + lang +lang = lang + lang +lang = lang + lang +lang = lang + lang + +lang = lang + lang +lang = lang + lang +nodebug +while 1 + c = c + 1 + t = str(c) + MultiLineEdit.SetText t + CheckBox.check lang + CheckBox.uncheck lang + for i = 1 to 200 : next + beep +wend + +endcase + + +testcase cFileOpenTest + + FileOpenTest + setclipboard wintree + kontext + active.cancel + +endcase + + +testcase cSysDlgTest + + SysDialogs + setclipboard wintree + kontext + active.yes + setclipboard wintree + active.ok + active.Cancel + + SysDialogs + active.Cancel + active.ok + +endcase + +testcase cTestdialog + + FileDialog + + kontext "GrosserTestDlg" + CheckBox.uncheck + TriStateBox.tristate + 'OKButton +' TimeField.settext("fhsdjk") + MultiLineEdit.SetText "Das war der Text: '"+MultiLineEdit.GetText+"'" + RadioButton1.check + RadioButton2.check +' MultiListBox.select 2 + ComboBox.select("Dritter") + DateBox.select("1.1.91") + + GrosserTestDlg.ok + +endcase + + +sub LoadIncludeFiles + + start "miniapp.exe", "-enableautomation" + + use "test.win" + use "test.sid" + + testexit + +end sub + +sub testenter +end sub + +sub testexit + + dim xx + xx = resetapplication + if xx > "" then warnlog xx + +end sub + + + + + + + + + + + + + + diff --git a/automation/source/miniapp/test.sid b/automation/source/miniapp/test.sid new file mode 100644 index 000000000000..3af8966aa06b --- /dev/null +++ b/automation/source/miniapp/test.sid @@ -0,0 +1,5 @@ +FileOpenTest IDM_FILE_OPEN_TEST +FileExit IDM_FILE_EXIT +FileDialog IDM_TEST_GROSS +SidWintree IDM_TEST_WINTREE +SysDialogs IDM_SYS_DLG diff --git a/automation/source/miniapp/test.win b/automation/source/miniapp/test.win new file mode 100644 index 000000000000..224ca5ad2d44 --- /dev/null +++ b/automation/source/miniapp/test.win @@ -0,0 +1,13 @@ +*active +*GrosserTestDlg UID_GROSSER_TEST_DLG +CheckBox UID_CheckBox +TriStateBox UID_TriStateBox +OKButton UID_OKButton +TimeField UID_TimeField +MultiLineEdit UID_MultiLineEdit +RadioButton1 UID_RadioButton1 +RadioButton2 UID_RadioButton2 +MultiListBox UID_MultiListBox +ComboBox UID_ComboBox +DateBox UID_DateBox + diff --git a/automation/source/miniapp/testapp.cxx b/automation/source/miniapp/testapp.cxx new file mode 100644 index 000000000000..d6cdd79f0731 --- /dev/null +++ b/automation/source/miniapp/testapp.cxx @@ -0,0 +1,350 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_automation.hxx" +#include <svtools/filedlg.hxx> +#include <stdio.h> +#include <vcl/msgbox.hxx> +#include <tools/debug.hxx> +#include <svtools/testtool.hxx> +#include <svtools/ttprops.hxx> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/process.h> +#include <ucbhelper/contentbroker.hxx> +#include <ucbhelper/configurationkeys.hxx> +#include <comphelper/regpathhelper.hxx> +#include <comphelper/processfactory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <com/sun/star/registry/XImplementationRegistration.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/XContentProviderManager.hpp> + +#include "servres.hrc" +#include "servres.hxx" +#include "testapp.hxx" + +using namespace comphelper; +using namespace cppu; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; +using namespace com::sun::star::ucb; + +static ResMgr* pAppMgr = NULL; + +MainWindow::MainWindow(MyApp *pAppl) +: WorkWindow(NULL, WB_STDWORK) +, pApp(pAppl) +{} + +IMPL_LINK(MainWindow,MenuSelectHdl,MenuBar*,aMenu) +{ + + return pApp->GetDispatcher()->ExecuteFunction(aMenu->GetCurItemId()); + +} + +void MainWindow::FileOpen() +{ + FileDialog Dlg(this,WB_OPEN ); + + Dlg.AddFilter(CUniString("Alle Dateien"), CUniString("*.*")); + Dlg.SetCurFilter (CUniString("*.*")); + + if (Dlg.Execute() == RET_OK) + { + new EditFileWindow(this,Dlg.GetPath()); + } +} + + +void MainWindow::TestGross() +{ + ModalDialogGROSSER_TEST_DLG Dlg(this,ResId(GROSSER_TEST_DLG, *pAppMgr)); + + if (Dlg.Execute() == RET_OK) + { + } +} + + +BOOL MainWindow::Close() +{ + WorkWindow::Close(); + FileExit(); + return TRUE; +} + +void MainWindow::FileExit() +{ +/* WriteSTBProfile();*/ + +// if (pApp->CloseAll()) + pApp->Quit(); +} + + +void MainWindow::Tree(GHEditWindow *aEditWin, Window *pBase, USHORT Indent) +{ + String sIndent,aText; + sIndent.Expand(5*Indent); + + aText = pBase->GetText(); + aText.SearchAndReplaceAllAscii("\n",CUniString("\\n")); + + aEditWin->AddText(String(sIndent).AppendAscii("Text: ").Append(aText).AppendAscii("\n")); + aEditWin->AddText(String(sIndent).AppendAscii("Help: ").Append(String::CreateFromInt64(pBase->GetHelpId())).AppendAscii(":").Append(pBase->GetQuickHelpText()).AppendAscii(":").Append(pBase->GetHelpText()).AppendAscii("\n")); + + USHORT i; + for (i = 0 ; i < pBase->GetChildCount() ; i++) + { + Tree(aEditWin,pBase->GetChild(i),Indent+1); + } +} + +void MainWindow::WinTree() +{ + + GHEditWindow * aEditWin = new GHEditWindow(this,CUniString("Window Tree")); + Tree(aEditWin,this,0); + +} + +void MainWindow::SysDlg() +{ + switch (QueryBox(this,WB_YES_NO_CANCEL | WB_DEF_YES, CUniString("Want to open another Dialog?")).Execute()) + { + case RET_YES: + while ( WarningBox(this,WB_OK_CANCEL | WB_DEF_OK,CUniString("Well this is the last box now!")).Execute() == RET_OK ) ; + break; + case RET_NO: + break; + case RET_CANCEL:InfoBox(this,CUniString("Oh well..")).Execute(); + break; + } + +/* + +#define WB_OK ((WinBits)0x0010) +#define WB_OK_CANCEL ((WinBits)0x0020) +#define WB_YES_NO ((WinBits)0x0040) +#define WB_YES_NO_CANCEL ((WinBits)0x0080) +#define WB_RETRY_CANCEL ((WinBits)0x0100) + +#define WB_DEF_OK ((WinBits)0x0200) +#define WB_DEF_CANCEL ((WinBits)0x0400) +#define WB_DEF_RETRY ((WinBits)0x0800) +#define WB_DEF_YES ((WinBits)0x1000) +#define WB_DEF_NO ((WinBits)0x2000) + +#define RET_OK TRUE +#define RET_CANCEL FALSE +#define RET_YES 2 +#define RET_NO 3 +#define RET_RETRY 4 +*/ +} + +MyApp aApp; + +MyApp::MyApp() +{ + pMainWin = NULL; +} + +void MyApp::Property( ApplicationProperty& rProp ) +{ + TTProperties* pTTProperties = PTR_CAST( TTProperties, &rProp ); + if ( pTTProperties ) + { + pTTProperties->nPropertyVersion = TT_PROPERTIES_VERSION; + switch ( pTTProperties->nActualPR ) + { +/* case TT_PR_SLOTS: + { + pTTProperties->nSidOpenUrl = SID_OPENURL; + pTTProperties->nSidFileName = SID_FILE_NAME; + pTTProperties->nSidNewDocDirect = SID_NEWDOCDIRECT; + pTTProperties->nSidCopy = SID_COPY; + pTTProperties->nSidPaste = SID_PASTE; + pTTProperties->nSidSourceView = SID_SOURCEVIEW; + pTTProperties->nSidSelectAll = SID_SELECTALL; + pTTProperties->nSidReferer = SID_REFERER; + pTTProperties->nActualPR = 0; + } + break;*/ + case TT_PR_DISPATCHER: + { + PlugInDispatcher* pDispatcher = GetDispatcher(); + if ( !pDispatcher ) + pTTProperties->nActualPR = TT_PR_ERR_NODISPATCHER; + else + { + pDispatcher->SetExecuteMode(EXECUTEMODE_DIALOGASYNCHRON); + if ( pDispatcher->ExecuteFunction( + pTTProperties->mnSID, pTTProperties->mppArgs, pTTProperties->mnMode ) + == EXECUTE_NO ) + pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; + else + pTTProperties->nActualPR = 0; + } + } + break; +/* case TT_PR_IMG: + { + SvDataMemberObjectRef aDataObject = new SvDataMemberObject(); + SvData* pDataBmp = new SvData( FORMAT_BITMAP ); + pDataBmp->SetData( pTTProperties->mpBmp ); + aDataObject->Append( pDataBmp ); + aDataObject->CopyClipboard(); + pTTProperties->nActualPR = 0; + } + break;*/ + default: + { + pTTProperties->nPropertyVersion = 0; + } + } + return; + } +} + + +USHORT MyDispatcher::ExecuteFunction( USHORT nSID, SfxPoolItem** ppArgs, USHORT nMode) +{ + (void) ppArgs; /* avoid warning about unused parameter */ + (void) nMode; /* avoid warning about unused parameter */ + + switch (nSID) + { + case IDM_FILE_EXIT: pMainWin->FileExit(); break; + case IDM_FILE_OPEN_TEST: pMainWin->FileOpen(); break; + case IDM_TEST_GROSS: pMainWin->TestGross(); break; + case IDM_TEST_WINTREE: pMainWin->WinTree(); break; + case IDM_SYS_DLG: pMainWin->SysDlg(); break; + default: + { + DBG_ERROR1("Dispatcher kennt Funktion nicht %s",ByteString::CreateFromInt64(nSID).GetBuffer()); + return EXECUTE_NO; + } + + } + return EXECUTE_YES; +} + +PlugInDispatcher* MyApp::GetDispatcher() +{ + return pMyDispatcher; +} + +Reference< XContentProviderManager > InitializeUCB( void ) +{ + OUString path; + if( osl_Process_E_None != osl_getExecutableFile( (rtl_uString**)&path ) ) + { + InfoBox( NULL, String::CreateFromAscii( "Couldn't retrieve directory of executable" ) ).Execute(); + exit( 1 ); + } + OSL_ASSERT( path.lastIndexOf( '/' ) >= 0 ); + + + ::rtl::OUStringBuffer bufServices( path.copy( 0, path.lastIndexOf( '/' )+1 ) ); + bufServices.appendAscii("services.rdb"); + OUString services = bufServices.makeStringAndClear(); + + ::rtl::OUStringBuffer bufTypes( path.copy( 0, path.lastIndexOf( '/' )+1 ) ); + bufTypes.appendAscii("types.rdb"); + OUString types = bufTypes.makeStringAndClear(); + + + Reference< XMultiServiceFactory > xSMgr; + try + { + xSMgr = createRegistryServiceFactory( types, services, sal_True ); + } + catch( com::sun::star::uno::Exception & exc ) + { + fprintf( stderr, "Couldn't bootstrap uno servicemanager for reason : %s\n" , + OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + InfoBox( NULL, String( exc.Message ) ).Execute(); + throw ; + } + + + ////////////////////////////////////////////////////////////////////// + // set global factory + setProcessServiceFactory( xSMgr ); + +// Create unconfigured Ucb: + Sequence< Any > aArgs; + ucbhelper::ContentBroker::initialize( xSMgr, aArgs ); + Reference< XContentProviderManager > xUcb = + ucbhelper::ContentBroker::get()->getContentProviderManagerInterface(); + + Reference< XContentProvider > xFileProvider + ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY ); + xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True ); + + return xUcb; +} + +void MyApp::Main() +{ + Reference< XContentProviderManager > xUcb = InitializeUCB(); + LanguageType aRequestedLanguage; + aRequestedLanguage = LanguageType( LANGUAGE_GERMAN ); + + AllSettings aSettings = GetSettings(); + aSettings.SetUILanguage( aRequestedLanguage ); + aSettings.SetLanguage( aRequestedLanguage ); + SetSettings( aSettings ); + pAppMgr = CREATEVERSIONRESMGR( tma ); + + MainWindow MainWin(this); + pMainWin = &MainWin; + + MenuBar aMenu(ResId(MENU_CLIENT,*pAppMgr)); + MainWin.SetMenuBar( &aMenu ); + aMenu.GetPopupMenu( IDM_FILE )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); + aMenu.GetPopupMenu( IDM_TEST )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); + + MyDispatcher MyDsp(pMainWin); + pMyDispatcher = &MyDsp; + + MainWin.SetText(CUniString("Star Division Test Tool Client Window")); + MainWin.Show(); + + RemoteControl aRC; + + Execute(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/testapp.hxx b/automation/source/miniapp/testapp.hxx new file mode 100644 index 000000000000..60a66d8a0607 --- /dev/null +++ b/automation/source/miniapp/testapp.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TESTAPP_HXX +#define _TESTAPP_HXX + +#include <vcl/svapp.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <vcl/edit.hxx> +#include <vcl/group.hxx> +#include <vcl/combobox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/menu.hxx> +#include <vcl/wrkwin.hxx> +#include <svl/poolitem.hxx> + + +#include "editwin.hxx" + + +#define EXECUTE_NO 0 +#define EXECUTE_POSSIBLE 1 +#define EXECUTE_YES 2 +#define EXECUTEMODE_ASYNCHRON 1 +#define EXECUTEMODE_DIALOGASYNCHRON 2 + + +class MyApp; +class MainWindow : public WorkWindow +{ + MyApp *pApp; + +public: + MainWindow(MyApp *pAppl); + virtual BOOL Close(); // derived + + void FileExit(); + void FileOpen(); + void TestGross(); + void Tree(GHEditWindow *aEditWin, Window *pBase, USHORT Indent); + void WinTree(); + void SysDlg(); + DECL_LINK(MenuSelectHdl,MenuBar*); + +}; +#define PlugInDispatcher MyDispatcher +class MyDispatcher +{ + MainWindow *pMainWin; + +public: + MyDispatcher(MainWindow *MainWin) : pMainWin(MainWin) {}; + virtual ~MyDispatcher() {}; + virtual USHORT ExecuteFunction( USHORT nSID, SfxPoolItem** ppArgs = 0, USHORT nMode = 0); + virtual void SetExecuteMode( USHORT nMode ) + { + (void) nMode; /* avoid warning about unused parameter */ + }; // Ist hier sowieso egal +}; + +class MyApp : public Application +{ + PopupMenu *MyMenu; + Timer aCommandTimer; + PlugInDispatcher *pMyDispatcher; + +public: + MyApp(); + void Main(); + + virtual void Property( ApplicationProperty& ); + virtual PlugInDispatcher* GetDispatcher(); + + MainWindow *pMainWin; +}; + +// ----------------------------------------------------------------------- + +extern MyApp aApp; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |